DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::TableTab Class Reference

#include <TableTab.hpp>

Inheritance diagram for dbe::TableTab:
[legend]
Collaboration diagram for dbe::TableTab:
[legend]

Public Slots

void ResetTabView ()

Signals

void sig_data_dropped (QMimeData const &data, Qt::DropAction)

Public Member Functions

 TableTab (QWidget *parent=0)
 Including Qt.
 ~TableTab ()
dbe::models::table * GetTableModel () const
dbe::models::tableselection * GetTableFilter () const
CustomDelegate * GetTableDelegate () const
CustomTableView * GetTableView () const
void CreateModels ()
void DisconnectView ()
void ResetTableView ()
void ResizeHeaders ()

Protected Member Functions

void dropEvent (QDropEvent *event) override
void dragEnterEvent (QDragEnterEvent *event) override

Private Member Functions

void create_models ()
void reset_models ()

Private Attributes

dbe::models::table * this_model
dbe::models::tableselection * this_filter
CustomDelegate * this_delegate
CustomTableView * this_view
QTabWidget * this_holder

Detailed Description

Definition at line 21 of file TableTab.hpp.

Constructor & Destructor Documentation

◆ TableTab()

dbe::TableTab::TableTab ( QWidget * parent = 0)

Including Qt.

Including dbe Construct a Tabletab and let everything unitialized until first use

Set the geometry and operational properties of the object

Parameters
parenta pointer to the parent widget

Adjusting layout

Definition at line 24 of file TableTab.cpp.

25 : QWidget(parent)
26 , this_model(nullptr)
27 , this_filter(nullptr)
28 , this_delegate(nullptr)
29 , this_view(nullptr)
30{
33 QVBoxLayout* TabLayout = new QVBoxLayout(this);
34 TabLayout->addWidget(this_view);
35 this_view->hide();
36 setAcceptDrops(true);
37 this_holder = dynamic_cast<QTabWidget*>(parent);
38}
CustomTableView(QWidget *parent=0)
Including QT::include <QHeaderView>.
CustomTableView * this_view
Definition TableTab.hpp:44
dbe::models::table * this_model
Definition TableTab.hpp:41
QTabWidget * this_holder
Definition TableTab.hpp:45
CustomDelegate * this_delegate
Definition TableTab.hpp:43
dbe::models::tableselection * this_filter
Definition TableTab.hpp:42

◆ ~TableTab()

dbe::TableTab::~TableTab ( )

Definition at line 40 of file TableTab.cpp.

41{
42 delete this_model;
43 delete this_filter;
44 delete this_delegate;
45 delete this_view;
46}

Member Function Documentation

◆ create_models()

void dbe::TableTab::create_models ( )
private

Definition at line 51 of file TableTab.cpp.

52{
53
54 if (this_model == nullptr) {
55 this_model = new dbe::models::table();
56 connect(this,
57 SIGNAL(sig_data_dropped(QMimeData const&, Qt::DropAction)),
59 SLOT(slot_data_dropped(QMimeData const&, Qt::DropAction)));
60 }
61
63 this_filter = this_filter == nullptr ? new dbe::models::tableselection() : this_filter;
64}
CustomDelegate(QObject *parent=0)
void sig_data_dropped(QMimeData const &data, Qt::DropAction)

◆ CreateModels()

void dbe::TableTab::CreateModels ( )

Definition at line 74 of file TableTab.cpp.

75{
76 if (this_model == nullptr) {
78 } else {
80 }
81
82 connect(this_model, SIGNAL(ResetTab()), this, SLOT(ResetTabView()));
83}
void create_models()
Definition TableTab.cpp:51
void ResetTabView()
Definition TableTab.cpp:120
void reset_models()
Definition TableTab.cpp:67

◆ DisconnectView()

void dbe::TableTab::DisconnectView ( )

Definition at line 88 of file TableTab.cpp.

89{
90 this_view->setModel(NULL);
91}

◆ dragEnterEvent()

void dbe::TableTab::dragEnterEvent ( QDragEnterEvent * event)
overrideprotected

Capture event of the pointer entering the tabletab while dragging something

Parameters
eventis a pointer to the associated qt event object

Definition at line 135 of file TableTab.cpp.

