/* * This SLOT is called whenever user clicks a url inside output's textBrowser */ void MainWindow::outputTextBrowserAnchorClicked(const QUrl &link) { if (link.toString().contains("goto:")) { QString pkgName = link.toString().mid(5); QModelIndex columnIndex = m_packageModel->index(0, PackageModel::ctn_PACKAGE_NAME_COLUMN, QModelIndex()); QModelIndexList foundItems = m_packageModel->match(columnIndex, Qt::DisplayRole, pkgName, -1, Qt::MatchExactly); QModelIndex proxyIndex; if (foundItems.count() == 1) { proxyIndex = foundItems.first(); if(proxyIndex.isValid()) { ui->tvPackages->scrollTo(proxyIndex, QAbstractItemView::PositionAtCenter); ui->tvPackages->setCurrentIndex(proxyIndex); _changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION); } } if (foundItems.count() == 0 || !proxyIndex.isValid()) { refreshTabInfo(pkgName); disconnect(ui->twProperties, SIGNAL(currentChanged(int)), this, SLOT(changedTabIndex())); _ensureTabVisible(ctn_TABINDEX_INFORMATION); connect(ui->twProperties, SIGNAL(currentChanged(int)), this, SLOT(changedTabIndex())); }
/* * This SLOT is called whenever user clicks a url inside output's textBrowser */ void MainWindow::outputTextBrowserAnchorClicked(const QUrl &link) { if (link.toString().contains("goto:")) { QString pkgName = link.toString().mid(5); QStandardItemModel * sim = _getCurrentSelectedModel(); QList<QStandardItem*> foundItems = sim->findItems(pkgName, Qt::MatchExactly, ctn_PACKAGE_NAME_COLUMN); if (foundItems.count() > 0) { /*QStandardItem * si = foundItems.first(); QModelIndex indexIcon = sim->index(si->row(), ctn_PACKAGE_ICON_COLUMN); QModelIndex proxyIndex = m_proxyModelPackages->mapFromSource(indexIcon); ui->tvPackages->scrollTo(proxyIndex, QAbstractItemView::PositionAtCenter); ui->tvPackages->setCurrentIndex(proxyIndex); _changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION);*/ QStandardItem * si = foundItems.first(); QModelIndex indexIcon = sim->index(si->row(), ctn_PACKAGE_ICON_COLUMN); QModelIndex proxyIndex = m_proxyModelPackages->mapFromSource(indexIcon); if(proxyIndex.isValid()) { ui->tvPackages->scrollTo(proxyIndex, QAbstractItemView::PositionAtCenter); ui->tvPackages->setCurrentIndex(proxyIndex); _changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION); } else { refreshTabInfo(pkgName); disconnect(ui->twProperties, SIGNAL(currentChanged(int)), this, SLOT(changedTabIndex())); _ensureTabVisible(ctn_TABINDEX_INFORMATION); connect(ui->twProperties, SIGNAL(currentChanged(int)), this, SLOT(changedTabIndex())); } }