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 );
99 editObjectAc =
new QAction ( tr (
"&Edit Object" ),
this );
101 editObjectAc->setShortcutContext ( Qt::WidgetShortcut );
111 createObjectAc =
new QAction ( tr (
"Create &New Object" ),
this );
117 copyObjectAc =
new QAction ( tr (
"&Copy This Object Into A New One" ),
this );
119 copyObjectAc->setShortcutContext ( Qt::WidgetShortcut );
133 expandAllAc =
new QAction ( tr (
"Expand &All" ),
this );
135 expandAllAc->setShortcutContext ( Qt::WidgetShortcut );
136 connect (
expandAllAc, SIGNAL ( triggered() ),
this,
137 SLOT ( expandAll() ) );
140 collapseAllAc =
new QAction ( tr (
"C&ollapse All" ),
this );
144 SLOT ( collapseAll() ) );
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" );
155 refByAcOnlyComp =
new QAction ( tr (
"Referenced B&y (Only Composite)" ),
this );
159 "Find objects (ONLY Composite ones) which reference the selecetd object" );
222 if ( this->model() !=
nullptr )
224 QModelIndexList qindices = this->selectedIndexes();
225 std::vector<QModelIndex> indices;
227 for ( QModelIndex
const & q : qindices )
229 if ( q.isValid() and q.column() == 0 )
231 indices.push_back ( q );
239 casted_model->delete_objects ( indices.begin(), indices.end() );
245 casted_model->delete_objects ( indices.begin(), indices.end() );
249 WARN (
"Object Deleting",
250 "Object deletion failed due to the internal model being in invalid state",
251 "You are advised to restart the application before proceeding any further" );
278 if ( !index.isValid() )
288 bool WidgetFound =
false;
289 QString ObjectEditorName = QString (
"%1@%2" ).arg ( obj.UID().c_str() ).arg (
290 obj.class_name().c_str() );
292 for ( QWidget * Editor : QApplication::allWidgets() )
296 if ( Widget !=
nullptr )
298 if ( ( Widget->objectName() ).compare ( ObjectEditorName ) == 0 )
301 Widget->setVisible (
true );
312 catch ( daq::dbe::cannot_handle_invalid_qmodelindex
const & e )
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 )
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 ) ),
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 )
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,
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() );