forked from qt-creator/qt-creator
NickNameDialog: Use Utils::TreeView
Change-Id: I9db7b144288bf5d550544b406be8525fd8308f5d Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -179,6 +179,7 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
|
||||
m_filterModel->setSourceModel(model);
|
||||
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_ui->filterTreeView->setModel(m_filterModel);
|
||||
m_ui->filterTreeView->setActivationMode(Utils::DoubleClickActivation);
|
||||
const int columnCount = m_filterModel->columnCount();
|
||||
int treeWidth = 0;
|
||||
for (int c = 0; c < columnCount; c++) {
|
||||
@@ -186,8 +187,8 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
|
||||
treeWidth += m_ui->filterTreeView->columnWidth(c);
|
||||
}
|
||||
m_ui->filterTreeView->setMinimumWidth(treeWidth + 20);
|
||||
connect(m_ui->filterTreeView, SIGNAL(doubleClicked(QModelIndex)), this,
|
||||
SLOT(slotDoubleClicked(QModelIndex)));
|
||||
connect(m_ui->filterTreeView, SIGNAL(activated(QModelIndex)), this,
|
||||
SLOT(slotActivated(QModelIndex)));
|
||||
connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(slotCurrentItemChanged(QModelIndex)));
|
||||
connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)),
|
||||
@@ -209,7 +210,7 @@ void NickNameDialog::slotCurrentItemChanged(const QModelIndex &index)
|
||||
okButton()->setEnabled(index.isValid());
|
||||
}
|
||||
|
||||
void NickNameDialog::slotDoubleClicked(const QModelIndex &)
|
||||
void NickNameDialog::slotActivated(const QModelIndex &)
|
||||
{
|
||||
if (okButton()->isEnabled())
|
||||
okButton()->click();
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void slotCurrentItemChanged(const QModelIndex &);
|
||||
void slotDoubleClicked(const QModelIndex &);
|
||||
void slotActivated(const QModelIndex &);
|
||||
|
||||
private:
|
||||
QPushButton *okButton() const;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<widget class="Utils::FancyLineEdit" name="filterLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="filterTreeView"/>
|
||||
<widget class="Utils::TreeView" name="filterTreeView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
@@ -38,6 +38,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/fancylineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::TreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">utils/itemviews.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
Reference in New Issue
Block a user