void ctkCmdLineModuleExplorerModulesSettings::pathsAdded(const QStringList &paths)
{
  // Check the validity of the entries
  foreach(const QString& path, paths)
  {
    ctkCmdLineModuleReference moduleRef = this->ModuleManager->moduleReference(QUrl::fromLocalFile(path));
    if (!moduleRef || !moduleRef.xmlValidationErrorString().isEmpty())
    {
      QStandardItem* item = ui->PathListWidget->item(path);
      if (this->WarningIcon.isNull())
      {
        this->WarningIcon = ctkCmdLineModuleExplorerUtils::createIconOverlay(
              item->icon().pixmap(item->icon().availableSizes().front()),
              QApplication::style()->standardPixmap(QStyle::SP_MessageBoxWarning));
      }

      QString toolTip = path + "\n\n" + tr("Warning") + ":\n\n";
      if (moduleRef)
      {
        item->setIcon(this->WarningIcon);
        toolTip += moduleRef.xmlValidationErrorString();
      }
      else if (this->ModulesRegistered)
      {
        item->setIcon(this->WarningIcon);
        toolTip += tr("No XML output available.");
      }
      else
      {
        toolTip = path;
      }
      item->setToolTip(toolTip);
    }
  }
void QgsMilXLibrary::itemClicked( const QModelIndex &index )
{

  QModelIndex sourceIndex = mFilterProxyModel->mapToSource( index );
  QList<QModelIndex> indexStack;
  indexStack.prepend( sourceIndex );
  while ( sourceIndex.parent().isValid() )
  {
    sourceIndex = sourceIndex.parent();
    indexStack.prepend( sourceIndex );
  }

  QStandardItem* item = mGalleryModel->itemFromIndex( indexStack.front() );
  if ( item )
  {
    for ( int i = 1, n = indexStack.size(); i < n; ++i )
    {
      item = item->child( indexStack[i].row() );
    }

    QgsMilxSymbolTemplate symbolTemplate;
    symbolTemplate.symbolXml = item->data( SymbolXmlRole ).toString();
    if ( symbolTemplate.symbolXml.isEmpty() )
    {
      return;
    }
    hide();
    if ( symbolTemplate.symbolXml == "<custom>" )
    {
      MilXClient::SymbolDesc desc;
      WId wid = mIface->mapCanvas()->winId();
      if ( !MilXClient::createSymbol( symbolTemplate.symbolXml, desc, wid ) )
      {
        return;
      }
      symbolTemplate.symbolMilitaryName = desc.militaryName;
      symbolTemplate.minNPoints = desc.minNumPoints;
      symbolTemplate.hasVariablePoints = desc.hasVariablePoints;
      symbolTemplate.pixmap = QPixmap::fromImage( desc.icon ).scaled( 32, 32, Qt::KeepAspectRatio );
    }
    else
    {
      symbolTemplate.symbolMilitaryName = item->data( SymbolMilitaryNameRole ).toString();
      symbolTemplate.minNPoints = item->data( SymbolPointCountRole ).toInt();
      symbolTemplate.hasVariablePoints = item->data( SymbolVariablePointsRole ).toInt();
      symbolTemplate.pixmap = item->icon().pixmap( item->icon().actualSize( QSize( 32, 32 ) ) );
    }
    emit symbolSelected( symbolTemplate );
  }
}
Esempio n. 3
0
void KDEProjectsReaderTest::testsProperParse()
{
    KDEProjectsModel m;
    KDEProjectsReader reader(&m, 0);

    if(reader.hasErrors())
        qDebug() << "errors:" << reader.errors();

    QVERIFY(!reader.hasErrors());

    WAIT_FOR_SIGNAL(&reader,downloadDone());

    for(int i=0; i<m.rowCount(); i++) {
        QStandardItem* item = m.item(i,0);
        qDebug() << ":::::" << item->text() << item->icon() << item->data(KDEProjectsModel::VcsLocationRole);

        QVERIFY(item);
        QVERIFY(!item->text().isEmpty());

        QVariant urls = item->data(KDEProjectsModel::VcsLocationRole);
        QVERIFY(urls.isValid());
        QVERIFY(urls.canConvert(QVariant::Map));
        QVariantMap mapurls=urls.toMap();
        for(QVariantMap::const_iterator it=mapurls.constBegin(), itEnd=mapurls.constEnd(); it!=itEnd; ++it) {
            QVERIFY(!it.key().isEmpty());
            QVERIFY(!it.value().toString().isEmpty());
        }

        QVERIFY(!item->data(KDEProjectsModel::VcsLocationRole).toMap().isEmpty());
    }
}
void ReportGenerationDialog::on_screenshotListView_doubleClicked(const QModelIndex &index)
{
    QStandardItem *item = screenshotModel.item(ui->screenshotListView->currentIndex().row());
    selectedScreenshotModel.appendRow(new QStandardItem(item->icon(), item->text()));
    processScreenshotAnalysis(item->text());
    screenshotModel.removeRow(ui->screenshotListView->currentIndex().row());
}
Esempio n. 5
0
void SearchDialog::toggleItems(bool enabled)
{
	QCheckBox *checkBox = qobject_cast<QCheckBox*>(sender());
	for (QListView *list : this->findChildren<QListView*>()) {
		QStandardItemModel *m = qobject_cast<QStandardItemModel*>(list->model());
		// Hiding / restoring items has to be done in 2-steps
		// First step is for finding items that are about to be moved
		// Second step is for iterating backward on marked items -> you cannot remove items on a single for loop
		if (enabled) {
			// Restore hidden items for every list
			QList<QStandardItem*> items = _hiddenItems.value(list);
			QList<int> indexes;
			for (int i = 0; i < items.size(); i++) {
				QStandardItem *item = items.at(i);
				// Extract only matching items
				if (item->data(AbstractSearchDialog::DT_Origin) == checkBox->text()) {
					indexes.prepend(i);
				}
			}

			// Moving back from hidden to visible
			for (int i = 0; i < indexes.size(); i++) {
				QStandardItem *item = items.takeAt(indexes.at(i));
				m->appendRow(item);
			}

			// Replace existing values with potentially empty list
			_hiddenItems.insert(list, items);
			m->sort(0);
		} else {
			// Hide items for every list
			QStandardItemModel *m = qobject_cast<QStandardItemModel*>(list->model());
			QList<QStandardItem*> items;
			QList<QPersistentModelIndex> indexes;
			for (int i = 0; i < m->rowCount(); i++) {
				QStandardItem *item = m->item(i, 0);
				if (item->data(AbstractSearchDialog::DT_Origin).toString() == checkBox->text()) {
					indexes << m->index(i, 0);
					// Default copy-constructor is protected!
					QStandardItem *copy = new QStandardItem(item->text());
					copy->setData(checkBox->text(), AbstractSearchDialog::DT_Origin);
					copy->setIcon(item->icon());
					items.append(copy);
				}
			}

			for (const QPersistentModelIndex &i : indexes) {
				m->removeRow(i.row());
			}

			// Finally, hide selected items
			if (!items.isEmpty()) {
				QList<QStandardItem*> hItems = _hiddenItems.value(list);
				hItems.append(items);
				_hiddenItems.insert(list, hItems);
			}
		}
	}
}
void ReportGenerationDialog::on_selectedScreenshotListView_doubleClicked(const QModelIndex &index)
{
    int row = ui->selectedScreenshotListView->currentIndex().row();
    QStandardItem *item = selectedScreenshotModel.item(row);
    screenshotModel.appendRow(new QStandardItem(item->icon(), item->text()));
    selectedScreenshotModel.removeRow(row);
    selectedValuesModel.removeRow(row);
}
Esempio n. 7
0
QVariant MimetypeModel::data(const QModelIndex &index, int role) const
{
    if (role != Qt::DecorationRole || !index.isValid() || index.data(iconQueriedRole).toBool())
        return QStandardItemModel::data(index, role);
    QStandardItem *item = itemFromIndex(index);
    const QString iconName = item->data(mimeTypeRole).value<QMimeType>().iconName();
    if (!iconName.isEmpty())
        item->setIcon(QIcon::fromTheme(iconName));
    item->setData(QVariant(true), iconQueriedRole);
    return item->icon();
}
Esempio n. 8
0
void ObxTreeViewItem::paintEvent(QPaintEvent *)
{
    if (view_.header().model() == 0 || data() == 0)
    {
        return;
    }

    QPainter p(this);
    for(int i = 0; i < view_.header().model()->columnCount(); ++i)
    {
        QRect rc(view_.header().columnRect(i));
        rc.setTop(MARGIN);
        rc.setHeight(height() - 2 * MARGIN);
        QStandardItem * item = view_.item(data(), i);
        if (item != 0)
        {
            rc.adjust(ITEM_HEIGHT + MARGIN, MARGIN, -MARGIN * 4, -MARGIN);

            if (i == 0)
            {
                rc.setLeft(rc.left() + obx::indent(item));
            }

            p.setOpacity(item->isSelectable() ? 1.0 : 0.5);

            QIcon icon = item->icon();
            p.drawPixmap(8, 8, icon.pixmap(84, 84));

            QString title = item->text();
            p.setFont(item->font());
            chopStringByRect(p, rc, item->textAlignment()|Qt::AlignTop, title);
            p.drawText(rc, item->textAlignment()|Qt::AlignTop, title);

            QFont smallFont;
            smallFont.setPointSize(16);
            title = item->toolTip();
            p.setFont(smallFont);
            chopStringByRect(p, rc, Qt::AlignRight|Qt::AlignBottom, title);
            p.drawText(rc, Qt::AlignRight|Qt::AlignBottom, title);
        }
    }

    if (isSelected())
    {
        p.setOpacity(1);
        QPen pen(Qt::SolidLine);
        pen.setColor(Qt::black);
        p.setPen(pen);
        p.drawRoundedRect(rect().adjusted(0, 0, -1, -1), 8, 8);
    }
}
Esempio n. 9
0
void tst_QStandardItem::getSetData()
{
    QStandardItem item;
    for (int x = 0; x < 2; ++x) {
        for (int i = 1; i <= 2; ++i) {
            QString text = QString("text %0").arg(i);
            item.setText(text);
            QCOMPARE(item.text(), text);
            
            QPixmap pixmap(32, 32);
            pixmap.fill((i == 1) ? Qt::red : Qt::green);
            QIcon icon(pixmap);
            item.setIcon(icon);
            QCOMPARE(item.icon(), icon);
            
            QString toolTip = QString("toolTip %0").arg(i);
            item.setToolTip(toolTip);
            QCOMPARE(item.toolTip(), toolTip);
            
            QString statusTip = QString("statusTip %0").arg(i);
            item.setStatusTip(statusTip);
            QCOMPARE(item.statusTip(), statusTip);
        
            QString whatsThis = QString("whatsThis %0").arg(i);
            item.setWhatsThis(whatsThis);
            QCOMPARE(item.whatsThis(), whatsThis);
            
            QSize sizeHint(64*i, 48*i);
            item.setSizeHint(sizeHint);
            QCOMPARE(item.sizeHint(), sizeHint);
            
            QFont font;
            item.setFont(font);
            QCOMPARE(item.font(), font);
        
            Qt::Alignment textAlignment((i == 1)
                                        ? Qt::AlignLeft|Qt::AlignVCenter
                                        : Qt::AlignRight);
            item.setTextAlignment(textAlignment);
            QCOMPARE(item.textAlignment(), textAlignment);
            
            QColor backgroundColor((i == 1) ? Qt::blue : Qt::yellow);
            item.setBackground(backgroundColor);
            QCOMPARE(item.background().color(), backgroundColor);
            
            QColor textColor((i == i) ? Qt::green : Qt::cyan);
            item.setForeground(textColor);
            QCOMPARE(item.foreground().color(), textColor);
            
            Qt::CheckState checkState((i == 1) ? Qt::PartiallyChecked : Qt::Checked);
            item.setCheckState(checkState);
            QCOMPARE(item.checkState(), checkState);
            
            QString accessibleText = QString("accessibleText %0").arg(i);
            item.setAccessibleText(accessibleText);
            QCOMPARE(item.accessibleText(), accessibleText);
            
            QString accessibleDescription = QString("accessibleDescription %0").arg(i);
            item.setAccessibleDescription(accessibleDescription);
            QCOMPARE(item.accessibleDescription(), accessibleDescription);
            
            QCOMPARE(item.text(), text);
            QCOMPARE(item.icon(), icon);
            QCOMPARE(item.toolTip(), toolTip);
            QCOMPARE(item.statusTip(), statusTip);
            QCOMPARE(item.whatsThis(), whatsThis);
            QCOMPARE(item.sizeHint(), sizeHint);
            QCOMPARE(item.font(), font);
            QCOMPARE(item.textAlignment(), textAlignment);
            QCOMPARE(item.background().color(), backgroundColor);
            QCOMPARE(item.foreground().color(), textColor);
            QCOMPARE(item.checkState(), checkState);
            QCOMPARE(item.accessibleText(), accessibleText);
            QCOMPARE(item.accessibleDescription(), accessibleDescription);
            
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::DisplayRole)), text);
            QCOMPARE(qvariant_cast<QIcon>(item.data(Qt::DecorationRole)), icon);
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::ToolTipRole)), toolTip);
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::StatusTipRole)), statusTip);
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::WhatsThisRole)), whatsThis);
            QCOMPARE(qvariant_cast<QSize>(item.data(Qt::SizeHintRole)), sizeHint);
            QCOMPARE(qvariant_cast<QFont>(item.data(Qt::FontRole)), font);
            QCOMPARE(qvariant_cast<int>(item.data(Qt::TextAlignmentRole)), int(textAlignment));
            QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundColorRole)), QBrush(backgroundColor));
            QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)), QBrush(backgroundColor));
            QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::TextColorRole)), QBrush(textColor));
            QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::ForegroundRole)), QBrush(textColor));
            QCOMPARE(qvariant_cast<int>(item.data(Qt::CheckStateRole)), int(checkState));
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleTextRole)), accessibleText);
            QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleDescriptionRole)), accessibleDescription);

            item.setBackground(pixmap);
            QCOMPARE(item.background().texture(), pixmap);
            QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)).texture(), pixmap);
        }
        item.setData(QVariant(), Qt::DisplayRole);
        item.setData(QVariant(), Qt::DecorationRole);
        item.setData(QVariant(), Qt::ToolTipRole);
        item.setData(QVariant(), Qt::StatusTipRole);
        item.setData(QVariant(), Qt::WhatsThisRole);
        item.setData(QVariant(), Qt::SizeHintRole);
        item.setData(QVariant(), Qt::FontRole);
        item.setData(QVariant(), Qt::TextAlignmentRole);
        item.setData(QVariant(), Qt::BackgroundRole);
        item.setData(QVariant(), Qt::ForegroundRole);
        item.setData(QVariant(), Qt::CheckStateRole);
        item.setData(QVariant(), Qt::AccessibleTextRole);
        item.setData(QVariant(), Qt::AccessibleDescriptionRole);
        
        QCOMPARE(item.data(Qt::DisplayRole), QVariant());
        QCOMPARE(item.data(Qt::DecorationRole), QVariant());
        QCOMPARE(item.data(Qt::ToolTipRole), QVariant());
        QCOMPARE(item.data(Qt::StatusTipRole), QVariant());
        QCOMPARE(item.data(Qt::WhatsThisRole), QVariant());
        QCOMPARE(item.data(Qt::SizeHintRole), QVariant());
        QCOMPARE(item.data(Qt::FontRole), QVariant());
        QCOMPARE(item.data(Qt::TextAlignmentRole), QVariant());
        QCOMPARE(item.data(Qt::BackgroundColorRole), QVariant());
        QCOMPARE(item.data(Qt::BackgroundRole), QVariant());
        QCOMPARE(item.data(Qt::TextColorRole), QVariant());
        QCOMPARE(item.data(Qt::ForegroundRole), QVariant());
        QCOMPARE(item.data(Qt::CheckStateRole), QVariant());
        QCOMPARE(item.data(Qt::AccessibleTextRole), QVariant());
        QCOMPARE(item.data(Qt::AccessibleDescriptionRole), QVariant());
    }
}
void QgsComposerLegend::drawLayerChildItems( QPainter* p, QStandardItem* layerItem, double& currentYCoord, double& maxXCoord, int layerOpacity )
{
  if ( !layerItem )
  {
    return;
  }

  //Draw all symbols first and the texts after (to find out the x coordinate to have the text aligned)
  QList<double> childYCoords;
  QList<double> realItemHeights;

  double textHeight = fontHeightCharacterMM( mItemFont, QChar( '0' ) );
  double itemHeight = qMax( mSymbolHeight, textHeight );

  double textAlignCoord = 0; //alignment for legend text

  QStandardItem* currentItem;

  int numChildren = layerItem->rowCount();

  for ( int i = 0; i < numChildren; ++i )
  {
    //real symbol height. Can be different from standard height in case of point symbols
    double realSymbolHeight;
    double realItemHeight = itemHeight; //will be adjusted if realSymbolHeight turns out to be larger

    currentYCoord += mSymbolSpace;
    double currentXCoord = mBoxSpace;

    currentItem = layerItem->child( i, 0 );

    if ( !currentItem )
    {
      continue;
    }

    QgsSymbol* symbol = 0;
    QgsComposerSymbolItem* symbolItem = dynamic_cast<QgsComposerSymbolItem*>( currentItem );
    if ( symbolItem )
    {
      symbol = symbolItem->symbol();
    }

    QgsSymbolV2* symbolNg = 0;
    QgsComposerSymbolV2Item* symbolV2Item = dynamic_cast<QgsComposerSymbolV2Item*>( currentItem );
    if ( symbolV2Item )
    {
      symbolNg = symbolV2Item->symbolV2();
    }
    QgsComposerRasterSymbolItem* rasterItem = dynamic_cast<QgsComposerRasterSymbolItem*>( currentItem );

    if ( symbol )  //item with symbol?
    {
      //draw symbol
      drawSymbol( p, symbol, currentYCoord + ( itemHeight - mSymbolHeight ) / 2, currentXCoord, realSymbolHeight, layerOpacity );
      realItemHeight = qMax( realSymbolHeight, itemHeight );
      currentXCoord += mIconLabelSpace;
    }
    else if ( symbolNg ) //item with symbol NG?
    {
      drawSymbolV2( p, symbolNg, currentYCoord + ( itemHeight - mSymbolHeight ) / 2, currentXCoord, realSymbolHeight, layerOpacity );
      realItemHeight = qMax( realSymbolHeight, itemHeight );
      currentXCoord += mIconLabelSpace;
    }
    else if ( rasterItem )
    {
      if ( p )
      {
        p->setBrush( rasterItem->color() );
        p->drawRect( QRectF( currentXCoord, currentYCoord + ( itemHeight - mSymbolHeight ) / 2, mSymbolWidth, mSymbolHeight ) );
      }
      currentXCoord += mSymbolWidth;
      currentXCoord += mIconLabelSpace;
    }
    else //item with icon?
    {
      QIcon symbolIcon = currentItem->icon();
      if ( !symbolIcon.isNull() && p )
      {
        symbolIcon.paint( p, currentXCoord, currentYCoord + ( itemHeight - mSymbolHeight ) / 2, mSymbolWidth, mSymbolHeight );
        currentXCoord += mSymbolWidth;
        currentXCoord += mIconLabelSpace;
      }
    }

    childYCoords.push_back( currentYCoord );
    realItemHeights.push_back( realItemHeight );
    currentYCoord += realItemHeight;
    textAlignCoord = qMax( currentXCoord, textAlignCoord );
  }

  maxXCoord = qMax( maxXCoord, textAlignCoord );
  for ( int i = 0; i < numChildren; ++i )
  {
    if ( p )
    {
      p->setPen( QColor( 0, 0, 0 ) );
      drawText( p, textAlignCoord, childYCoords.at( i ) + textHeight + ( realItemHeights.at( i ) - textHeight ) / 2, layerItem->child( i, 0 )->text(), mItemFont );
      maxXCoord = qMax( maxXCoord, textAlignCoord + mBoxSpace + textWidthMillimeters( mItemFont,  layerItem->child( i, 0 )->text() ) );
    }
  }
}
/*
 * Called every time user positions mouse over package's treeview items
 */
