void ECOListWidget::selectionChangedSlot() { const QModelIndexList& selection = ui->tagList->selectionModel()->selectedIndexes(); if (selection.count()) { QString ts = selection[0].data().toString(); selectECO(ts); } else { selectECO(QString()); } }
ECOListWidget::ECOListWidget(QWidget *parent) : QWidget(parent), ui(new Ui::TagDetailWidget) { setObjectName("ECOListWidget"); ui->setupUi(this); m_filterModel = new QStringListModel(this); ui->tagList->setModel(m_filterModel); ui->renameItem->setVisible(false); setObjectName("ECOListWidget"); connect(ui->filterEdit, SIGNAL(textChanged(const QString&)), SLOT(findECO(const QString&))); connect(ui->filterDatabase, SIGNAL(clicked()), SLOT(filterSelectedECO())); connect(ui->tagList, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(filterSelectedECO())); selectECO(QString()); QItemSelectionModel* selectionModel = ui->tagList->selectionModel(); connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChangedSlot())); ui->detailText->setOpenLinks(true); ui->detailText->setOpenExternalLinks(false); connect(ui->detailText, SIGNAL(anchorClicked(QUrl)), SLOT(slotLinkClicked(QUrl))); slotReconfigure(); }
void ECOListWidget::showSelectedECO() { if (ui->tagList->currentIndex().isValid()) { QString ts = ui->tagList->currentIndex().data().toString(); selectECO(ts); } }
void ECOListWidget::slotSelectECO(const QString& eco) { m_filterModel->setStringList(m_list); ui->filterEdit->clear(); selectECO(eco); }