136{
137
138 // If there is nothing created then create as needed
139 CreateModels();
140
141 // Check that all mimetypes are supported
142 for (auto const& mimetype : this_model->mimeTypes()) {
143 if (not event->mimeData()->hasFormat(mimetype.toStdString().c_str())) {
144 event->ignore();
145 return;
146 }
147 }
148
149 // Support only copy actions
150 if (event->proposedAction() != Qt::DropAction::CopyAction) {
151 return;
152 }
153
154 event->acceptProposedAction();
155
156 // connect signals
157 MainWindow* mainwin = MainWindow::findthis();
158 connect(
159 GetTableView(), SIGNAL(OpenEditor(tref)), mainwin, SLOT(slot_launch_object_editor(tref)), Qt::UniqueConnection);
160 connect(GetTableDelegate(),
161 SIGNAL(CreateObjectEditorSignal(tref)),
162 mainwin,
163 SLOT(slot_launch_object_editor(tref)),
164 Qt::UniqueConnection);
165}
static MainWindow * findthis()
void CreateModels()
Definition TableTab.cpp:74
CustomTableView * GetTableView() const
Definition TableTab.cpp:203
CustomDelegate * GetTableDelegate() const
Definition TableTab.cpp:197
QStringList mimeTypes() const override
Definition table.cpp:196
inner::configobject::tref tref
Definition tref.hpp:36

◆ dropEvent()

void dbe::TableTab::dropEvent ( QDropEvent * event)
overrideprotected

Capture a mouse release event of a dragged object

Properly emits a signal to the associated tablemodel, i.e. this is a thread safe operation

Parameters
eventis a pointer to the associated qt event object

Definition at line 177 of file TableTab.cpp.

178{
179 emit sig_data_dropped(*event->mimeData(), event->proposedAction());
180}

◆ GetTableDelegate()

dbe::CustomDelegate * dbe::TableTab::GetTableDelegate ( ) const

Definition at line 197 of file TableTab.cpp.

198{
199 return this_delegate;
200}

◆ GetTableFilter()

dbe::models::tableselection * dbe::TableTab::GetTableFilter ( ) const

Definition at line 191 of file TableTab.cpp.

192{
193 return this_filter;
194}

◆ GetTableModel()

dbe::models::table * dbe::TableTab::GetTableModel ( ) const

Definition at line 185 of file TableTab.cpp.

186{
187 return this_model;
188}

◆ GetTableView()

dbe::CustomTableView * dbe::TableTab::GetTableView ( ) const

Definition at line 203 of file TableTab.cpp.

204{
205 return this_view;
206}

◆ reset_models()

void dbe::TableTab::reset_models ( )
private

Definition at line 67 of file TableTab.cpp.

◆ ResetTableView()

void dbe::TableTab::ResetTableView ( )

Definition at line 94 of file TableTab.cpp.

95{
96 this_filter->setSourceModel(this_model);
97
98 this_view->setItemDelegate(this_delegate);
99 this_view->setModel(this_filter);
100 this_view->show();
101
103}
void ResizeHeaders()
Definition TableTab.cpp:106

◆ ResetTabView

void dbe::TableTab::ResetTabView ( )
slot

Definition at line 120 of file TableTab.cpp.

121{
122 reset_models();
124 this_holder->setTabText(this_holder->indexOf(this), this_model->get_class_name());
125}
void ResetTableView()
Definition TableTab.cpp:94
QString get_class_name() const
Definition table.cpp:424

◆ ResizeHeaders()

void dbe::TableTab::ResizeHeaders ( )

Definition at line 106 of file TableTab.cpp.

107{
108 // TODO: at the moment the resize of columns creates too large columns when several data are in a cell
109 // the resize of rows is a little bit expensive with large tables
110 // to be re-evaluated
111 //
112 // if ( this_view->model() != nullptr )
113 // {
114 // this_view->resizeRowsToContents();
115 // this_view->resizeColumnsToContents();
116 // }
117}

◆ sig_data_dropped

void dbe::TableTab::sig_data_dropped ( QMimeData const & data,
Qt::DropAction  )
signal

Member Data Documentation

◆ this_delegate

CustomDelegate* dbe::TableTab::this_delegate
private

Definition at line 43 of file TableTab.hpp.

◆ this_filter

dbe::models::tableselection* dbe::TableTab::this_filter
private

Definition at line 42 of file TableTab.hpp.

◆ this_holder

QTabWidget* dbe::TableTab::this_holder
private

Definition at line 45 of file TableTab.hpp.

◆ this_model

dbe::models::table* dbe::TableTab::this_model
private

Definition at line 41 of file TableTab.hpp.

◆ this_view

CustomTableView* dbe::TableTab::this_view
private

Definition at line 44 of file TableTab.hpp.


The documentation for this class was generated from the following files: