36 if ( contextMenu ==
nullptr )
38 contextMenu =
new QMenu (
this );
39 contextMenu->addAction ( editObjectAc );
40 contextMenu->addAction ( deleteObjectAc );
41 contextMenu->addAction ( createObjectAc );
42 contextMenu->addAction ( deleteObjectWidgetAc );
43 contextMenu->addAction ( copyObjectAc );
44 contextMenu->addAction ( buildTableFromClassAc );
45 contextMenu->addAction ( expandAllAc );
46 contextMenu->addAction ( colapseAllAc );
47 contextMenu->addAction ( refByAc );
48 contextMenu->addAction ( refByAcOnlyComp );
53 QModelIndex index = this->currentIndex();
55 if ( index.isValid() )
63 ( contextMenu->actions() ).at ( 0 )->setVisible (
true );
64 ( contextMenu->actions() ).at ( 1 )->setVisible (
true );
65 ( contextMenu->actions() ).at ( 2 )->setVisible (
true );
66 ( contextMenu->actions() ).at ( 3 )->setVisible (
false );
67 ( contextMenu->actions() ).at ( 4 )->setVisible (
true );
68 ( contextMenu->actions() ).at ( 5 )->setVisible (
false );
69 ( contextMenu->actions() ).at ( 6 )->setVisible (
false );
70 ( contextMenu->actions() ).at ( 7 )->setVisible (
false );
71 ( contextMenu->actions() ).at ( 8 )->setVisible (
true );
72 ( contextMenu->actions() ).at ( 9 )->setVisible (
true );
74 catch ( daq::dbe::cannot_handle_invalid_qmodelindex
const & e )
76 ( contextMenu->actions() ).at ( 0 )->setVisible (
false );
77 ( contextMenu->actions() ).at ( 1 )->setVisible (
false );
78 ( contextMenu->actions() ).at ( 2 )->setVisible (
true );
79 ( contextMenu->actions() ).at ( 3 )->setVisible (
false );
80 ( contextMenu->actions() ).at ( 4 )->setVisible (
false );
81 ( contextMenu->actions() ).at ( 5 )->setVisible (
false );
82 ( contextMenu->actions() ).at ( 6 )->setVisible (
false );
83 ( contextMenu->actions() ).at ( 7 )->setVisible (
false );
84 ( contextMenu->actions() ).at ( 8 )->setVisible (
false );
85 ( contextMenu->actions() ).at ( 9 )->setVisible (
false );
89 contextMenu->exec ( Event->globalPos() );
98 editObjectAc =
new QAction ( tr (
"&Edit Object" ),
this );
99 editObjectAc->setShortcut ( tr (
"Ctrl+E" ) );
100 editObjectAc->setShortcutContext ( Qt::WidgetShortcut );
101 connect ( editObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_edit_object() ) );
102 addAction ( editObjectAc );
104 deleteObjectAc =
new QAction ( tr (
"&Delete Object" ),
this );
105 deleteObjectAc->setShortcut ( tr (
"Ctrl+D" ) );
106 deleteObjectAc->setShortcutContext ( Qt::WidgetShortcut );
107 connect ( deleteObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_delete_objects() ) );
108 addAction ( deleteObjectAc );
110 createObjectAc =
new QAction ( tr (
"Create &New Object" ),
this );
111 createObjectAc->setShortcut ( tr (
"Ctrl+N" ) );
112 createObjectAc->setShortcutContext ( Qt::WidgetShortcut );
113 connect ( createObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_create_object() ) );
114 addAction ( createObjectAc );
116 copyObjectAc =
new QAction ( tr (
"Copy This Object Into A &New One" ),
this );
117 copyObjectAc->setShortcut ( tr (
"Ctrl+Shift+N" ) );
118 copyObjectAc->setShortcutContext ( Qt::WidgetShortcut );
119 connect ( copyObjectAc, SIGNAL ( triggered() ),
this, SLOT ( slot_copy_object() ) );
120 addAction ( copyObjectAc );
122 deleteObjectWidgetAc =
new QAction ( tr (
"Delete Object &Widget" ),
this );
123 deleteObjectWidgetAc->setShortcut ( tr (
"Ctrl+W" ) );
124 deleteObjectWidgetAc->setShortcutContext ( Qt::WidgetShortcut );
125 addAction ( deleteObjectWidgetAc );
127 buildTableFromClassAc =
new QAction ( tr (
"Build Tab&le From Class" ),
this );
128 buildTableFromClassAc->setShortcut ( tr (
"Ctrl+L" ) );
129 buildTableFromClassAc->setShortcutContext ( Qt::WidgetShortcut );
130 addAction ( buildTableFromClassAc );
132 expandAllAc =
new QAction ( tr (
"Expand &All" ),
this );
133 expandAllAc->setShortcut ( tr (
"Ctrl+A" ) );
134 expandAllAc->setShortcutContext ( Qt::WidgetShortcut );
135 connect ( expandAllAc, SIGNAL ( triggered() ),
this,
136 SLOT ( expandAll() ) );
137 addAction ( expandAllAc );
139 colapseAllAc =
new QAction ( tr (
"&Collapse All" ),
this );
140 colapseAllAc->setShortcut ( tr (
"Ctrl+Shift+C" ) );
141 colapseAllAc->setShortcutContext ( Qt::WidgetShortcut );
142 connect ( colapseAllAc, SIGNAL ( triggered() ),
this,
143 SLOT ( collapseAll() ) );
144 addAction ( colapseAllAc );
146 refByAc =
new QAction ( tr (
"Referenced B&y (All objects)" ),
this );
147 refByAc->setShortcut ( tr (
"Ctrl+Y" ) );
148 refByAc->setShortcutContext ( Qt::WidgetShortcut );
149 refByAc->setToolTip (
"Find all objects which reference the selecetd object" );
150 refByAc->setStatusTip ( refByAc->toolTip() );
151 connect ( refByAc, SIGNAL ( triggered() ),
this, SLOT ( referencedByAll() ) );
152 addAction ( refByAc );
154 refByAcOnlyComp =
new QAction ( tr (
"Referenced B&y (Only Composite)" ),
this );
155 refByAcOnlyComp->setShortcut ( tr (
"Ctrl+Shift+Y" ) );
156 refByAcOnlyComp->setShortcutContext ( Qt::WidgetShortcut );
157 refByAcOnlyComp->setToolTip (
158 "Find objects (ONLY Composite ones) which reference the selecetd object" );
159 refByAcOnlyComp->setStatusTip ( refByAcOnlyComp->toolTip() );
160 connect ( refByAcOnlyComp, SIGNAL ( triggered() ),
this,
161 SLOT ( referencedbyOnlycomposite() ) );
162 addAction ( refByAcOnlyComp );
367 QModelIndex Index = currentIndex();
369 if ( !Index.isValid() )
380 std::vector<tref> objects;
382 if ( not obj.is_null() )
384 objects = obj.referenced_by (
"*", All );
387 if ( objects.size() > 0 )
389 QStringList ColumnNames;
390 ColumnNames <<
"Class Name" <<
"Number of Referencing Instances";
395 Selection->SetQueryObjects ( objects );
396 Selection->setFilterRegExp (
"Dummy" );
397 Selection->setSourceModel ( Source );
400 tView->setModel ( Selection );
401 tView->setWindowTitle ( QString (
"Objects referencing '%1'" ).arg ( obj.UID().c_str() ) );
402 tView->setSortingEnabled (
true );
403 tView->setAlternatingRowColors (
true );
404 tView->resizeColumnToContents ( 0 );
405 tView->resizeColumnToContents ( 1 );
406 tView->setAttribute(Qt::WA_DeleteOnClose);
408 connect ( tView, SIGNAL ( doubleClicked ( QModelIndex ) ),
409 tView, SLOT ( slot_edit_object () ) );
417 WARN (
"No references of only composite objects have been found for object",
" ",
418 "with UID:", obj.UID(),
"of class", obj.class_name() );
422 WARN (
"No references of objects have been found for object",
" ",
"with UID:",
423 obj.UID(),
"of class", obj.class_name() );
427 catch ( daq::dbe::cannot_handle_invalid_qmodelindex
const & e )
440 std::vector<tref> objects;
442 if ( !obj.is_null() )
444 objects = obj.referenced_by (
"*", All );
447 if ( objects.size() > 0 )
449 QStringList ColumnNames;
450 ColumnNames <<
"Class Name";
455 Selection->SetQueryObjects ( objects );
456 Selection->setFilterRegExp (
"Dummy" );
457 Selection->setSourceModel ( Source );
460 tView->setModel ( Selection );
461 tView->setSortingEnabled (
true );
462 tView->setAlternatingRowColors (
true );
463 tView->resizeColumnToContents ( 0 );
464 tView->hideColumn ( 1 );
466 tView->setWindowTitle ( QString (
"Objects referencing '%1'" ).arg ( obj.UID().c_str() ) );
467 tView->setAttribute(Qt::WA_DeleteOnClose);
469 connect ( tView, SIGNAL ( doubleClicked ( QModelIndex ) ), tView,
470 SLOT ( slot_edit_object () ) );
478 WARN (
"No references for object",
"Only Composite Objects - Not found",
"with UID:",
483 WARN (
"No references for object",
"All Objects - Not found",
"with UID:", obj.UID() );