ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
VP1GraphicsView::Imp Class Reference
Collaboration diagram for VP1GraphicsView::Imp:

Public Member Functions

void init (VP1GraphicsView *)
 
void setNewSelected (QGraphicsItem *, const bool &multimode=false)
 
void locateActiveItemAtPoint (QGraphicsItem *&, VP1GraphicsItemCollection *&ic, const QPoint &pos, VP1GraphicsItemCollection *searchic=0)
 
void select (QGraphicsItem *item)
 
void deselect (QGraphicsItem *item)
 
void HighLightItemBeingDeleted (HighLightItem *)
 
void paintDescription (QPainter *painter)
 
void createNewHelptextImage (const QRect &imrect)
 

Public Attributes

QGraphicsScene * scene
 
VP1GraphicsViewview
 
Mode mode
 
Mode lastmajormode
 
QList< VP1GraphicsItemCollection * > cols_act
 
QList< VP1GraphicsItemCollection * > cols_all
 
QSet< VP1GraphicsItemCollection * > cols_override_inactive
 
QSet< VP1GraphicsItemCollection * > cols_override_unmovable
 
QRectF home
 
QTimer * zoomanim_timer
 
int zoomanim_nsteps
 
double zoomanim_totaltime
 
double zoomfactoronseek
 
QQueue< QRectF > zoomanim_queue
 
QPainter::RenderHints savedrenderhints
 
QPoint dragzoom_startpoint
 
QMap< QGraphicsItem *, HighLightItem * > selecteditems
 
VP1GraphicsItemCollectionic_multiselection
 
bool clearselectionsemitsignals
 
QList< QGraphicsItem * > lastemittedselecteditems
 
QString currentsaveimagefile
 
QTextDocument helptext
 
QImage * helptextimage
 
bool showhelptext
 
IVP12DViewTransformationtransform
 
bool transformactive
 

Detailed Description

Definition at line 61 of file VP1GraphicsView.cxx.

Member Function Documentation

◆ createNewHelptextImage()

void VP1GraphicsView::Imp::createNewHelptextImage ( const QRect &  imrect)

Definition at line 1003 of file VP1GraphicsView.cxx.

1004 {
1005  if(helptext.isEmpty()) {
1006  helptext.setHtml ("<html>\n"
1007  "\n"
1008  "<h2>How to navigate a VP1GraphicsView</h2>\n"
1009  "\n"
1010  " <p>\n <b>H/F1</b> Show this help."
1011  " \n <b>S</b> Seek mode.\n"
1012  " \n <b>+/-</b> Zoom.\n"
1013  " \n <b>CTRL+HOME</b> Set home.\n"
1014  " \n <b>HOME</b> View home.\n"
1015  " \n <b>1</b> View all.\n"
1016  " \n <b>ESC</b> Switch between view and pick mode.\n"
1017  " \n <b>P</b> Print view.\n"
1018  " \n <b>CTRL+P</b> Save snapshot to image file.</p>\n"
1019  " <p>\n <b>Mouse wheel</b> zoom. Use <b>CTRL</b> and <b>SHIFT</b> for finegrained control.</p>\n"
1020  " <p>\n To select items (in pick mode), click on them. Selected multiple by holding down <b>SHIFT</b>.</p>\n"
1021  "\n"
1022  "<p>\n"
1023  " Please report any bugs to <i>Thomas.Kittelmann@cern.ch</i>.\n"
1024  "</p>\n"
1025  "\n"
1026  "\n"
1027  "</html>" );
1028  QFont myfont("Helvetica",36);
1029  // myfont.setPointSize(400);
1030  helptext.setDefaultFont ( myfont );
1031  // helptext.defaultFont().setPointSize(400);
1032  }
1033 
1034  delete helptextimage;
1035  helptextimage = new QImage(imrect.size(), QImage::Format_ARGB32);//Fixme delete in destructor!!
1036 
1037  QPainter painter;
1038  painter.begin(helptextimage);
1039 
1040  int pageWidth = qMax(imrect.width() - 100, 100);
1041  int pageHeight = qMax(imrect.height() - 100, 100);
1042  if (pageWidth != helptext.pageSize().width()) {
1043  helptext.setPageSize(QSize(pageWidth, pageHeight));
1044  }
1045 
1046  QRect textRect(imrect.width() / 2 - pageWidth / 2,
1047  imrect.height() / 2 - pageHeight / 2,
1048  pageWidth,
1049  pageHeight);
1050  int pad = 10;
1051  QRect clearRect = textRect.adjusted(-pad, -pad, pad, pad);
1052  painter.setPen(Qt::NoPen);
1053  painter.setBrush(QColor(0, 0, 0, 63));
1054  int shade = 10;
1055  painter.drawRect(clearRect.x() + clearRect.width() + 1,
1056  clearRect.y() + shade,
1057  shade,
1058  clearRect.height() + 1);
1059  painter.drawRect(clearRect.x() + shade,
1060  clearRect.y() + clearRect.height() + 1,
1061  clearRect.width() - shade + 1,
1062  shade);
1063 
1064  painter.setRenderHint(QPainter::Antialiasing, false);
1065  painter.setBrush(QColor(255, 255, 255, 220));
1066  painter.setPen(Qt::black);
1067  painter.drawRect(clearRect);
1068 
1069  painter.setClipRegion(textRect, Qt::IntersectClip);
1070  painter.translate(textRect.topLeft());
1071 
1072  QAbstractTextDocumentLayout::PaintContext ctx;
1073 
1074  QLinearGradient g(0, 0, 0, textRect.height());
1075  g.setColorAt(0, Qt::black);
1076  g.setColorAt(0.9, Qt::black);
1077  g.setColorAt(1, Qt::transparent);
1078 
1079  QPalette pal = view->viewport()->palette();
1080  pal.setBrush(QPalette::Text, g);
1081 
1082  ctx.palette = pal;
1083  ctx.clip = QRect(0, 0, textRect.width(), textRect.height());
1084  helptext.documentLayout()->draw(&painter, ctx);
1085 
1086  painter.end();
1087 
1088 }