bool TreeViewPackagesItemDelegate::helpEvent ( QHelpEvent *event, QAbstractItemView*,
    const QStyleOptionViewItem&, const QModelIndex &index )
{
  if (this->parent()->objectName() == "tvPackages")
  {
    QTreeView* tvPackages = qobject_cast<QTreeView*>(this->parent());
    QSortFilterProxyModel *sfp = qobject_cast<QSortFilterProxyModel*>(tvPackages->model());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(sfp->sourceModel());

    if (sim->rowCount() == 0) return false;

    QModelIndex ind = sfp->mapToSource(index);
    QStandardItem *si = sim->itemFromIndex(ind);

    if (si)
    {
      //If the user's mouse is not positioned above the name column, let's give him a little help...
      if (si->column() != ctn_PACKAGE_NAME_COLUMN)
      {
        QModelIndex miName = sim->index(si->row(), ctn_PACKAGE_NAME_COLUMN);
        si = sim->itemFromIndex(miName);
      }

      QPoint p;
      gPoint = tvPackages->mapToGlobal(event->pos());
      QFuture<QString> f;
      disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      f = QtConcurrent::run(showPackageInfo, si->text());
      g_fwToolTip.setFuture(f);
      connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
    }
    else return false;
  }
  else if (this->parent()->objectName() == "tvTransaction")
  {
    QTreeView* tvTransaction = qobject_cast<QTreeView*>(this->parent());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(tvTransaction->model());

    if (sim->rowCount() == 0) return false;

    QStandardItem *si = sim->itemFromIndex(index);

    if (si)
    {
      //If it's really a package in the Transaction treeview...
      QString pkgName=si->text();

      //We have to separate Repository from Package Name, first
      int slash = pkgName.indexOf("/");
      if (slash != -1)
      {
        pkgName = pkgName.mid(slash+1);
      }

      if (si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconInstallItem().pixmap(22, 22).toImage() ||
          si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconRemoveItem().pixmap(22, 22).toImage())
      {
        QStandardItemModel *modelPackages = MainWindow::returnMainWindow()->getModelPackages();
        QList<QStandardItem*> foundItems =
            modelPackages->findItems(pkgName, Qt::MatchExactly, ctn_PACKAGE_NAME_COLUMN);

        if (foundItems.count() > 0)
        {
          QStandardItem *siFound = foundItems.at(0);

          QPoint p;
          gPoint = tvTransaction->mapToGlobal(event->pos());
          QFuture<QString> f;
          disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
          f = QtConcurrent::run(showPackageInfo, siFound->text());
          g_fwToolTip.setFuture(f);
          connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
        }
      }
      else
      {
        QToolTip::hideText();
      }
    }
  }

  return true;
}
/*
 * Called every time user positions mouse over package's treeview items
 */
