void toResultViewCheck::paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align)
{
    toTreeWidgetCheck::paintCell(p, cg, column, width, align);
    toResultView *view = dynamic_cast<toResultView *>(listView());
    if (view && (itemBelow() == NULL || itemBelow()->itemBelow() == NULL))
        view->addItem();
}
void HierarchyItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
    QColorGroup g( cg );
    g.setColor( QColorGroup::Base, backgroundColor() );
    g.setColor( QColorGroup::Foreground, Qt::black );
    g.setColor( QColorGroup::Text, Qt::black );
    QString txt = text( 0 );
    if ( rtti() == Slot &&
   ( txt == "init()" || txt == "destroy()" ) ) {
  listView()->setUpdatesEnabled( false );
  if ( txt == "init()" )
      setText( 0, txt + " " + i18n( "(Constructor)" ) );
  else
      setText( 0, txt + " " + i18n( "(Destructor)" ) );
  QListViewItem::paintCell( p, g, column, width, align );
  setText( 0, txt );
  listView()->setUpdatesEnabled( true );
    } else {
  QListViewItem::paintCell( p, g, column, width, align );
    }
    p->save();
    p->setPen( QPen( cg.dark(), 1 ) );
    if ( column == 0 )
  p->drawLine( 0, 0, 0, height() - 1 );
    if ( listView()->firstChild() != this ) {
  if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) {
      int d = depth() - itemBelow()->depth();
      p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 );
  }
    }
    p->drawLine( 0, height() - 1, width, height() - 1 );
    p->drawLine( width - 1, 0, width - 1, height() );
    p->restore();
}
void toResultViewItem::paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align)
{
#if 0                           // disabled, not overriding correct function anyhow
    // null related background handling
    QColorGroup colNull(cg);
    if ((toConfigurationSingle::Instance().indicateEmpty() && text(column) == "{null}")
            || text(column).isNull())
    {
        QColor nullColor;
        nullColor.setNamedColor(toConfigurationSingle::Instance().indicateEmptyColor());
        colNull.setColor(QColorGroup::Base, nullColor);
    }

    toTreeWidgetItem::paintCell(p, colNull, column, width, align);
    toResultView *view = dynamic_cast<toResultView *>(listView());
    if (view && (itemBelow() == NULL || itemBelow()->itemBelow() == NULL))
        view->addItem();
    if (Gridlines)
    {
        p->setPen(Qt::gray);
        p->drawLine(width - 1, 0, width - 1, height());
        p->drawLine(0, height() - 1, width - 1, height() - 1);
    }
#endif
}
Exemple #4
0
void KACLListViewItem::paintCell( QPainter* p, const QColorGroup &cg,
                                  int column, int width, int alignment )
{
    if ( isDefault ) {
        setForeground( QColor( 0, 0, 255 ) );
    }
    if ( isPartial ) {
        QFont font = p->font();
        font.setItalic( true );
        setForeground( QColor( 100, 100, 100 ) );
        p->setFont( font );
    }
    QTreeWidgetItem::paintCell( p, mycg, column, width, alignment );

    KACLListViewItem *below =0;
    if ( itemBelow() )
        below = static_cast<KACLListViewItem*>( itemBelow() );
    const bool lastUser = type == KACLListView::NamedUser && below && below->type == KACLListView::NamedGroup;
    const bool lastNonDefault = !isDefault && below && below->isDefault;
    if ( type == KACLListView::Mask || lastUser || lastNonDefault )
    {
        p->setPen( QPen( Qt::gray, 0, Qt::DotLine ) );
        if ( type == KACLListView::Mask )
            p->drawLine( 0, 0, width - 1, 0 );
        p->drawLine( 0, height() - 1, width - 1, height() - 1 );
    }
}
Exemple #5
0
/**
 * Moves to the next item in the history, selecting it for display.
 * Note that this function move to the item which chronologically succedes
 * the current one, which, in list view terms, is the previous item.
 */
