##// END OF EJS Templates
Adds line edit as a search box above data source tree
Alexandre Leroux -
r475:72f279351624
parent child
Show More
@@ -32,6 +32,9 private:
32 Ui::DataSourceWidget *ui;
32 Ui::DataSourceWidget *ui;
33
33
34 private slots:
34 private slots:
35 /// Slot called when the filtering text has changed
36 void filterChanged(const QString &text) noexcept;
37
35 /// Slot called when right clicking on an item in the tree (displays a menu)
38 /// Slot called when right clicking on an item in the tree (displays a menu)
36 void onTreeMenuRequested(const QPoint &pos) noexcept;
39 void onTreeMenuRequested(const QPoint &pos) noexcept;
37 };
40 };
@@ -47,6 +47,9 DataSourceWidget::DataSourceWidget(QWidget *parent) : QWidget{parent}, ui{new Ui
47 // Connection to show a menu when right clicking on the tree
47 // Connection to show a menu when right clicking on the tree
48 connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this,
48 connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this,
49 &DataSourceWidget::onTreeMenuRequested);
49 &DataSourceWidget::onTreeMenuRequested);
50
51 // Connection to filter tree
52 connect(ui->filterLineEdit, &QLineEdit::textChanged, this, &DataSourceWidget::filterChanged);
50 }
53 }
51
54
52 DataSourceWidget::~DataSourceWidget() noexcept
55 DataSourceWidget::~DataSourceWidget() noexcept
@@ -63,6 +66,10 void DataSourceWidget::addDataSource(DataSourceItem *dataSource) noexcept
63 }
66 }
64 }
67 }
65
68
69 void DataSourceWidget::filterChanged(const QString &text) noexcept
70 {
71 }
72
66 void DataSourceWidget::onTreeMenuRequested(const QPoint &pos) noexcept
73 void DataSourceWidget::onTreeMenuRequested(const QPoint &pos) noexcept
67 {
74 {
68 // Retrieves the selected item in the tree, and build the menu from its actions
75 // Retrieves the selected item in the tree, and build the menu from its actions
@@ -14,19 +14,10
14 <string>Data sources</string>
14 <string>Data sources</string>
15 </property>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
16 <layout class="QGridLayout" name="gridLayout">
17 <property name="topMargin">
18 <number>0</number>
19 </property>
20 <property name="rightMargin">
21 <number>0</number>
22 </property>
23 <property name="bottomMargin">
24 <number>0</number>
25 </property>
26 <property name="spacing">
27 <number>0</number>
28 </property>
29 <item row="0" column="0">
17 <item row="0" column="0">
18 <widget class="QLineEdit" name="filterLineEdit"/>
19 </item>
20 <item row="1" column="0">
30 <widget class="QTreeWidget" name="treeWidget">
21 <widget class="QTreeWidget" name="treeWidget">
31 <column>
22 <column>
32 <property name="text">
23 <property name="text">
General Comments 0
You need to be logged in to leave comments. Login now