◆ deselect()

void VP1GraphicsView::Imp::deselect ( QGraphicsItem *  item)

Definition at line 703 of file VP1GraphicsView.cxx.

704 {
705  if (selecteditems.count()==1) {
707  return;
708  }
709 
710  assert(selecteditems.contains(item));
712  if (scene->items().contains(it.value())) {
713  assert(scene->items().contains(it.value()));
714  scene->removeItem(it.value());
715  it.value()->sendsignalondelete = false;
716  delete it.value();
717  }
718  assert(selecteditems.contains(item));
719  selecteditems.erase(it);
720  assert(!selecteditems.contains(item));
721 }

◆ HighLightItemBeingDeleted()

void VP1GraphicsView::Imp::HighLightItemBeingDeleted ( HighLightItem hlitem)

Definition at line 646 of file VP1GraphicsView.cxx.

647 {
648 
649 #ifndef NDEBUG
650  QMapIterator<QGraphicsItem*,HighLightItem*> ittest(selecteditems);
651  assert(ittest.findNext(hlitem));
652 #endif
653 
655  it = selecteditems.begin(), itE = selecteditems.end();
656  for (;it!=itE;++it) {
657  if (it.value()==hlitem) {
658  selecteditems.erase(it);
659  break;
660  }
661  }
662 
663  if (ic_multiselection) {
665  }
666 #ifndef NDEBUG
667  QMapIterator<QGraphicsItem*,HighLightItem*> ittest2(selecteditems);
668  assert(!ittest2.findNext(hlitem));
669 #endif
670 }

◆ init()

void VP1GraphicsView::Imp::init ( VP1GraphicsView v)

Definition at line 149 of file VP1GraphicsView.cxx.

