QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); int S = QFontMetricsF(option.font).height() ; return QSize(w,S); }
QSize BWListDelegate::sizeHint(const QStyleOptionViewItem & option/*option*/, const QModelIndex & index) const { float FS = QFontMetricsF(option.font).height(); float fact = FS/14.0 ; float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString()); return QSize(w,FS*1.2); //return QSize(50*fact,17*fact); }
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- // ---- paint // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- void Shape::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ) { QPen textPen( getTextColor() ); painter->setPen( textPen ); painter->drawText ( option->rect.x() + option->rect.width ()/2 - QFontMetricsF(painter->font()).width ( getText() )/2, option->rect.y() + option->rect.height()/2 + QFontMetricsF(painter->font()).height( )/3, getText() ); }
TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent) : RsAutoUpdatePage(2000,parent) { setupUi(this) ; m_bProcessSettings = false; _tunnel_statistics_F->setWidget( _tst_CW = new TurtleRouterStatisticsWidget() ) ; _tunnel_statistics_F->setWidgetResizable(true); _tunnel_statistics_F->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _tunnel_statistics_F->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); _tunnel_statistics_F->viewport()->setBackgroundRole(QPalette::NoRole); _tunnel_statistics_F->setFrameStyle(QFrame::NoFrame); _tunnel_statistics_F->setFocusPolicy(Qt::NoFocus); routertabWidget->addTab(new TurtleRouterDialog(),QString(tr("Tunnel Requests"))); float fontHeight = QFontMetricsF(font()).height(); float fact = fontHeight/14.0; frmGraph->setMinimumHeight(200*fact); // load settings processSettings(true); }
void TBox::layout() { setPos(QPointF()); // !? bbox().setRect(0.0, 0.0, system()->width(), 0); _text->layout(); qreal h = _text->height(); if (_text->empty()) { QFontMetricsF fm = QFontMetricsF(_text->font(), MScore::paintDevice()); h = fm.ascent(); } else h = _text->height(); qreal y = topMargin() * DPMM; #if 0 if (_text->align() & Align::BOTTOM) y += h; else if (_text->align() & Align::VCENTER) y += h * .5; else ; // y = 0; #endif _text->setPos(leftMargin() * DPMM, y); h += topMargin() * DPMM + bottomMargin() * DPMM; bbox().setRect(0.0, 0.0, system()->width(), h); MeasureBase::layout(); // layout LayoutBreak's }
bool RSPermissionMatrixWidget::computeServiceAndPeer(int x,int y,uint32_t& service_id,RsPeerId& peer_id) const { // 1 - make sure that x and y are on a widget float S = QFontMetricsF(font()).height(); x -= matrix_start_x ; y -= S*fMATRIX_START_Y ; if(x < 0 || x >= service_ids.size() * S*fCOL_SIZE) return false ; if(y < 0 || y >= peer_ids.size() * S*fROW_SIZE) return false ; if( (x % (int)(S*fCOL_SIZE)) < (S*fCOL_SIZE - S*fICON_SIZE_X)/2) return false ; if( (x % (int)(S*fCOL_SIZE)) > (S*fCOL_SIZE + S*fICON_SIZE_X)/2) return false ; if( (y % (int)(S*fROW_SIZE)) < (S*fROW_SIZE - S*fICON_SIZE_Y)/2) return false ; if( (y % (int)(S*fROW_SIZE)) > (S*fROW_SIZE + S*fICON_SIZE_Y)/2) return false ; // 2 - find which widget, by looking into the service perm matrix service_id = service_ids[x / (int)(S*fCOL_SIZE)] ; peer_id = peer_ids[y / (int)(S*fCOL_SIZE)] ; return true ; }
QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const { if (column == idColumn()) { if (role == Qt::ToolTipRole) { QString t = RSTreeWidgetItem::data(column, role).toString(); QImage pix; if(mId.isNull()) return RSTreeWidgetItem::data(column, role); else if(rsReputations->isIdentityBanned(mId)) pix = QImage(BANNED_IMAGE) ; else if (mAvatar.mSize == 0 || !pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG")) pix = GxsIdDetails::makeDefaultIcon(mId); int S = QFontMetricsF(font(column)).height(); QString embeddedImage; if (RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) { t = "<table><tr><td>" + embeddedImage + "</td><td>" + t + "</td></table>"; } return t; } } return RSTreeWidgetItem::data(column, role); }
void tst_QStaticText::drawUnderlinedText() { QPixmap imageDrawText(1000, 1000); QPixmap imageDrawStaticText(1000, 1000); imageDrawText.fill(Qt::white); imageDrawStaticText.fill(Qt::white); QString s = QString::fromLatin1("Foobar"); QFont font; font.setUnderline(true); { QPainter p(&imageDrawText); p.setFont(font); p.drawText(QPointF(50, 50), s); } { QPainter p(&imageDrawStaticText); QStaticText text = QStaticText(s); p.setFont(font); p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text); } #if defined(DEBUG_SAVE_IMAGE) imageDrawText.save("drawUnderlinedText_imageDrawText.png"); imageDrawStaticText.save("drawUnderlinedText_imageDrawStaticText.png"); #endif QCOMPARE(imageDrawText, imageDrawStaticText); }
void tst_QStaticText::projectedPainter() { QTransform transform; transform.rotate(90, Qt::XAxis); QPixmap imageDrawText(1000, 1000); imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.setTransform(transform); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } QPixmap imageDrawStaticText(1000, 1000); imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.setTransform(transform); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setTextFormat(Qt::PlainText); p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } QCOMPARE(imageDrawStaticText, imageDrawText); }
void tst_QStaticText::scaledPainter() { QPixmap imageDrawText(1000, 1000); imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.scale(2.0, 0.2); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } QPixmap imageDrawStaticText(1000, 1000); imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.scale(2.0, 0.2); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setTextFormat(Qt::PlainText); p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); }
void RSGraphWidget::paintLegend() { //int bottom = _rec.height(); std::vector<QPointF> vals ; _source->getCurrentValues(vals) ; int j=0; float FS = QFontMetricsF(font()).height(); float fact = FS/14.0 ; for(uint i=0;i<vals.size();++i) if( _masked_entries.find(_source->displayName(i).toStdString()) == _masked_entries.end() ) { if( _rec.width() - (vals[i].x()-0)*_time_scale < SCALE_WIDTH*fact ) continue ; qreal paintStep = 4*fact+FS; qreal pos = 15*fact+j*paintStep; QString text = _source->legend(i,vals[i].y()) ; QPen oldPen = _painter->pen(); _painter->setPen(QPen(getColor(i), Qt::SolidLine)); _painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos+FS/3), QPointF(SCALE_WIDTH*fact+30.0*fact, pos+FS/3)); _painter->setPen(oldPen); _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(SCALE_WIDTH *fact+ 40*fact,pos + 0.5*FS), text) ; ++j ; } }
/** Paints the scale on the graph. */ void RSGraphWidget::paintScale1() { float FS = QFontMetricsF(font()).height(); float fact = FS/14.0 ; int top = _rec.y(); int bottom = _rec.height(); qreal paintStep = (bottom - (bottom/10)) / 4; /* Draw the other marks in their correctly scaled locations */ qreal scale; qreal pos; if(_source == NULL) return ; QString unit_name = _source->unitName() ; for (int i = 1; i < 5; i++) { pos = bottom - (i * paintStep); scale = pixelsToValue(i * paintStep); QString text = _source->displayValue(scale) ; _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(5*fact, pos+0.5*FS), text); _painter->setPen(GRID_COLOR); _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); } /* Draw vertical separator */ _painter->drawLine(SCALE_WIDTH*fact, top, SCALE_WIDTH*fact, bottom); }
//-------------------------------------------------------------------------------------------------- // FUNCTION: paint //-------------------------------------------------------------------------------------------------- void QProgressBarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { double progress = index.data(QExecutableModel::ProgressRole).toDouble() * 100; if (std::isnan(progress) || progress <= 0.0 || progress >= 100.0) { QStyledItemDelegate::paint(painter, option, index); } else { const QFontMetrics &fm = option.fontMetrics; auto height = qMin(qCeil(QFontMetricsF(fm).height()) + 2, option.rect.height()); int adjust = (option.rect.height() - height) / 2; double progress = index.data(QExecutableModel::ProgressRole).toDouble() * 100; QStyleOptionProgressBar progressBarOption; progressBarOption.rect = option.rect.adjusted(2, adjust, -2, -adjust); progressBarOption.rect.setWidth(option.rect.width() - 2 * 2); progressBarOption.minimum = 0; progressBarOption.maximum = 100; progressBarOption.progress = progress; if (option.state & QStyle::State_Selected) { painter->setBrush(option.palette.highlightedText()); } QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); } }
RectKey::RectKey(KeyCode keycode, const QRect &textGeometry, const QRect &keyGeometry, const QSize &labelSize, int topLeft, int topRight, int bottomLeft, int bottomRight, const QColor &keyColor, const QColor &textColor, const QColor &secondColor, const QColor &alphaColor, const QString &labelText, const QString &secondText, const QString &alphaText, const QFont &labelFont, const QFont &secondFont, const QFont &alphaFont, Qt::Alignment labelAlign, Qt::Alignment secondAlign, Qt::Alignment alphaAlign) : Key{keycode, textGeometry, keyGeometry, keyColor}, mTextColor{textColor}, mSecondColor{secondColor}, mAlphaColor{alphaColor}, mLabelAlign{labelAlign}, mSecondAlign{secondAlign}, mAlphaAlign{alphaAlign}, mLabelFont{labelFont}, mSecondFont{secondFont.resolve(labelFont)}, mAlphaFont{alphaFont.resolve(labelFont)}, mSecondText{secondText}, mAlphaText{alphaText} { QRect corner; mLabelText = labelText; mKeyShape.moveTo(keyGeometry.topLeft() + QPointF{0, topLeft * .5}); corner.setSize({bottomLeft, bottomLeft}); corner.moveBottomLeft(keyGeometry.bottomLeft()); mKeyShape.arcTo(corner, 90 * 2, 90); corner.setSize({bottomRight, bottomRight}); corner.moveBottomRight(keyGeometry.bottomRight()); mKeyShape.arcTo(corner, 90 * 3, 90); corner.setSize({topRight, topRight}); corner.moveTopRight(keyGeometry.topRight()); mKeyShape.arcTo(corner, 90 * 0, 90); corner.setSize({topLeft, topLeft}); corner.moveTopLeft(keyGeometry.topLeft()); mKeyShape.arcTo(corner, 90 * 1, 90); mLabelFont.setPixelSize(labelSize.height()); mLabelFont.setStretch(labelSize.width() * mLabelFont.stretch() / QFontMetricsF(mLabelFont).size(Qt::TextSingleLine, mLabelText).width()); }
void QQuickFontMetrics::setFont(const QFont &font) { if (m_font != font) { m_font = font; m_metrics = QFontMetricsF(m_font); emit fontChanged(m_font); } }
const QRectF QtRoundedEditRectItem::GetTextRect(const std::string& s) const { const double h = QFontMetricsF(m_font).height(); const double w = QFontMetricsF(m_font).width(s.c_str()); //return QRectF(-0.5 * w,0.0,w,h).adjusted(0.0,0.0,2.0,-1.0); //BUG 2013-01-20 #ifdef _WIN32 //adjusted(0.0,0.0,2.0,0.0) works fine for 50% of the fonts supplied by Wine under native Lubuntu //adjusted(0.0,0.0,3.0,0.0) works fine for 80% of the fonts supplied by Wine under native Lubuntu return QRectF(-0.5 * w, 0.0,w,h).adjusted(0.0,0.0,3.0,0.0); #else //adjusted(0.0,0.0,2.0,-1.0) works fine for 90% of the fonts under native Lubuntu //adjusted(0.0,0.0,3.0,-1.0) works fine for 99% of the fonts under native Lubuntu //adjusted(0.0,0.0,4.0,-1.0) works fine for all the fonts I've tried under native Lubuntu return QRectF(-0.5 * w,0.0,w,h).adjusted(0.0,0.0,2.0,-1.0); #endif }
void TextSymbol::updateQFont() { qfont = QFont(); qfont.setBold(bold); qfont.setItalic(italic); qfont.setUnderline(underline); qfont.setPixelSize(internal_point_size); qfont.setFamily(font_family); qfont.setHintingPreference(QFont::PreferNoHinting); qfont.setKerning(kerning); metrics = QFontMetricsF(qfont); qfont.setLetterSpacing(QFont::AbsoluteSpacing, metrics.width(" ") * character_spacing); qfont.setStyleStrategy(QFont::ForceOutline); metrics = QFontMetricsF(qfont); tab_interval = 8.0 * metrics.averageCharWidth(); }
GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent) : QWidget(parent) { float size = QFontMetricsF(font()).height() ; float fact = size/14.0 ; maxWidth = 400*fact ; maxHeight = 0 ; }
GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent) : QWidget(parent) { float size = QFontMetricsF(font()).height() ; float fact = size/14.0 ; maxWidth = 400*fact ; maxHeight = 0 ; mCurrentN = PARTIAL_VIEW_SIZE/2+1 ; }
QRect RSPermissionMatrixWidget::computeNodePosition(int n_row,int n_col,bool selected) const { float fact = selected?1.2f:1.0f; float S = QFontMetricsF(font()).height(); return QRect(matrix_start_x + n_col * S*fCOL_SIZE + (S*fCOL_SIZE-S*fICON_SIZE_X*fact)/2, S*fMATRIX_START_Y + n_row * S*fROW_SIZE + (S*fROW_SIZE-S*fICON_SIZE_Y*fact)/2, S*fICON_SIZE_X*fact, S*fICON_SIZE_Y*fact) ; }
void OverlayWidget::paintEvent( QPaintEvent* event ) { Q_UNUSED( event ); QPoint center( ( m_parent->width() - width() ) / 2, ( m_parent->height() - height() ) / 2 ); if ( center != pos() ) { move( center ); return; } QPainter p( this ); QRect r = contentsRect(); p.setBackgroundMode( Qt::TransparentMode ); p.setRenderHint( QPainter::Antialiasing ); p.setOpacity( m_opacity ); QPen pen( palette().dark().color(), .5 ); p.setPen( pen ); p.setBrush( QColor( 30, 30, 30, 255.0 * OPACITY ) ); p.drawRoundedRect( r, CORNER_ROUNDNESS, CORNER_ROUNDNESS ); QTextOption to( Qt::AlignCenter ); to.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere ); // shrink to fit if needed QFont f( font() ); f.setPointSize( FONT_SIZE ); f.setBold( true ); QRectF textRect = r.adjusted( 8, 8, -8, -8 ); qreal availHeight = textRect.height(); QFontMetricsF fm( f ); qreal textHeight = fm.boundingRect( textRect, Qt::AlignCenter | Qt::TextWordWrap, text() ).height(); while( textHeight > availHeight ) { if( f.pointSize() <= 4 ) // don't try harder break; f.setPointSize( f.pointSize() - 1 ); fm = QFontMetricsF( f ); textHeight = fm.boundingRect( textRect, Qt::AlignCenter | Qt::TextWordWrap, text() ).height(); } p.setFont( f ); p.setPen( palette().highlightedText().color() ); p.drawText( r.adjusted( 8, 8, -8, -8 ), text(), to ); }
/** Paints selected total indicators on the graph. */ void RSGraphWidget::paintTotals() { float FS = QFontMetricsF(font()).height(); //float fact = FS/14.0 ; //int x = SCALE_WIDTH*fact + FS, y = 0; int rowHeight = FS; #if !defined(Q_OS_MAC) /* On Mac, we don't need vertical spacing between the text rows. */ rowHeight += 5; #endif }
void ContentBlockingInformationWidget::updateState() { m_icon = (isCustomized() ? getOptions().value(QLatin1String("icon")).value<QIcon>() : QIcon()); if (m_icon.isNull()) { m_icon = ThemesManager::createIcon(QLatin1String("content-blocking")); } const int iconSize(this->iconSize().width()); const int fontSize(qMax((iconSize / 2), 12)); QFont font(this->font()); font.setBold(true); font.setPixelSize(fontSize); QString label; if (m_amount > 999999) { label = QString::number(m_amount / 1000000) + QLatin1Char('M'); } else if (m_amount > 999) { label = QString::number(m_amount / 1000) + QLatin1Char('K'); } else { label = QString::number(m_amount); } const qreal labelWidth(QFontMetricsF(font).width(label)); font.setPixelSize(fontSize * 0.8); QRectF rectangle((iconSize - labelWidth), (iconSize - fontSize), labelWidth, fontSize); QPixmap pixmap(m_icon.pixmap(iconSize, iconSize, (m_isContentBlockingEnabled ? QIcon::Normal : QIcon::Disabled))); QPainter iconPainter(&pixmap); iconPainter.fillRect(rectangle, (m_isContentBlockingEnabled ? Qt::darkRed : Qt::darkGray)); iconPainter.setFont(font); iconPainter.setPen(QColor(255, 255, 255, 230)); iconPainter.drawText(rectangle, Qt::AlignCenter, label); m_icon = QIcon(pixmap); setText(getText()); setToolTip(text()); setIcon(m_icon); m_elementsMenu->setEnabled(m_amount > 0); }
virtual void renderHead(QPainter & painter, TuringMachine const & tm) const { (void)tm; QFont labelFont; qreal fontScale = 7. / QFontMetricsF(labelFont).ascent(); labelFont.setPointSizeF(labelFont.pointSizeF() * fontScale); painter.save(); painter.setFont(labelFont); painter.scale(1. / 4., 1. / 4.); painter.setPen(QPen(Qt::black, 0., Qt::SolidLine)); painter.setBrush(Qt::black); painter.drawText(-5, 2, 10, 8, Qt::AlignHCenter, label()); painter.restore(); }
QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF& /* constraint */) const { float FS = QFontMetricsF(font()).height(); //float fact = FS/14.0 ; switch(which) { default: case Qt::MinimumSize: case Qt::PreferredSize: return QSizeF(70*FS,12*FS); case Qt::MaximumSize: return QSizeF(700*FS,120*FS); } }
QRectF NMGChartYAxis::boundingRect() const { if(currentWidthIntoScene <= 0 || currentHeightIntoScene <= 0) return QRectF(); else { if(location == NMGChartAxis::EXTERNAL) { double extraHeight = QFontMetricsF(currentFont).height()/2.0; return QRectF(0, -extraHeight, currentWidthIntoScene, extraHeight + currentHeightIntoScene + extraHeight); } else // INTERNAL return QRectF(0, 0, currentWidthIntoScene, currentHeightIntoScene); } }
QRectF NMGChartXAxis::boundingRect() const { if(currentWidthIntoScene <= 0 || currentHeightIntoScene <= 0) return QRectF(); else { if(location == NMGChartAxis::EXTERNAL) { double extraWidth = QFontMetricsF(currentFont).height()/2.0; // label is rotated 90º degrees return QRectF(-extraWidth, 0, extraWidth + currentWidthIntoScene + extraWidth, currentHeightIntoScene); } else // INTERNAL return QRectF(0, 0, currentWidthIntoScene, currentHeightIntoScene); } }
BwCtrlWindow::BwCtrlWindow(QWidget *parent) : RsAutoUpdatePage(1000,parent) { setupUi(this); BWDelegate = new BWListDelegate(); bwTreeWidget->setItemDelegate(BWDelegate); float FS = QFontMetricsF(font()).height(); float fact = FS/14.0 ; /* Set header resize modes and initial section sizes Peer TreeView*/ QHeaderView * _header = bwTreeWidget->header () ; // _header->resizeSection ( COLUMN_RSNAME, 170*fact ); QHeaderView_setSectionResizeMode(_header, QHeaderView::ResizeToContents); }
void GlissandoSegment::draw(QPainter* painter) const { painter->save(); qreal _spatium = spatium(); QPen pen(glissando()->curColor()); pen.setWidthF(glissando()->lineWidth().val() * spatium()); pen.setCapStyle(Qt::RoundCap); painter->setPen(pen); // painter->drawLine(QPointF(), pos2()); // DEBUG // rotate painter so that the line become horizontal qreal w = pos2().x(); qreal h = pos2().y(); qreal l = sqrt(w * w + h * h); qreal wi = asin(-h / l) * 180.0 / M_PI; painter->rotate(-wi); if (glissando()->glissandoType() == Glissando::Type::STRAIGHT) { painter->drawLine(QLineF(0.0, 0.0, l, 0.0)); } else if (glissando()->glissandoType() == Glissando::Type::WAVY) { QRectF b = symBbox(SymId::wiggleTrill); // qreal h = symHeight(SymId::wiggleTrill); // DEBUG qreal w = symWidth(SymId::wiggleTrill); int n = (int)(l / w); // always round down (truncate) to avoid overlap qreal x = (l - n*w) * 0.5; // centre line in available space drawSymbol(SymId::wiggleTrill, painter, QPointF(x, b.height()*.70), n); } if (glissando()->showText()) { const TextStyle& st = score()->textStyle(TextStyleType::GLISSANDO); QFont f = st.fontPx(_spatium); QRectF r = QFontMetricsF(f).boundingRect(glissando()->text()); // if text longer than available space, skip it if (r.width() < l) { qreal yOffset = r.height() + r.y(); // find text descender height // raise text slightly above line and slightly more with WAVY than with STRAIGHT yOffset += _spatium * (glissando()->glissandoType() == Glissando::Type::WAVY ? 0.5 : 0.1); painter->setFont(f); qreal x = (l - r.width()) * 0.5; painter->drawText(QPointF(x, -yOffset), glissando()->text()); } } painter->restore(); }
static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/) { GxsIdRSTreeWidgetItem *item = dynamic_cast<GxsIdRSTreeWidgetItem*>(object); if (!item) { return; } QList<QIcon> icons; switch (type) { case GXS_ID_DETAILS_TYPE_EMPTY: item->processResult(true); break; case GXS_ID_DETAILS_TYPE_FAILED: item->processResult(false); break; case GXS_ID_DETAILS_TYPE_LOADING: icons.push_back(GxsIdDetails::getLoadingIcon(details.mId)); break; case GXS_ID_DETAILS_TYPE_DONE: GxsIdDetails::getIcons(details, icons, item->iconTypeMask()); item->processResult(true); break; case GXS_ID_DETAILS_TYPE_BANNED: icons.push_back(QIcon("BANNED_IMAGE")) ; break ; } int column = item->idColumn(); item->setToolTip(column, GxsIdDetails::getComment(details)); item->setText(column, GxsIdDetails::getNameForType(type, details)); item->setData(column, Qt::UserRole, QString::fromStdString(details.mId.toStdString())); QPixmap combinedPixmap; if (!icons.empty()) { GxsIdDetails::GenerateCombinedPixmap(combinedPixmap, icons, QFontMetricsF(item->font(item->idColumn())).height()*1.4); } item->setData(column, Qt::DecorationRole, combinedPixmap); item->setAvatar(details.mAvatar); }