void HistoryView::selectNext()
{
	QTreeWidgetItem* pItem;

	// Get the current item
	pItem = currentItem();
	
	// Select the previous item in the list
	if (pItem != NULL && itemBelow(pItem) != NULL) {
		pItem = itemBelow(pItem);
		select(pItem);
	}
}
Exemple #6
0
void GpxTreeWidget::recompute() {
    if (root) {
        root->setText(0, tr("GpxFile"));
        root->setText(2, tr("%1").arg(meter2mile(_gpx->length()), 2,'f',2));
        root->setText(3, tr("%1").arg(_gpx->pointCount()));
        root->setText(4, tr("%1").arg(formatDuration(_gpx->duration(), true)));
        root->setText(5, tr("%1").arg(meterPerSecond2MilePerHour(_gpx->maxSpeed()), 2,'f',2));
        root->setText(6, tr("%1").arg(meterPerSecond2MilePerHour(_gpx->averageSpeed()), 2,'f',2));

        QTreeWidgetItem *track = root;

        for (int i=0; i<_gpx->segmentCount(); ++i) {
            track = itemBelow(track);
            if (track == 0) return;
            GpxTrackSegment cur = (*_gpx)[i];
            track->setText(0, tr("Track %1").arg(cur.number()));

            track->setText(1, tr("%1").arg(cur.name()));
            track->setText(2, tr("%1").arg(meter2mile(cur.length()), 2, 'f', 2));
            track->setText(3, tr("%1").arg(cur.pointCount()));
            track->setText(4, tr("%1").arg(formatDuration(cur.duration(), true)));
            track->setText(5, tr("%1").arg(meterPerSecond2MilePerHour(cur.maxSpeed()), 2,'f',2));
            track->setText(6, tr("%1").arg(meterPerSecond2MilePerHour(cur.averageSpeed()), 2,'f',2));
        }
    }

}
QModelIndex CWizCategoryBaseView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
{
    QModelIndex index = QTreeWidget::moveCursor(cursorAction, modifiers);
    if (!index.isValid())
        return index;

    CWizCategoryViewItemBase* pItem = categoryItemFromIndex(index);
    if (CWizCategoryViewSeparatorItem* pSeparatorItem = dynamic_cast<CWizCategoryViewSeparatorItem*>(pItem))
    {
        switch (cursorAction)
        {
        case MoveUp:
        case MoveLeft:
            {
                QTreeWidgetItem* pAbove = itemAbove(pSeparatorItem);
                Q_ASSERT(pAbove);
                return indexFromItem(pAbove);
            }
        case MoveDown:
        case MoveRight:
            {
                QTreeWidgetItem* pBelow = itemBelow(pSeparatorItem);
                Q_ASSERT(pBelow);
                return indexFromItem(pBelow);
            }
        default:
            Q_ASSERT(false);
            break;
        }
    }

    return index;
}
void TreeWidget::filterString(QString string)
{
    expandAll();
    QList<QTreeWidgetItem*> _allItems = allItems();

    if (string.isEmpty()) {
        foreach(QTreeWidgetItem * item, _allItems)
        item->setHidden(false);
        for (int i = 0; i < topLevelItemCount(); i++) {
            topLevelItem(i)->setHidden(false);
        }
        if (m_showMode == ItemsCollapsed) {
            collapseAll();
        }
    }
    else {
        foreach(QTreeWidgetItem * item, _allItems) {
            item->setHidden(!item->text(0).contains(string, Qt::CaseInsensitive));
            item->setExpanded(true);
        }
        for (int i = 0; i < topLevelItemCount(); i++) {
            topLevelItem(i)->setHidden(false);
        }

        QTreeWidgetItem* firstItem = topLevelItem(0);
        QTreeWidgetItem* belowItem = itemBelow(firstItem);

        int topLvlIndex = 0;
        while (firstItem) {
            if (firstItem->text(0).contains(string, Qt::CaseInsensitive)) {
                firstItem->setHidden(false);
            }
            else if (!firstItem->parent() && !belowItem) {
                firstItem->setHidden(true);
            }
            else if (!belowItem) {
                break;
            }
            else if (!firstItem->parent() && !belowItem->parent()) {
                firstItem->setHidden(true);
            }

            topLvlIndex++;
            firstItem = topLevelItem(topLvlIndex);
            belowItem = itemBelow(firstItem);
        }
    }
void qm_plistview::keyPressEvent(QKeyEvent *event)
{
    switch (event->key())
    {
        case Qt::Key_Return:
        {
            on_item_dclicked(currentItem());
            break;
        }

        case Qt::Key_Delete:
        {
            delete_it();
            break;
        }

        case Qt::Key_Space:
        {
            if (current_songPos != -1 && current_songPos < topLevelItemCount() )
                scrollToItem(topLevelItem(current_songPos));
            break;
        }

        case Qt::Key_Home:
        {
            if (topLevelItemCount() > 0)
                scrollToItem(topLevelItem(0));
            break;
        }

        case Qt::Key_End:
        {
            if (topLevelItemCount() > 0)
                scrollToItem(topLevelItem(topLevelItemCount() - 1));
            break;
        }

        case Qt::Key_Down:
        {
            if (currentItem()->get_pos < topLevelItemCount())
                setCurrentItem(itemBelow ( currentItem() ));
            break;
        }

        case Qt::Key_Up:
        {
            if (currentItem()->get_pos > 1)
                setCurrentItem(itemAbove ( currentItem() ));
            break;
        }

        default:
            QTreeWidget::keyPressEvent(event);
    }
}
Exemple #10
0
void dragTarget::scrollDown()
{
  disconnect(scrollDownTimer, SIGNAL(timeout()), this, SLOT(scrollDown()));
  puts("scrollDown chiamato");
  this -> scrollToItem(tempScroll);
  tempScroll = itemBelow(tempScroll);
  connect(scrollDownTimer, SIGNAL(timeout()), this, SLOT(scrollDown()));
  if(tempScroll == NULL)
  {
    disconnect(scrollDownTimer, SIGNAL(timeout()), this, SLOT(scrollDown()));
    scrollDownTimer -> stop();
  }
}
Exemple #11
0
/**
 * Deletes the item on which a popup-menu has been invoked.
 * This slot is connected to the remove() signal of the QueryResultsMenu
 * object.
 * @param	pItem	The item to remove
 */
void HistoryView::slotRemoveItem(QTreeWidgetItem* pItem)
{
	QTreeWidgetItem * pCurItem, * pNextItem;
    HistoryItem *p, *c;
	
	pCurItem = pItem;
	if ((pNextItem = itemBelow(pCurItem)) != NULL) {
        p = (HistoryItem *)pNextItem;
        c = (HistoryItem *)pCurItem;
		p->m_pPrevSibling = c->m_pPrevSibling;
    }
	
	delete pCurItem;
}
Exemple #12
0
void WorkspaceItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
    QColorGroup g( cg );
    g.setColor( QColorGroup::Base, backgroundColor() );
    g.setColor( QColorGroup::Foreground, Qt::black );

    if ( type() == FormSourceType &&
	 ( !formFile->hasFormCode() || ( formFile->codeFileState() == FormFile::Deleted && formFile->formWindow() ) ) &&
	 parent() && parent()->parent() && ( (WorkspaceItem*)parent()->parent() )->project &&
	 ( (WorkspaceItem*)parent()->parent() )->project->isCpp() ) {
	g.setColor( QColorGroup::Text, listView()->palette().disabled().color( QColorGroup::Text) );
	g.setColor( QColorGroup::HighlightedText, listView()->palette().disabled().color( QColorGroup::Text) );
    } else {
	g.setColor( QColorGroup::Text, Qt::black );
    }
    p->save();

    if ( isModified() ) {
	QFont f = p->font();
	f.setBold( TRUE );
	p->setFont( f );
    }

    QListViewItem::paintCell( p, g, column, width, align );
    p->setPen( QPen( cg.dark(), 1 ) );
    if ( column == 0 )
	p->drawLine( 0, 0, 0, height() - 1 );
    if ( listView()->firstChild() != this ) {
	if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) {
	    int d = depth() - itemBelow()->depth();
	    p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 );
	}
    }
    p->drawLine( 0, height() - 1, width, height() - 1 );
    p->drawLine( width - 1, 0, width - 1, height() );
    p->restore();
}
Exemple #13
0
void AssignedListView::slotMoveCurrentToolDown()
{
    AssignedListViewItem* const item = dynamic_cast<AssignedListViewItem*>(currentItem());

    if (item)
    {
        AssignedListViewItem* const ibelow = dynamic_cast<AssignedListViewItem*>(itemBelow(item));

        if (ibelow)
        {
            AssignedListViewItem* const nitem = moveTool(ibelow, item->toolSet());
            setCurrentItem(nitem);
        }
    }
}