150 {
151  view=v;
152  view->setTransformationAnchor(AnchorUnderMouse);
153  view->setResizeAnchor(AnchorViewCenter);
154  if (QGLFormat::hasOpenGL())//It turns out that when doing x-forward (at least from lxplus) GLX, and thus OpenGL support is not present.
155  view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers),view));
156  view->setRenderHint(QPainter::Antialiasing);//QPainter::SmoothPixmapTransform
157  view->setBackgroundBrush(Qt::black);
158  if (!view->scene())
159  view->setScene(new QGraphicsScene());
160  scene=view->scene();
161  lastmajormode = mode = PICK;
162  view->setMode(PICK);
163 
164  view->setFrameStyle(QFrame::NoFrame);
165 
166  zoomanim_timer = new QTimer();
168  zoomfactoronseek = 10.0;
169  //Like this to set the correct timer interval:
170  zoomanim_nsteps = 24;
171  view->setAnimatedZoomTime(1500.0);//ms
172 
173  // Due to a bug in Qt 4.3.0 (not present in 4.2.3 and supposedly
174  // fixed in 4.3.1), we have to show the scrollbars if we want to
175  // have proper scrollhanddrag and seek modes. Therefore we uncomment
176  // the next two lines - and we should reenable them for Qt4.3.1 (fixme).
177  // view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
178  // view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
179 
180  //Make sure that animation aborts if user moves a scrollbar (in case someone turns them on):
181  QObject::connect(view->horizontalScrollBar(),SIGNAL(sliderMoved(int)),view,SLOT(abortZoomAnimation()));
182  QObject::connect(view->verticalScrollBar(),SIGNAL(sliderMoved(int)),view,SLOT(abortZoomAnimation()));
185 // selecteditem=0;
186 // selectionoutline=0;
187  helptextimage=0;
188  showhelptext=false;
189 
190  transform = 0;
191  transformactive = false;
192  //fixme:
193  if (false) {
194  transformactive = true;
195  // transform = new VP12DViewRZFishEyeTransformation();
197  view->setInteractive ( false );
198  }
199 
200 }

◆ locateActiveItemAtPoint()

void VP1GraphicsView::Imp::locateActiveItemAtPoint ( QGraphicsItem *&  item,
VP1GraphicsItemCollection *&  ic,
const QPoint &  pos,
VP1GraphicsItemCollection searchic = 0 
)

Definition at line 603 of file VP1GraphicsView.cxx.

606  {
607 
608  //We turn the point into a small circle - to get some chance of picking lines, degenerate rectangles, etc.
609  const double tol = 2.0;
610  QRectF tolrect( pos.x()-tol, pos.y()-tol, 2*tol, 2*tol );
611 
612  QPainterPath p;
613  if (transform&&transformactive) {
614  QPainterPath ptmp;
615  ptmp.addEllipse(tolrect);
616  QPainterPath ptmp2;
617  transform->inverseTransformPath(view->mapToScene(ptmp),ptmp2);
618  QPainterPath p = view->mapFromScene(ptmp2);
619  } else {
620  p.addEllipse(tolrect);
621  }
622 
623  //Fixme: use faster stl style iterators.
624  for (QGraphicsItem* item2 : view->items(p)) {
625  if (searchic) {
626  if (searchic->itemBelongsAndIsPresentlyActive(item2)) {
627  item=item2;
628  ic=searchic;
629  return;
630  }
631  } else {
632  for (VP1GraphicsItemCollection* ic2 : cols_act) {
633  if (ic2->itemBelongsAndIsPresentlyActive(item2)) {
634  item=item2;
635  ic=ic2;
636  return;
637  }
638  }
639  }
640  }
641  assert(!item&&!ic);
642  return;
643 }

◆ paintDescription()

void VP1GraphicsView::Imp::paintDescription ( QPainter *  painter)

◆ select()

void VP1GraphicsView::Imp::select ( QGraphicsItem *  item)

Definition at line 724 of file VP1GraphicsView.cxx.

725 {
726  assert(!selecteditems.contains(item));
727 
728  QPainterPath path = item->shape();
729 
730  HighLightItem* outline = new HighLightItem(path,item,view);
731  outline->setBrush(QColor(250,0,250,100));
732  outline->setPen(QPen(Qt::red,0,Qt::SolidLine,Qt::SquareCap,Qt::RoundJoin));
733  scene->addItem(outline);
734 
735  selecteditems.insert(item,outline);
736 
737 }

◆ setNewSelected()

void VP1GraphicsView::Imp::setNewSelected ( QGraphicsItem *  item,
const bool &  multimode = false 
)

Definition at line 740 of file VP1GraphicsView.cxx.

740  {
741 
742  assert(item);
743 
744  if (continueselection) {
745  if (selecteditems.contains(item))
746  deselect(item);
747  else
748  select(item);
749  return;
750  } else {
751  if (!selecteditems.empty()) {
754  }
755  select(item);
756  }
757 
758 // if (selecteditems.contains(item))
759 // view->addselect(item);
760 // view->removeselect(item);
761 
762 // if (!continueselection&&!selecteditems.empty()) {
763 // view->clearSelections();
764 // }
765 
766 
767 }

Member Data Documentation

◆ clearselectionsemitsignals