bool TreeViewPackagesItemDelegate::helpEvent ( QHelpEvent *event, QAbstractItemView*,
    const QStyleOptionViewItem&, const QModelIndex &index )
{
  if (this->parent()->objectName() == "tvPackages")
  {
    QTreeView* tvPackages = qobject_cast<QTreeView*>(this->parent());
    PackageModel* sim = qobject_cast<PackageModel*>(tvPackages->model());
    if (sim == NULL || sim->getPackageCount() == 0) return false;

    const PackageRepository::PackageData*const si = sim->getData(index);

    if (si != NULL)
    {
      QPoint p;
      gPoint = tvPackages->mapToGlobal(event->pos());
      QFuture<QString> f;
      disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      f = QtConcurrent::run(showPackageInfo, si->name);
      g_fwToolTip.setFuture(f);
      connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
    }
    else return false;
  }
  else if (this->parent()->objectName() == "tvTransaction")
  {
    QTreeView* tvTransaction = qobject_cast<QTreeView*>(this->parent());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(tvTransaction->model());

    if (sim->rowCount() == 0) return false;

    QStandardItem *si = sim->itemFromIndex(index);

    if (si)
    {
      //If it's really a package in the Transaction treeview...
      QString pkgName=si->text();

      //We have to separate Repository from Package Name, first
      int slash = pkgName.indexOf("/");
      if (slash != -1)
      {
        pkgName = pkgName.mid(slash+1);
      }

      if (si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconInstallItem().pixmap(22, 22).toImage() ||
          si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconRemoveItem().pixmap(22, 22).toImage())
      {
        gPoint = tvTransaction->mapToGlobal(event->pos());
        QFuture<QString> f;
        disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
        f = QtConcurrent::run(showPackageInfo, pkgName);
        g_fwToolTip.setFuture(f);
        connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      }
      else
      {
        QToolTip::hideText();
      }
    }
  }

  return true;
}