21 ContextMenu ( nullptr ),
22 ClickedItem ( nullptr ),
23 uuid ( QUuid::createUuid() )
29 setWindowTitle (
"Graphical View" );
31 QGraphicsScene * scene =
new QGraphicsScene (
this );
32 scene->setItemIndexMethod ( QGraphicsScene::NoIndex );
33 scene->setSceneRect ( 0, 0, 10000, 10000 );
34 GraphicalView->setScene ( scene );
35 GraphicalView->setCacheMode ( QGraphicsView::CacheBackground );
36 GraphicalView->setViewportUpdateMode ( QGraphicsView::BoundingRectViewportUpdate );
37 GraphicalView->setRenderHint ( QPainter::Antialiasing );
38 GraphicalView->setTransformationAnchor ( QGraphicsView::AnchorUnderMouse );
39 GraphicalView->setMinimumSize ( 400, 400 );
40 GraphicalView->centerOn ( scene->sceneRect().topLeft() );
41 GraphicalView->setAcceptDrops (
true );
57 GraphicalView->scene()->clear();
61 setWindowTitle ( WindowConfiguration.Title +
" View" );
64 for ( QString & ClassName : WindowConfiguration.GraphicalClassesList )
67 ClassName.toStdString() );
75 double ChildNodeHeight = 0;
90 Used, Object->GetData ( 0 ).toString(), GraphicalClassInfo );
91 GraphicalView->scene()->addItem ( ObjectNodeGraphical );
92 ObjectNodeGraphical->setPos (
93 GraphicalView->scene()->sceneRect().topLeft() + QPointF ( dx, dy ) );
96 if ( ( dx + ObjectNodeGraphical->
boundingRect().width() ) > GraphicalView->scene()
97 ->sceneRect().width() )
100 dy += ChildNodeHeight + 30;
103 ChildNodeHeight = ObjectNodeGraphical->
boundingRect().height();
106 dy += ChildNodeHeight + 30;
141 editObject =
new QAction ( tr (
"&Edit Object" ),
this );
142 editObject->setShortcut ( tr (
"Ctrl+E" ) );
143 editObject->setShortcutContext ( Qt::WidgetShortcut );
144 connect ( editObject, SIGNAL ( triggered() ),
this, SLOT ( editThisObject() ),
145 Qt::UniqueConnection );
146 ContextMenu->addAction ( editObject );
148 deleteObjectAc =
new QAction ( tr (
"&Delete Object" ),
this );
149 deleteObjectAc->setShortcut ( tr (
"Ctrl+D" ) );
150 deleteObjectAc->setShortcutContext ( Qt::WidgetShortcut );
151 connect ( deleteObjectAc, SIGNAL ( triggered() ),
this, SLOT ( deleteThisObject() ),
152 Qt::UniqueConnection );
153 ContextMenu->addAction ( deleteObjectAc );
155 refByAc =
new QAction ( tr (
"Referenced B&y (All objects)" ),
this );
156 refByAc->setShortcut ( tr (
"Ctrl+Y" ) );
157 refByAc->setShortcutContext ( Qt::WidgetShortcut );
158 refByAc->setToolTip (
"Find all objects which reference the selecetd object" );
159 refByAc->setStatusTip ( refByAc->toolTip() );
160 connect ( refByAc, SIGNAL ( triggered() ),
this, SLOT ( referencedBy_All() ),
161 Qt::UniqueConnection );
162 ContextMenu->addAction ( refByAc );
164 refByAcOnlyComp =
new QAction ( tr (
"Referenced B&y (Only Composite)" ),
this );
165 refByAcOnlyComp->setShortcut ( tr (
"Ctrl+Shift+Y" ) );
166 refByAcOnlyComp->setShortcutContext ( Qt::WidgetShortcut );
167 refByAcOnlyComp->setToolTip (
168 "Find objects (ONLY Composite ones) which reference the selecetd object" );
169 refByAcOnlyComp->setStatusTip ( refByAcOnlyComp->toolTip() );
170 connect ( refByAcOnlyComp, SIGNAL ( triggered() ),
this,
171 SLOT ( referencedBy_OnlyComposite() ),
172 Qt::UniqueConnection );
173 ContextMenu->addAction ( refByAcOnlyComp );
175 copyObjectAc =
new QAction ( tr (
"Copy This Object Into A &New One" ),
this );
176 copyObjectAc->setShortcut ( tr (
"Ctrl+Shift+N" ) );
177 copyObjectAc->setShortcutContext ( Qt::WidgetShortcut );
178 connect ( copyObjectAc, SIGNAL ( triggered() ),
this, SLOT ( copyObject() ),
179 Qt::UniqueConnection );
180 ContextMenu->addAction ( copyObjectAc );
307 QString ChoosenWindow;
309 QDialog * ChooseDialog =
new QDialog (
this );
310 QComboBox * Combo =
new QComboBox ( ChooseDialog );
311 QPushButton * GoButton =
new QPushButton (
"Choose" );
312 QHBoxLayout * Layout =
new QHBoxLayout ( ChooseDialog );
313 QLabel * Label =
new QLabel (
"Window Configuration : ", ChooseDialog );
315 connect ( GoButton, SIGNAL ( clicked() ), ChooseDialog, SLOT ( accept() ),
316 Qt::UniqueConnection );
320 for (
Window const & WindowConfig : Configurations )
322 Combo->addItem ( WindowConfig.Title );
325 Layout->addWidget ( Label );
326 Layout->addWidget ( Combo );
327 Layout->addWidget ( GoButton );
329 ChooseDialog->setLayout ( Layout );
330 ChooseDialog->setWindowTitle (
"Choose window configuration" );
332 if ( ChooseDialog->exec() )
334 ChoosenWindow = Combo->currentText();
337 for (
Window & Setting : Configurations )
339 if ( ChoosenWindow == Setting.Title )
341 WindowConfiguration = Setting;
cptr< dbe::CustomTreeView > get_view() const
static MainWindow * findthis()