bool VP1GraphicsView::Imp::clearselectionsemitsignals

Definition at line 102 of file VP1GraphicsView.cxx.

◆ cols_act

QList<VP1GraphicsItemCollection*> VP1GraphicsView::Imp::cols_act

Definition at line 71 of file VP1GraphicsView.cxx.

◆ cols_all

QList<VP1GraphicsItemCollection*> VP1GraphicsView::Imp::cols_all

Definition at line 72 of file VP1GraphicsView.cxx.

◆ cols_override_inactive

QSet<VP1GraphicsItemCollection*> VP1GraphicsView::Imp::cols_override_inactive

Definition at line 76 of file VP1GraphicsView.cxx.

◆ cols_override_unmovable

QSet<VP1GraphicsItemCollection*> VP1GraphicsView::Imp::cols_override_unmovable

Definition at line 77 of file VP1GraphicsView.cxx.

◆ currentsaveimagefile

QString VP1GraphicsView::Imp::currentsaveimagefile

Definition at line 106 of file VP1GraphicsView.cxx.

◆ dragzoom_startpoint

QPoint VP1GraphicsView::Imp::dragzoom_startpoint

Definition at line 88 of file VP1GraphicsView.cxx.

◆ helptext

QTextDocument VP1GraphicsView::Imp::helptext

Definition at line 108 of file VP1GraphicsView.cxx.

◆ helptextimage

QImage* VP1GraphicsView::Imp::helptextimage

Definition at line 109 of file VP1GraphicsView.cxx.

◆ home

QRectF VP1GraphicsView::Imp::home

Definition at line 79 of file VP1GraphicsView.cxx.

◆ ic_multiselection

VP1GraphicsItemCollection* VP1GraphicsView::Imp::ic_multiselection

Definition at line 95 of file VP1GraphicsView.cxx.

◆ lastemittedselecteditems

QList<QGraphicsItem*> VP1GraphicsView::Imp::lastemittedselecteditems

Definition at line 103 of file VP1GraphicsView.cxx.

◆ lastmajormode

Mode VP1GraphicsView::Imp::lastmajormode

Definition at line 69 of file VP1GraphicsView.cxx.

◆ mode

Mode VP1GraphicsView::Imp::mode

Definition at line 68 of file VP1GraphicsView.cxx.

◆ savedrenderhints

QPainter::RenderHints VP1GraphicsView::Imp::savedrenderhints

Definition at line 86 of file VP1GraphicsView.cxx.

◆ scene

QGraphicsScene* VP1GraphicsView::Imp::scene

Definition at line 65 of file VP1GraphicsView.cxx.

◆ selecteditems

QMap<QGraphicsItem*,HighLightItem*> VP1GraphicsView::Imp::selecteditems

Definition at line 91 of file VP1GraphicsView.cxx.

◆ showhelptext

bool VP1GraphicsView::Imp::showhelptext

Definition at line 111 of file VP1GraphicsView.cxx.

◆ transform

IVP12DViewTransformation* VP1GraphicsView::Imp::transform

Definition at line 114 of file VP1GraphicsView.cxx.

◆ transformactive

bool VP1GraphicsView::Imp::transformactive

Definition at line 115 of file VP1GraphicsView.cxx.

◆ view

VP1GraphicsView* VP1GraphicsView::Imp::view

Definition at line 66 of file VP1GraphicsView.cxx.

◆ zoomanim_nsteps

int VP1GraphicsView::Imp::zoomanim_nsteps

Definition at line 82 of file VP1GraphicsView.cxx.

◆ zoomanim_queue

QQueue<QRectF> VP1GraphicsView::Imp::zoomanim_queue

Definition at line 85 of file VP1GraphicsView.cxx.

◆ zoomanim_timer

QTimer* VP1GraphicsView::Imp::zoomanim_timer

Definition at line 81 of file VP1GraphicsView.cxx.

◆ zoomanim_totaltime

double VP1GraphicsView::Imp::zoomanim_totaltime

Definition at line 83 of file VP1GraphicsView.cxx.

◆ zoomfactoronseek

double VP1GraphicsView::Imp::zoomfactoronseek

