MCPcopy Create free account
hub / github.com/KDAB/GammaRay / ModelPickerDialog

Method ModelPickerDialog

ui/modelpickerdialog.cpp:32–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32ModelPickerDialog::ModelPickerDialog(QWidget *parent)
33 : QDialog(parent)
34 , m_view(new DeferredTreeView(this))
35 , m_buttons(new QDialogButtonBox(this))
36 , m_searchBox(new QLineEdit(this))
37 , m_showInvisibleItems(new QCheckBox(tr("Hide invisible items"), this))
38 , m_pendingSelection(qNullSelection())
39{
40 setAttribute(Qt::WA_DeleteOnClose);
41
42 m_view->setUniformRowHeights(true);
43 m_view->setExpandNewContent(true);
44 m_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
45 m_showInvisibleItems->setChecked(true);
46
47 auto *vl = new QVBoxLayout(this);
48 auto *hl = new QHBoxLayout;
49 hl->addWidget(m_searchBox);
50 hl->addWidget(m_showInvisibleItems);
51 vl->addLayout(hl);
52 vl->addWidget(m_view);
53 vl->addWidget(m_buttons);
54
55 selectionChanged();
56 resize(640, 480);
57
58 connect(m_view, &DeferredTreeView::newContentExpanded, this, &ModelPickerDialog::updatePendingSelection);
59 connect(m_view, &DeferredTreeView::activated, this, &ModelPickerDialog::accept);
60 connect(m_buttons, &QDialogButtonBox::accepted, this, &ModelPickerDialog::accept);
61 connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
62 connect(m_showInvisibleItems, &QAbstractButton::toggled, this, &ModelPickerDialog::checkBoxStateChanged);
63}
64
65QAbstractItemModel *ModelPickerDialog::model() const
66{

Callers

nothing calls this directly

Calls 2

qNullSelectionFunction · 0.85
setExpandNewContentMethod · 0.80

Tested by

no test coverage detected