MCPcopy Create free account
hub / github.com/KDE/labplot / TreeViewComboBox

Method TreeViewComboBox

src/frontend/widgets/TreeViewComboBox.cpp:33–65  ·  view source on GitHub ↗

! \class TreeViewComboBox \brief Provides a QTreeView in a QComboBox. \ingroup backend/widgets */

Source from the content-addressed store, hash-verified

31 \ingroup backend/widgets
32*/
33TreeViewComboBox::TreeViewComboBox(QWidget* parent)
34 : QComboBox(parent)
35 , m_treeView(new QTreeView)
36 , m_groupBox(new QGroupBox)
37 , m_lineEdit(new QLineEdit) {
38 auto* layout = new QVBoxLayout(this);
39 layout->setContentsMargins(0, 0, 0, 0);
40 layout->setSpacing(0);
41
42 layout->addWidget(m_lineEdit);
43 layout->addWidget(m_treeView);
44
45 m_groupBox->setLayout(layout);
46 m_groupBox->setParent(parent, Qt::Popup);
47 m_groupBox->hide();
48 m_groupBox->installEventFilter(this);
49
50 m_treeView->header()->hide();
51 m_treeView->setSelectionMode(QAbstractItemView::SingleSelection);
52 m_treeView->setUniformRowHeights(true);
53
54 m_lineEdit->setPlaceholderText(i18n("Search/Filter text"));
55 m_lineEdit->setClearButtonEnabled(true);
56 m_lineEdit->setFocus();
57
58 addItem(QString());
59 setCurrentIndex(0);
60 setEditText(m_currentText);
61
62 // signal activated() is platform dependent
63 connect(m_treeView, &QTreeView::pressed, this, &TreeViewComboBox::treeViewIndexActivated);
64 connect(m_lineEdit, &QLineEdit::textChanged, this, &TreeViewComboBox::filterChanged);
65}
66
67void TreeViewComboBox::setTopLevelClasses(const QList<AspectType>& list) {
68 m_topLevelClasses = list;

Callers

nothing calls this directly

Calls 6

setSpacingMethod · 0.80
setLayoutMethod · 0.80
setPlaceholderTextMethod · 0.80
setClearButtonEnabledMethod · 0.80
QStringClass · 0.50
setFocusMethod · 0.45

Tested by

no test coverage detected