Definition at line 84 of file VP1GraphicsView.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
VP1GraphicsView::clearSelections
void clearSelections()
Definition: VP1GraphicsView.cxx:673
VP1GraphicsView::updateZoomAnimation
void updateZoomAnimation()
Definition: VP1GraphicsView.cxx:812
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
VP1GraphicsView::abortZoomAnimation
void abortZoomAnimation()
Definition: VP1GraphicsView.cxx:825
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
skel.it
it
Definition: skel.GENtoEVGEN.py:396
VP1GraphicsView::Imp::zoomanim_timer
QTimer * zoomanim_timer
Definition: VP1GraphicsView.cxx:81
VP1GraphicsView::Imp::cols_act
QList< VP1GraphicsItemCollection * > cols_act
Definition: VP1GraphicsView.cxx:71
IVP12DViewTransformation::inverseTransformPath
virtual void inverseTransformPath(const QPainterPath &source, QPainterPath &target) const
Definition: IVP12DViewTransformation.cxx:38
VP1GraphicsView::Imp::helptextimage
QImage * helptextimage
Definition: VP1GraphicsView.cxx:109
VP1GraphicsView::Imp::transformactive
bool transformactive
Definition: VP1GraphicsView.cxx:115
TruthTest.itE
itE
Definition: TruthTest.py:25
VP1GraphicsView::Imp::transform
IVP12DViewTransformation * transform
Definition: VP1GraphicsView.cxx:114
VP1GraphicsView::PICK
@ PICK
Definition: VP1GraphicsView.h:37
VP1GraphicsView::Imp::zoomfactoronseek
double zoomfactoronseek
Definition: VP1GraphicsView.cxx:84
VP1GraphicsView::Imp::deselect
void deselect(QGraphicsItem *item)
Definition: VP1GraphicsView.cxx:703
VP1GraphicsItemCollection::itemBelongsAndIsPresentlyActive
bool itemBelongsAndIsPresentlyActive(QGraphicsItem *) const
Definition: VP1GraphicsItemCollection.cxx:330
VP1GraphicsView::Imp::selecteditems
QMap< QGraphicsItem *, HighLightItem * > selecteditems
Definition: VP1GraphicsView.cxx:91
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
VP1GraphicsView::Imp::mode
Mode mode
Definition: VP1GraphicsView.cxx:68
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
VP1GraphicsView::Imp::helptext
QTextDocument helptext
Definition: VP1GraphicsView.cxx:108
VP1GraphicsView::emitSelectionChanged
void emitSelectionChanged(VP1GraphicsItemCollection *)
Definition: VP1GraphicsView.cxx:892
VP1GraphicsView::setMode
void setMode(const Mode &)
Definition: VP1GraphicsView.cxx:319
VP1GraphicsView::Imp::lastmajormode
Mode lastmajormode
Definition: VP1GraphicsView.cxx:69
grepfile.ic
int ic
Definition: grepfile.py:33
VP1GraphicsView::Imp::select
void select(QGraphicsItem *item)
Definition: VP1GraphicsView.cxx:724
VP1GraphicsView::Imp::clearselectionsemitsignals
bool clearselectionsemitsignals
Definition: VP1GraphicsView.cxx:102
item
Definition: ItemListSvc.h:43
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:154
VP1GraphicsView::Imp::view
VP1GraphicsView * view
Definition: VP1GraphicsView.cxx:66
VP1GraphicsView::Imp::showhelptext
bool showhelptext
Definition: VP1GraphicsView.cxx:111
VP1GraphicsView::HighLightItem
friend class HighLightItem
Definition: VP1GraphicsView.h:97
VP1GraphicsView::setAnimatedZoomTime
void setAnimatedZoomTime(double)
Definition: VP1GraphicsView.cxx:851
VP1GraphicsView::Imp::ic_multiselection
VP1GraphicsItemCollection * ic_multiselection
Definition: VP1GraphicsView.cxx:95
VP1GraphicsItemCollection
Definition: VP1GraphicsItemCollection.h:53
VP1GraphicsView::Imp::zoomanim_nsteps
int zoomanim_nsteps
Definition: VP1GraphicsView.cxx:82
python.TrigInDetArtSteps.timeout
timeout
Definition: TrigInDetArtSteps.py:35
red
@ red
Definition: BinsDiffFromStripMedian.h:18
VP1GraphicsView::Imp::scene
QGraphicsScene * scene
Definition: VP1GraphicsView.cxx:65
VP12DViewRPhiFishEyeTransformation
Definition: VP12DViewRPhiFishEyeTransformation.h:20