365{
366 model_common_interface * filtermodel = dynamic_cast<model_common_interface *> ( model() );
367 QModelIndex Index = currentIndex();
368
369 if ( !Index.isValid() )
370 {
371 return;
372 }
373
374 if ( filtermodel )
375 {
376
377 try
378 {
379 tref obj = filtermodel->getobject ( Index );
380 std::vector<tref> objects;
381
382 if ( not
obj.is_null() )
383 {
384 objects =
obj.referenced_by (
"*", All );
385 }
386
387 if ( objects.size() > 0 )
388 {
389 QStringList ColumnNames;
390 ColumnNames << "Class Name" << "Number of Referencing Instances";
392 ->ReturnSourceModel() );
393 models::treeselection * Selection = new models::treeselection();
395 Selection->SetQueryObjects ( objects );
396 Selection->setFilterRegExp ( "Dummy" );
397 Selection->setSourceModel ( Source );
398
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);
407
408 connect ( tView, SIGNAL ( doubleClicked ( QModelIndex ) ),
410
411 tView->show();
412 }
413 else
414 {
415 if ( All )
416 {
417 WARN (
"No references of only composite objects have been found for object",
" ",
418 "with UID:",
obj.UID(),
"of class",
obj.class_name() );
419 }
420 else
421 {
422 WARN (
"No references of objects have been found for object",
" ",
"with UID:",
423 obj.UID(),
"of class",
obj.class_name() );
424 }
425 }
426 }
427 catch ( daq::dbe::cannot_handle_invalid_qmodelindex const & e )
428 {}
429 }
430}
CustomTreeView(QWidget *Parent=nullptr)
Including QT Headers.