28 #include <QMouseEvent>
29 #include <QStandardItem>
33 #define DEFAULT_FILTER_CONTENT "Click&type to filter"
35 #define FILTER_HEIGHT 22
38 hideChildren(hideChildren)
40 filterLineEdit =
new QLineEdit(
this);
43 filterExpansionTimer.setSingleShot(
true);
45 setStyleSheet(
"QTreeView{margin-top: " + QString::number(filterLineEdit->height()) +
"px}");
49 void FilterableTreeView::resizeEvent(QResizeEvent* event)
52 QTreeView::resizeEvent(event);
63 proxyModel->setSourceModel(model);
64 QTreeView::setModel(proxyModel);
66 connect(filterLineEdit, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString)));
67 connect(filterLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(
expandFilterSelection(QString)), Qt::QueuedConnection);
75 if (filterStr.length() == 0)
82 filterExpansionTimer.start(500);