DataSourceWidget.cpp
42 lines
| 1.0 KiB
| text/x-c
|
CppLexer
Alexandre Leroux
|
r82 | #include <DataSource/DataSourceWidget.h> | ||
#include <ui_DataSourceWidget.h> | ||||
r1495 | #include <DataSource/datasources.h> | |||
#include <SqpApplication.h> | ||||
Alexandre Leroux
|
r82 | |||
Alexandre Leroux
|
r143 | |||
r1478 | namespace | |||
{ | ||||
Alexandre Leroux
|
r82 | |||
/// Number of columns displayed in the tree | ||||
const auto TREE_NB_COLUMNS = 1; | ||||
/// Header labels for the tree | ||||
r1478 | const auto TREE_HEADER_LABELS = QStringList { QObject::tr("Name") }; | |||
Alexandre Leroux
|
r82 | |||
} // namespace | ||||
r1478 | DataSourceWidget::DataSourceWidget(QWidget* parent) | |||
: QWidget { parent } | ||||
, ui { new Ui::DataSourceWidget } | ||||
Alexandre Leroux
|
r82 | { | ||
Alexandre Leroux
|
r109 | ui->setupUi(this); | ||
r1495 | m_model_proxy.setSourceModel(&(sqpApp->dataSources())); | |||
ui->treeView->setModel(&m_model_proxy); | ||||
ui->treeView->setDragEnabled(true); | ||||
m_model_proxy.setFilterRole(Qt::ToolTipRole); | ||||
m_model_proxy.setRecursiveFilteringEnabled(true); | ||||
Alexandre Leroux
|
r475 | |||
// Connection to filter tree | ||||
r1495 | connect(ui->filterLineEdit, &QLineEdit::textChanged, &m_model_proxy, static_cast<void (QSortFilterProxyModel::*)(const QString&)>( | |||
&QSortFilterProxyModel::setFilterRegExp)); | ||||
Alexandre Leroux
|
r1034 | |||
Alexandre Leroux
|
r82 | } | ||
Alexandre Leroux
|
r83 | |||
r232 | DataSourceWidget::~DataSourceWidget() noexcept | |||
{ | ||||
delete ui; | ||||
} | ||||