37 if ( contextMenu ==
nullptr )
39 contextMenu =
new QMenu (
this );
40 contextMenu->addAction ( editObjectAc );
41 contextMenu->addAction ( deleteObjectAc );
42 contextMenu->addAction ( createObjectAc );
43 contextMenu->addAction ( deleteObjectWidgetAc );
44 contextMenu->addAction ( copyObjectAc );
45 contextMenu->addAction ( buildTableFromClassAc );
46 contextMenu->addAction ( expandAllAc );
47 contextMenu->addAction ( collapseAllAc );
48 contextMenu->addAction ( refByAc );
49 contextMenu->addAction ( refByAcOnlyComp );
54 QModelIndex index = this->currentIndex();
56 if ( index.isValid() )
64 ( contextMenu->actions() ).at ( 0 )->setVisible (
true );
65 ( contextMenu->actions() ).at ( 1 )->setVisible (
true );
66 ( contextMenu->actions() ).at ( 2 )->setVisible (
true );
67 ( contextMenu->actions() ).at ( 3 )->setVisible (
false );
68 ( contextMenu->actions() ).at ( 4 )->setVisible (
true );
69 ( contextMenu->actions() ).at ( 5 )->setVisible (
false );
70 ( contextMenu->actions() ).at ( 6 )->setVisible (
false );
71 ( contextMenu->actions() ).at ( 7 )->setVisible (
false );
72 ( contextMenu->actions() ).at ( 8 )->setVisible (
true );
73 ( contextMenu->actions() ).at ( 9 )->setVisible (
true );
75 catch ( daq::dbe::cannot_handle_invalid_qmodelindex
const & e )
77 ( contextMenu->actions() ).at ( 0 )->setVisible (
false );
78 ( contextMenu->actions() ).at ( 1 )->setVisible (
false );
79 ( contextMenu->actions() ).at ( 2 )->setVisible (
true );
80 ( contextMenu->actions() ).at ( 3 )->setVisible (
false );
81 ( contextMenu->actions() ).at ( 4 )->setVisible (
false );
82 ( contextMenu->actions() ).at ( 5 )->setVisible (
false );
83 ( contextMenu->actions() ).at ( 6 )->setVisible (
false );
84 ( contextMenu->actions() ).at ( 7 )->setVisible (
false );
85 ( contextMenu->actions() ).at ( 8 )->setVisible (
false );
86 ( contextMenu->actions() ).at ( 9 )->setVisible (
false );
90 contextMenu->exec ( Event->globalPos() );
99 editObjectAc =
new QAction ( tr (
"&Edit Object" ),
this );
100 editObjectAc->setShortcut ( tr (
"Ctrl+E" ) );
101 editObjectAc->setShortcutContext ( Qt::WidgetShortcut );
102 connect ( editObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_edit_object() ) );
103 addAction ( editObjectAc );
105 deleteObjectAc =
new QAction ( tr (
"&Delete Object" ),
this );
106 deleteObjectAc->setShortcut ( tr (
"Ctrl+D" ) );
107 deleteObjectAc->setShortcutContext ( Qt::WidgetShortcut );
108 connect ( deleteObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_delete_objects() ) );
109 addAction ( deleteObjectAc );
111 createObjectAc =
new QAction ( tr (
"Create &New Object" ),
this );
112 createObjectAc->setShortcut ( tr (
"Ctrl+N" ) );
113 createObjectAc->setShortcutContext ( Qt::WidgetShortcut );
114 connect ( createObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_create_object() ) );
115 addAction ( createObjectAc );
117 copyObjectAc =
new QAction ( tr (
"&Copy This Object Into A New One" ),
this );
118 copyObjectAc->setShortcut ( tr (
"Ctrl+Shift+N" ) );
119 copyObjectAc->setShortcutContext ( Qt::WidgetShortcut );
120 connect ( copyObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_copy_object() ) );
121 addAction ( copyObjectAc );
123 deleteObjectWidgetAc =
new QAction ( tr (
"Delete Object &Widget" ),
this );
124 deleteObjectWidgetAc->setShortcut ( tr (
"Ctrl+W" ) );
125 deleteObjectWidgetAc->setShortcutContext ( Qt::WidgetShortcut );
126 addAction ( deleteObjectWidgetAc );
128 buildTableFromClassAc =
new QAction ( tr (
"Build Tab&le From Class" ),
this );
129 buildTableFromClassAc->setShortcut ( tr (
"Ctrl+L" ) );
130 buildTableFromClassAc->setShortcutContext ( Qt::WidgetShortcut );
131 addAction ( buildTableFromClassAc );
133 expandAllAc =
new QAction ( tr (
"Expand &All" ),
this );
134 expandAllAc->setShortcut ( tr (
"Ctrl+A" ) );
135 expandAllAc->setShortcutContext ( Qt::WidgetShortcut );
136 connect ( expandAllAc, SIGNAL ( triggered() ),
this,
137 SLOT ( expandAll() ) );
138 addAction ( expandAllAc );
140 collapseAllAc =
new QAction ( tr (
"C&ollapse All" ),
this );
141 collapseAllAc->setShortcut ( tr (
"Ctrl+Shift+C" ) );
142 collapseAllAc->setShortcutContext ( Qt::WidgetShortcut );
143 connect ( collapseAllAc, SIGNAL ( triggered() ),
this,
144 SLOT ( collapseAll() ) );
145 addAction ( collapseAllAc );
147 refByAc =
new QAction ( tr (
"&Referenced By (All objects)" ),
this );
148 refByAc->setShortcut ( tr (
"Ctrl+Y" ) );
149 refByAc->setShortcutContext ( Qt::WidgetShortcut );
150 refByAc->setToolTip (
"Find all objects which reference the selecetd object" );
151 refByAc->setStatusTip ( refByAc->toolTip() );
152 connect ( refByAc, SIGNAL ( triggered() ),
this, SLOT ( referencedByAll() ) );
153 addAction ( refByAc );
155 refByAcOnlyComp =
new QAction ( tr (
"Referenced B&y (Only Composite)" ),
this );
156 refByAcOnlyComp->setShortcut ( tr (
"Ctrl+Shift+Y" ) );
157 refByAcOnlyComp->setShortcutContext ( Qt::WidgetShortcut );
158 refByAcOnlyComp->setToolTip (
159 "Find objects (ONLY Composite ones) which reference the selecetd object" );
160 refByAcOnlyComp->setStatusTip ( refByAcOnlyComp->toolTip() );
161 connect ( refByAcOnlyComp, SIGNAL ( triggered() ),
this,
162 SLOT ( referencedbyOnlycomposite() ) );
163 addAction ( refByAcOnlyComp );
368 QModelIndex Index = currentIndex();
370 if ( !Index.isValid() )
381 std::vector<tref> objects;
383 if ( not obj.is_null() )
385 objects = obj.referenced_by (
"*", All );
388 if ( objects.size() > 0 )
394 Selection->SetQueryObjects ( objects );
395 Selection->setFilterRegExp (
"Dummy" );
396 Selection->setSourceModel ( Source );
399 tView->setModel ( Selection );
400 tView->setWindowTitle ( QString (
"Objects referencing '%1'" ).arg ( obj.UID().c_str() ) );
401 tView->setSortingEnabled (
true );
402 tView->setAlternatingRowColors (
true );
403 tView->resizeColumnToContents ( 0 );
404 tView->resizeColumnToContents ( 1 );
405 tView->setAttribute(Qt::WA_DeleteOnClose);
407 connect ( tView, SIGNAL ( doubleClicked ( QModelIndex ) ),
408 tView, SLOT ( slot_edit_object () ) );
416 WARN (
"No references of only composite objects have been found for object",
" ",
417 "with UID:", obj.UID(),
"of class", obj.class_name() );
421 WARN (
"No references of objects have been found for object",
" ",
"with UID:",
422 obj.UID(),
"of class", obj.class_name() );
426 catch ( daq::dbe::cannot_handle_invalid_qmodelindex
const & e )
439 std::vector<tref> objects;
441 if ( !obj.is_null() )
443 objects = obj.referenced_by (
"*", All );
446 if ( objects.size() > 0 )
452 Selection->SetQueryObjects ( objects );
453 Selection->setFilterRegExp (
"Dummy" );
454 Selection->setSourceModel ( Source );
457 tView->setModel ( Selection );
458 tView->setSortingEnabled (
true );
459 tView->setAlternatingRowColors (
true );
460 tView->resizeColumnToContents ( 0 );
461 tView->hideColumn ( 1 );
463 tView->setWindowTitle ( QString (
"Objects referencing '%1'" ).arg ( obj.UID().c_str() ) );
464 tView->setAttribute(Qt::WA_DeleteOnClose);
466 connect ( tView, SIGNAL ( doubleClicked ( QModelIndex ) ), tView,
467 SLOT ( slot_edit_object () ) );
475 WARN (
"No references for object",
"Only Composite Objects - Not found",
"with UID:",
480 WARN (
"No references for object",
"All Objects - Not found",
"with UID:", obj.UID() );