static QColor StatusToColor(TorrentStatus s,const QColorGroup & cg) { QColor green(40,205,40); QColor yellow(255,174,0); switch (s) { case kt::SEEDING : case kt::DOWNLOADING: case kt::ALLOCATING_DISKSPACE : return green; case kt::STALLED: case kt::CHECKING_DATA: return yellow; case kt::ERROR : return Qt::red; case kt::NOT_STARTED : case kt::STOPPED: case kt::QUEUED: case kt::DOWNLOAD_COMPLETE : case kt::SEEDING_COMPLETE : default: return cg.text(); } return cg.text(); }
void UserViewItemBase::paintCell(QPainter *p, const QColorGroup &cg, int, int width, int) { UserListBase *view = static_cast<UserListBase*>(listView()); width = view->width() - 4; QScrollBar *vBar = view->verticalScrollBar(); if (vBar->isVisible()) width -= vBar->width(); if (width < 1) width = 1; QPixmap bg(width, height()); QPainter pp(&bg); int margin = 0; if (isSelected() && view->hasFocus() && CorePlugin::m_plugin->getUseDblClick()){ pp.fillRect(QRect(0, 0, width, height()), cg.highlight()); pp.setPen(cg.highlightedText()); }else{ pp.fillRect(QRect(0, 0, width, height()), cg.base()); PaintView pv; pv.p = &pp; pv.pos = view->viewport()->mapToParent(view->itemRect(this).topLeft()); pv.size = QSize(width, height()); pv.win = view; pv.isStatic = false; pv.height = height(); pv.margin = 0; if (CorePlugin::m_plugin->getUseSysColors()){ pp.setPen(cg.text()); }else{ pp.setPen(QColor(CorePlugin::m_plugin->getColorOnline())); } Event e(EventPaintView, &pv); e.process(); view->setStaticBackground(pv.isStatic); margin = pv.margin; } view->drawItem(this, &pp, cg, width, margin); pp.end(); if (view->m_pressedItem == this){ p->drawPixmap(QPoint(1, 1), bg); if (CorePlugin::m_plugin->getUseSysColors()){ p->setPen(cg.text()); }else{ p->setPen(QColor(CorePlugin::m_plugin->getColorOnline())); } p->moveTo(0, 0); p->lineTo(width - 1, 0); p->lineTo(width - 1, height() - 1); p->lineTo(0, height() - 1); p->lineTo(0, 0); p->setPen(cg.shadow()); p->moveTo(width - 2, 1); p->lineTo(1, 1); p->lineTo(1, height() - 2); }else{ p->drawPixmap(QPoint(0, 0), bg); } }
HTMLColors() { map["black"] = "#000000"; map["green"] = "#008000"; map["silver"] = "#c0c0c0"; map["lime"] = "#00ff00"; map["gray"] = "#808080"; map["olive"] = "#808000"; map["white"] = "#ffffff"; map["yellow"] = "#ffff00"; map["maroon"] = "#800000"; map["navy"] = "#000080"; map["red"] = "#ff0000"; map["blue"] = "#0000ff"; map["purple"] = "#800080"; map["teal"] = "#008080"; map["fuchsia"] = "#ff00ff"; map["aqua"] = "#00ffff"; map["crimson"] = "#dc143c"; map["indigo"] = "#4b0082"; #ifdef __BEOS__ printf( "Warning: HTMLColors::HTMLColors() not initiating all colors\n" ); #else // ### react to style changes // see http://www.richinstyle.com for details QColorGroup cg = kapp->palette().active(); map["activeborder"] = cg.light(); // bordercolor of an active window map["activecaption"] = cg.text(); // caption color of an active window map["appworkspace"] = cg.background(); // background color of an MDI interface map["highlight"] = cg.highlight(); map["highlighttext"] = cg.highlightedText(); cg = kapp->palette().inactive(); map["background"] = cg.background(); // desktop background color map["buttonface"] = cg.button(); // Button background color map["buttonhighlight"] = cg.light(); map["buttonshadow"] = cg.shadow(); map["buttontext"] = cg.buttonText(); map["captiontext"] = cg.text(); map["infobackground"] = QToolTip::palette().inactive().background(); map["menu"] = cg.background(); map["menutext"] = cg.foreground(); map["scrollbar"] = cg.background(); map["threeddarkshadow"] = cg.dark(); map["threedface"] = cg.button(); map["threedhighlight"] = cg.light(); map["threedlightshadow"] = cg.midlight(); map["window"] = cg.background(); map["windowframe"] = cg.background(); map["text"] = cg.text(); cg = kapp->palette().disabled(); map["inactiveborder"] = cg.background(); map["inactivecaption"] = cg.background(); map["inactivecaptiontext"] = cg.text(); map["graytext"] = cg.text(); #endif };
void TaskMenuItem::paint(QPainter *p, const QColorGroup &cg, bool highlighted, bool /*enabled*/, int x, int y, int w, int h ) { if (m_isActive) { QFont font = p->font(); font.setBold(true); p->setFont(font); } if (highlighted) { p->setPen(cg.highlightedText()); } else if (m_isMinimized) { p->setPen(QPen(KickerLib::blendColors(cg.background(), cg.text()))); } else if (m_demandsAttention && !m_attentionState) { p->setPen(cg.mid()); } p->drawText(x, y, w, h, AlignAuto|AlignVCenter|DontClip|ShowPrefix, m_text); }
void TeQtBigTable::paintCell(QPainter *painter, int row, int col, const QRect &cr, bool selected, const QColorGroup &cg) { QRect rect(0, 0, cr.width(), cr.height()); if (selected) { painter->fillRect(rect, cg.highlight()); painter->setPen(cg.highlightedText()); } else { painter->fillRect(rect, cg.base()); painter->setPen(cg.text()); } QTable::paintCell(painter, row, col, cr, selected, cg); QVariant v(dataSource_->cell(row, col)); if (v.type() == QVariant::Pixmap) { QPixmap p = v.toPixmap(); painter->drawPixmap(0, 0, p); } else if (v.type() == QVariant::String || v.type() == QVariant::CString) { QString qs = v.toString(); bool ok; qs.toDouble(&ok); if (ok) painter->drawText(0, 0, cr.width()-10, cr.height(), Qt::AlignRight | Qt::SingleLine, v.toString()); else painter->drawText(0, 0, cr.width()-10, cr.height(), Qt::AlignLeft | Qt::SingleLine, v.toString()); } }
void KviVariantTableItem::paint(QPainter *p,const QColorGroup &cg,const QRect &cr,bool) { p->fillRect(0,0,cr.width(),cr.height(),cg.base()); if(m_property.type() == QVariant::Color) { p->fillRect(3,3,cr.width() - 6,cr.height() - 6,m_property.asColor()); } else { QString sz; switch(m_property.type()) { case QVariant::String: sz = m_property.toString(); break; case QVariant::Bool: sz = m_property.toBool() ? "TRUE" : "FALSE"; break; case QVariant::Font: sz.setNum(m_property.toFont().pointSize()); sz.prepend(", "); sz.prepend(m_property.toFont().family()); break; case QVariant::Int: sz.setNum(m_property.toInt()); break; case QVariant::UInt: sz.setNum(m_property.toUInt()); break; default: break; } p->setPen(cg.text()); p->drawText(0,0,cr.width(),cr.height(),Qt::AlignLeft | Qt::AlignTop,sz); } }
void FancyItem::paintCell(QPainter *p, const QColorGroup &cg, int c, int w, int) { int h = height(); QFontMetrics fm(p->font()); if(isSelected()) p->fillRect(0, 0, w, h-1, cg.highlight()); else p->fillRect(0, 0, w, h, cg.base()); int x = 0; const QPixmap *pix = pixmap(c); if(pix) { p->drawPixmap(4, (h - pix->height()) / 2, *pix); x += pix->width(); } else x += 16; x += 8; int y = ((h - fm.height()) / 2) + fm.ascent(); p->setPen(isSelected() ? cg.highlightedText() : cg.text()); p->drawText(x, y, text(c)); p->setPen(QPen(QColor(0xE0, 0xE0, 0xE0), 0, Qt::DotLine)); p->drawLine(0, h-1, w-1, h-1); }
virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ) { bool updates_enabled = listView()->isUpdatesEnabled(); listView()->setUpdatesEnabled(false); QColor c = cg.text(); bool text_changed = false; QString oldText; if (_new) { c = QApplication::palette().color( QPalette::Disabled, QColorGroup::Text ); if (!clickToAdd) clickToAdd = new QString(i18n("<Click to add>")); oldText = text(column); text_changed = true; if (column == 0) setText(0, *clickToAdd); else setText(1, QString()); } QColorGroup _cg( cg ); _cg.setColor( QColorGroup::Text, c ); super::paintCell( p, _cg, column, width, alignment ); if (text_changed) setText(column, oldText); listView()->setUpdatesEnabled(updates_enabled); }
void KstMatrixTable::paintCell( QPainter* painter, int row, int col, const QRect& cr, bool selected, const QColorGroup& cg ) { KstMatrixList matrices = KST::matrixList; KstMatrixPtr matrix = *matrices.findTag(_strMatrix); QString str; double value; painter->eraseRect( 0, 0, cr.width(), cr.height() ); if (selected) { painter->fillRect( 0, 0, cr.width(), cr.height(), cg.highlight() ); painter->setPen(cg.highlightedText()); } else { painter->fillRect( 0, 0, cr.width(), cr.height(), cg.base() ); painter->setPen(cg.text()); } if (matrix) { bool ok; value = matrix->valueRaw(col, row, &ok); if (ok) { str.setNum(value, 'g', 16); } } painter->drawText(0, 0, cr.width(), cr.height(), AlignLeft, str); }
/** * @internal * This paints the item */ void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool ) { p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); int marg = ( cr.width() - BoxSize ) / 2; int x = 0; int y = ( cr.height() - BoxSize ) / 2; p->setPen( QPen( cg.text() ) ); p->drawRect( x + marg, y, BoxSize, BoxSize ); p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); p->setPen( darkGreen ); x += 1; y += 1; if ( m_checked ) { QPointArray a( 7*2 ); int i, xx, yy; xx = x+1+marg; yy = y+2; for ( i=0; i<3; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( i=3; i<7; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } p->drawLineSegments( a ); } }
void FreshStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup &cg, bool on, bool down, bool enabled ) { static const QCOORD pts1[] = { // dark lines 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; static const QCOORD pts4[] = { // white lines 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, 11,4, 10,3, 10,2 }; static const QCOORD pts5[] = { // inner fill 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; p->eraseRect( x, y, w, h ); QPointArray a( QCOORDARRLEN(pts1), pts4 ); a.translate( x, y ); p->setPen( cg.dark() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts4), pts1 ); a.translate( x, y ); p->setPen( cg.light() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts5), pts5 ); a.translate( x, y ); QColor fillColor = ( down || !enabled ) ? cg.button() : cg.base(); p->setPen( fillColor ); p->setBrush( fillColor ) ; p->drawPolygon( a ); if ( on ) { p->setPen( NoPen ); p->setBrush( cg.text() ); p->drawRect( x+5, y+4, 2, 4 ); p->drawRect( x+4, y+5, 4, 2 ); } }
void ListListViewItem::paintCell(QPainter *p,const QColorGroup &cg,int column, int width,int align) { if(column!=list_track_column) { Q3ListViewItem::paintCell(p,cg,column,width,align); return; } QColor fg=cg.text(); QColor bg=cg.base(); if(isSelected()) { fg=cg.highlightedText(); bg=cg.highlight(); } QString str=QString().sprintf("%u / %u",list_tracks,list_total_tracks); QPixmap *icon=list_whiteball_map; if(list_total_tracks>0) { if(list_tracks==list_total_tracks) { icon=list_greenball_map; } else { icon=list_redball_map; } } QFontMetrics *m=new QFontMetrics(p->font()); p->setBackgroundColor(bg); p->eraseRect(0,0,width,height()); p->setPen(fg); p->drawPixmap(list_parent->itemMargin(),(height()-icon->size().height())/2, *icon); p->drawText(icon->size().width()+10,3*(height()-m->height())/2,str); delete m; }
void DriverItem::paintCell(QPainter *p, const QColorGroup &cg, int, int width, int) { // background p->fillRect(0, 0, width, height(), cg.base()); // highlight rectangle if(isSelected()) p->fillRect(0, 0, /*2+p->fontMetrics().width(text(0))+(pixmap(0) ? pixmap(0)->width()+2 : 0)*/ width, height(), (m_conflict ? red : cg.highlight())); // draw pixmap int w(0); if(pixmap(0) && !pixmap(0)->isNull()) { int h((height() - pixmap(0)->height()) / 2); p->drawPixmap(w, h, *pixmap(0)); w += (pixmap(0)->width() + 2); } // draw Text if(!m_item || !m_item->isOption() || isSelected()) { p->setPen((isSelected() ? cg.highlightedText() : (m_conflict ? red : cg.text()))); p->drawText(w, 0, width - w, height(), Qt::AlignLeft | Qt::AlignVCenter, text(0)); } else { int w1(0); QString s(m_item->get("text") + ": <"); w1 = p->fontMetrics().width(s); p->setPen(cg.text()); p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s); w += w1; p->setPen((m_conflict ? red : darkGreen)); s = m_item->prettyText(); w1 = p->fontMetrics().width(s); p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s); w += w1; p->setPen(cg.text()); s = QString::fromLatin1(">"); w1 = p->fontMetrics().width(s); p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s); } }
// A ctor. QsciStyle::QsciStyle(int style) { init(style); QColorGroup cg = QApplication::palette().active(); setColor(cg.text()); setPaper(cg.base()); setFont(QApplication::font()); setEolFill(false); }
/** Paint on @p painter * in (@p x, @p y, @p width, @p height) * using @p colorGroup for the button drawing (if @p isHovered) * and the LinkLook color() for the text, * unless [the LinkLook !color.isValid() and it does not useLinkColor()] or [@p isDefaultColor is false]: in this case it will use @p colorGroup.text(). * It will draw the button if @p isIconButtonHovered. */ void LinkDisplay::paint(QPainter *painter, int x, int y, int width, int height, const QColorGroup &colorGroup, bool isDefaultColor, bool isSelected, bool isHovered, bool isIconButtonHovered) const { int BUTTON_MARGIN = kapp->style()->pixelMetric(QStyle::PM_ButtonMargin); int LINK_MARGIN = BUTTON_MARGIN + 2; QPixmap pixmap; // Load the preview...: if (!isHovered && m_look->previewEnabled() && !m_preview.isNull()) pixmap = m_preview; // ... Or the icon (if no preview or if the "Open" icon should be shown): else { int iconSize = m_look->iconSize(); QString iconName = (isHovered ? Global::openNoteIcon() : m_icon); KIconLoader::States iconState = (isIconButtonHovered ? KIconLoader::ActiveState : KIconLoader::DefaultState); pixmap = KIconLoader::global()->loadIcon( iconName, KIconLoader::Desktop, iconSize, iconState, QStringList(), 0L, /*canReturnNull=*/false ); } int iconPreviewWidth = qMax(m_look->iconSize(), (m_look->previewEnabled() ? m_preview.width() : 0)); int pixmapX = (iconPreviewWidth - pixmap.width()) / 2; int pixmapY = (height - pixmap.height()) / 2; // Draw the button (if any) and the icon: if (isHovered) { QStyleOption opt; opt.rect = QRect(-1, -1, iconPreviewWidth + 2*BUTTON_MARGIN, height + 2); opt.state = isIconButtonHovered ? (QStyle::State_MouseOver | QStyle::State_Enabled) : QStyle::State_Enabled; kapp->style()->drawPrimitive(QStyle::PE_PanelButtonCommand, &opt, painter); } painter->drawPixmap(x + BUTTON_MARGIN - 1 + pixmapX, y + pixmapY, pixmap); // Figure out the text color: if (isSelected) { painter->setPen(kapp->palette().color(QPalette::HighlightedText)); } else if (isIconButtonHovered) painter->setPen(m_look->effectiveHoverColor()); else if (!isDefaultColor || (!m_look->color().isValid() && !m_look->useLinkColor())) // If the color is FORCED or if the link color default to the text color: painter->setPen(colorGroup.text()); else painter->setPen(m_look->effectiveColor()); // Draw the text: painter->setFont(labelFont(m_font, isIconButtonHovered)); painter->drawText(x + BUTTON_MARGIN - 1 + iconPreviewWidth + LINK_MARGIN, y, width - BUTTON_MARGIN + 1 - iconPreviewWidth - LINK_MARGIN, height, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextWordWrap, m_title); }
void Kleo::SignatureKeyListViewItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int alignment ) { const KeyListView::DisplayStrategy * ds = listView() ? listView()->displayStrategy() : 0 ; if ( !ds ) { QListViewItem::paintCell( p, cg, column, width, alignment ); return; } const QColor fg = ds->signatureForeground( signature(), cg.text() ); const QColor bg = ds->signatureBackground( signature(), cg.base() ); const QFont f = ds->signatureFont( signature(), p->font() ); QColorGroup _cg = cg; p->setFont( f ); _cg.setColor( QColorGroup::Text, fg ); _cg.setColor( QColorGroup::Base, bg ); QListViewItem::paintCell( p, _cg, column, width, alignment ); }
void KPopupMenu::paintCell(QPainter *p, int row, int col) { if (row != 0) QPopupMenu::paintCell(p, row, col); else if ( ( (row == 0) && (col == 1) && (isCheckable()) ) || ( (row == 0) && (col == 0) && (!isCheckable()) ) ) { int cellh = cellHeight(0); int cellw = cellWidth(0); QColorGroup cg = this->colorGroup(); p->setPen(cg.light()); p->drawText(6, 3, cellw, cellh-4, DontClip|AlignVCenter|ShowPrefix|SingleLine, text(0)); p->setPen(cg.text()); p->drawText(5, 2, cellw, cellh-4, DontClip|AlignVCenter|ShowPrefix|SingleLine, text(0)); } }
void QWindowsStyle::drawIndicator( QPainter* p, int x, int y, int w, int h, const QColorGroup &g, int s, bool down, bool enabled ) { #ifndef QT_NO_BUTTON QBrush fill; if ( s == QButton::NoChange ) { QBrush b = p->brush(); QColor c = p->backgroundColor(); p->setBackgroundMode( TransparentMode ); p->setBackgroundColor( green ); fill = QBrush(g.base(), Dense4Pattern); p->setBackgroundColor( c ); p->setBrush( b ); } else if ( down ) fill = g.brush( QColorGroup::Button ); else fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background ); qDrawWinPanel( p, x, y, w, h, g, TRUE, &fill ); if ( s != QButton::Off ) { QPointArray a( 7*2 ); int i, xx, yy; xx = x+3; yy = y+5; for ( i=0; i<3; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( i=3; i<7; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } if ( s == QButton::NoChange ) { p->setPen( g.dark() ); } else { p->setPen( g.text() ); } p->drawLineSegments( a ); } #endif }
void KstVectorTable::paintCell( QPainter* painter, int row, int col, const QRect& cr, bool selected, const QColorGroup& cg ) { KstVectorPtr vector = *KST::vectorList.findTag(_strVector); QString str; painter->eraseRect( 0, 0, cr.width(), cr.height() ); if (selected) { painter->fillRect( 0, 0, cr.width(), cr.height(), cg.highlight() ); painter->setPen(cg.highlightedText()); } else { painter->fillRect( 0, 0, cr.width(), cr.height(), cg.base() ); painter->setPen(cg.text()); } if( col == 0 && vector) { str.setNum(vector->value(row), 'g', 16); } painter->drawText(0, 0, cr.width(), cr.height(), AlignLeft, str); }
void Cell::paint( QPainter * p, const QColorGroup & cg, const QRect & cr, bool selected ) { p->fillRect( 0, 0, cr.width(), cr.height(), selected ? cg.brush( QColorGroup::Highlight ) : cg.brush( QColorGroup::Base ) ); int w = cr.width(); int h = cr.height(); int x = 0; if ( !pixmap.isNull() ) { p->drawPixmap( 0, ( cr.height() - pixmap.height() ) / 2, pixmap ); x = pixmap.width() + 2; } if ( selected ) p->setPen( cg.highlightedText() ); else p->setPen( cg.text() ); p->drawText( x + 2, 0, w - x - 4, h, Qt::AlignRight, text() ); }
QPixmap MarkList::flagPixmap() { QColorGroup cg = QApplication::palette()->normal(); QPixmap pm; pm.resize(16,16); pm.fill( cg.background() ); int xOffset = 4; int yOffset = 3; QPainter p; p.begin( &pm); p.setPen( cg.text() ); p.drawLine( xOffset+4, yOffset, xOffset+4, yOffset+9 ); p.setPen( red ); p.drawLine( xOffset+3, yOffset+1, xOffset, yOffset+4 ); p.drawLine( xOffset+3, yOffset+1, xOffset+3, yOffset+4 ); p.drawLine( xOffset, yOffset+4, xOffset+3, yOffset+4 ); p.end(); return pm; }
/*! \reimp */ void QWindowsStyle::drawCheckMark( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool act, bool dis ) { const int markW = w > 7 ? 7 : w; const int markH = markW; int posX = x + ( w - markW )/2 - 1; int posY = y + ( h - markH )/2; // Could do with some optimizing/caching... QPointArray a( markH*2 ); int i, xx, yy; xx = posX; yy = 3 + posY; for ( i=0; i<markW/2; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( ; i<markH; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } if ( dis && !act ) { int pnt; p->setPen( g.highlightedText() ); QPoint offset(1,1); for ( pnt = 0; pnt < (int)a.size(); pnt++ ) a[pnt] += offset; p->drawLineSegments( a ); for ( pnt = 0; pnt < (int)a.size(); pnt++ ) a[pnt] -= offset; } p->setPen( g.text() ); p->drawLineSegments( a ); }
void KstScalarTable::paintCell( QPainter* painter, int row, int col, const QRect& cr, bool selected, const QColorGroup& cg ) { KstScalarList::iterator it = KST::scalarList.begin(); QString str; if (selected) { painter->eraseRect( 0, 0, cr.width(), cr.height() ); painter->fillRect( 0, 0, cr.width(), cr.height(), cg.highlight() ); painter->setPen(cg.highlightedText()); } else { painter->eraseRect( 0, 0, cr.width(), cr.height() ); painter->fillRect( 0, 0, cr.width(), cr.height(), cg.base() ); painter->setPen(cg.text()); } it += row; if( col == 0 ) { str = (*it)->tagName(); } else if( col == 1 ) { str = (*it)->label(); } painter->drawText(0, 0, cr.width(), cr.height(), AlignLeft, str); }
/****************************************************************************** * Paint one value in one of the columns in the list view. */ void AlarmListViewItem::paintCell(QPainter *painter, const QColorGroup &cg, int column, int width, int /*align*/) { const AlarmListView *listView = alarmListView(); int margin = listView->itemMargin(); QRect box(margin, margin, width - margin * 2, height() - margin * 2); // area within which to draw bool selected = isSelected(); QColor bgColour = selected ? cg.highlight() : cg.base(); QColor fgColour = selected ? cg.highlightedText() : !event().enabled() ? Preferences::disabledColour() : event().expired() ? Preferences::expiredColour() : cg.text(); painter->setPen(fgColour); painter->fillRect(0, 0, width, height(), bgColour); if(column == listView->column(AlarmListView::TIME_COLUMN)) { int i = -1; QString str = text(column); if(mTimeHourPos >= 0) { // Need to pad out spacing to align times without leading zeroes i = str.find(" ~"); if(i >= 0) { if(mDigitWidth < 0) mDigitWidth = painter->fontMetrics().width("0"); QString date = str.left(i + 1); int w = painter->fontMetrics().width(date) + mDigitWidth; painter->drawText(box, AlignVCenter, date); box.setLeft(box.left() + w); painter->drawText(box, AlignVCenter, str.mid(i + 2)); } } if(i < 0) painter->drawText(box, AlignVCenter, str); } else if(column == listView->column(AlarmListView::TIME_TO_COLUMN)) painter->drawText(box, AlignVCenter | AlignRight, text(column)); else if(column == listView->column(AlarmListView::REPEAT_COLUMN)) painter->drawText(box, AlignVCenter | AlignHCenter, text(column)); else if(column == listView->column(AlarmListView::COLOUR_COLUMN)) { // Paint the cell the colour of the alarm message if(event().action() == KAEvent::MESSAGE || event().action() == KAEvent::FILE) painter->fillRect(box, event().bgColour()); } else if(column == listView->column(AlarmListView::TYPE_COLUMN)) { // Display the alarm type icon, horizontally and vertically centred in the cell QPixmap *pixmap = eventIcon(); QRect pixmapRect = pixmap->rect(); int diff = box.height() - pixmap->height(); if(diff < 0) { pixmapRect.setTop(-diff / 2); pixmapRect.setHeight(box.height()); } QPoint iconTopLeft(box.left() + (box.width() - pixmapRect.width()) / 2, box.top() + (diff > 0 ? diff / 2 : 0)); painter->drawPixmap(iconTopLeft, *pixmap, pixmapRect); } else if(column == listView->column(AlarmListView::MESSAGE_COLUMN)) { if(!selected && listView->drawMessageInColour()) { painter->fillRect(box, event().bgColour()); painter->setBackgroundColor(event().bgColour()); // painter->setPen(event().fgColour()); } QString txt = text(column); painter->drawText(box, AlignVCenter, txt); mMessageColWidth = listView->fontMetrics().boundingRect(txt).width(); } }
/*! \reimp */ void QCompactStyle::drawControl( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &g, SFlags flags, const QStyleOption& opt ) { switch ( element ) { case CE_PopupMenuItem: { if (! widget || opt.isDefault()) break; const QPopupMenu *popupmenu = (const QPopupMenu *) widget; QMenuItem *mi = opt.menuItem(); if ( !mi ) break; int tab = opt.tabWidth(); int maxpmw = opt.maxIconWidth(); bool dis = !(flags & Style_Enabled); bool checkable = popupmenu->isCheckable(); bool act = flags & Style_Active; int x, y, w, h; r.rect( &x, &y, &w, &h ); QColorGroup itemg = g; if ( checkable ) maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks int checkcol = maxpmw; if ( mi && mi->isSeparator() ) { // draw separator p->setPen( g.dark() ); p->drawLine( x, y, x+w, y ); p->setPen( g.light() ); p->drawLine( x, y+1, x+w, y+1 ); return; } QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x, y, w, h, fill); if ( !mi ) return; if ( mi->isChecked() ) { if ( act && !dis ) { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Button ) ); } else { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); } } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); } if ( mi->iconSet() ) { // draw iconset QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; if (act && !dis ) mode = QIconSet::Active; QPixmap pixmap; if ( checkable && mi->isChecked() ) pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode, QIconSet::On ); else pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode ); int pixw = pixmap.width(); int pixh = pixmap.height(); if ( act && !dis ) { if ( !mi->isChecked() ) qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); } else if ( checkable ) { // just "checking"... int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; if ( mi->isChecked() ) { SFlags cflags = Style_Default; if (! dis) cflags |= Style_Enabled; if (act) cflags |= Style_On; drawPrimitive( PE_CheckMark, p, QRect(x + motifItemFrame + 2, y + motifItemFrame, mw, mh), itemg, cflags, opt ); } } p->setPen( act ? g.highlightedText() : g.buttonText() ); QColor discol; if ( dis ) { discol = itemg.text(); p->setPen( discol ); } int xm = motifItemFrame + checkcol + motifItemHMargin; if ( mi->custom() ) { int m = motifItemVMargin; p->save(); if ( dis && !act ) { p->setPen( g.light() ); mi->custom()->paint( p, itemg, act, !dis, x+xm+1, y+m+1, w-xm-tab+1, h-2*m ); p->setPen( discol ); } mi->custom()->paint( p, itemg, act, !dis, x+xm, y+m, w-xm-tab+1, h-2*m ); p->restore(); } QString s = mi->text(); if ( !s.isNull() ) { // draw text int t = s.find( '\t' ); int m = motifItemVMargin; const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; if ( t >= 0 ) { // draw tab text if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); p->setPen( discol ); } p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); s = s.left( t ); } if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t ); p->setPen( discol ); } p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); } else if ( mi->pixmap() ) { // draw pixmap QPixmap *pixmap = mi->pixmap(); if ( pixmap->depth() == 1 ) p->setBackgroundMode( OpaqueMode ); p->drawPixmap( x+xm, y+motifItemFrame, *pixmap ); if ( pixmap->depth() == 1 ) p->setBackgroundMode( TransparentMode ); } if ( mi->popup() ) { // draw sub menu arrow int dim = (h-2*motifItemFrame) / 2; if ( act ) { if ( !dis ) discol = white; QColorGroup g2( discol, g.highlight(), white, white, dis ? discol : white, discol, white ); drawPrimitive(PE_ArrowRight, p, QRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), g2, Style_Enabled); } else { drawPrimitive(PE_ArrowRight, p, QRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), g, !dis ? Style_Enabled : Style_Default); } } } break; default: QWindowsStyle::drawControl( element, p, widget, r, g, flags, opt ); break; } }
void qDrawItem( QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h, int flags, const QColorGroup &g, bool enabled, const QPixmap *pixmap, const QString& text, int len , const QColor* penColor ) { p->setPen( penColor?*penColor:g.foreground() ); if ( pixmap ) { QPixmap pm( *pixmap ); bool clip = (flags & Qt::DontClip) == 0; if ( clip ) { if ( pm.width() < w && pm.height() < h ) clip = FALSE; else p->setClipRect( x, y, w, h ); } if ( (flags & Qt::AlignVCenter) == Qt::AlignVCenter ) y += h/2 - pm.height()/2; else if ( (flags & Qt::AlignBottom) == Qt::AlignBottom) y += h - pm.height(); if ( (flags & Qt::AlignRight) == Qt::AlignRight ) x += w - pm.width(); else if ( (flags & Qt::AlignHCenter) == Qt::AlignHCenter ) x += w/2 - pm.width()/2; else if ( ((flags & Qt::AlignLeft) != Qt::AlignLeft) && QApplication::reverseLayout() ) // AlignAuto && rightToLeft x += w - pm.width(); if ( !enabled ) { if ( pm.mask() ) { // pixmap with a mask if ( !pm.selfMask() ) { // mask is not pixmap itself QPixmap pmm( *pm.mask() ); pmm.setMask( *((QBitmap *)&pmm) ); pm = pmm; } } else if ( pm.depth() == 1 ) { // monochrome pixmap, no mask pm.setMask( *((QBitmap *)&pm) ); #ifndef QT_NO_IMAGE_HEURISTIC_MASK } else { // color pixmap, no mask QString k; k.sprintf( "$qt-drawitem-%x", pm.serialNumber() ); QPixmap *mask = QPixmapCache::find(k); bool del=FALSE; if ( !mask ) { mask = new QPixmap( pm.createHeuristicMask() ); mask->setMask( *((QBitmap*)mask) ); del = !QPixmapCache::insert( k, mask ); } pm = *mask; if (del) delete mask; #endif } if ( gs == Qt::WindowsStyle ) { p->setPen( g.light() ); p->drawPixmap( x+1, y+1, pm ); p->setPen( g.text() ); } } p->drawPixmap( x, y, pm ); if ( clip ) p->setClipping( FALSE ); } else if ( !text.isNull() ) { if ( gs == Qt::WindowsStyle && !enabled ) { p->setPen( g.light() ); p->drawText( x+1, y+1, w, h, flags, text, len ); p->setPen( g.text() ); } p->drawText( x, y, w, h, flags, text, len ); } }
void QLineEdit::paintEvent( QPaintEvent *e ) { if ( !d->pm || d->pmDirty ) { if ( !d->pm ) d->pm = new QPixmap( size() ); QPainter p( d->pm, this ); QColorGroup g = colorGroup(); QColor bg = isEnabled() ? g.base() : g.background(); QFontMetrics fm = fontMetrics(); int markBegin = minMark(); int markEnd = maxMark(); int margin = frame() ? 2 : 0; if ( frame() ) { QBrush fill( bg ); qDrawWinPanel( &p, 0, 0, width(), height(), g, TRUE, &fill ); } else { p.fillRect( 0, 0, width(), height(), bg ); } QString displayText; switch( echoMode() ) { case Normal: displayText = tbuf.mid( offset, tbuf.length() ); break; case NoEcho: displayText = ""; break; case Password: displayText.fill( '*', tbuf.length() - offset ); break; } int ypos = height() - margin - fm.descent() - 1 - (height() - 2*margin - fm.height())/2; if ( !displayText.isEmpty() ) { int charsVisible = lastCharVisible() - offset; if ( displayText[ charsVisible ] != '\0' ) charsVisible++; int mark1,mark2; if ( markBegin > offset ) { if ( markBegin < offset + charsVisible ) mark1 = markBegin - offset; else mark1 = charsVisible; } else { mark1 = 0; } if ( markEnd > offset ) { if ( markEnd < offset + charsVisible ) mark2 = markEnd - offset; else mark2 = charsVisible; } else { mark2 = 0; } // display code comes here - a bit yucky but it works if ( mark1 != mark2 ) { QString marked( displayText.mid( mark1, mark2 - mark1 ) ); int xpos1 = margin + 2 + fm.width( displayText, mark1 ); int xpos2 = xpos1 + fm.width( marked ) - 1; p.fillRect( xpos1, ypos - fm.ascent(), xpos2 - xpos1, fm.height(), style() == WindowsStyle ? QApplication::winStyleHighlightColor() : g.text() ); p.setPen( style() == WindowsStyle ? white : g.base() ); p.drawText( xpos1, ypos, marked ); } p.setPen( g.text() ); if ( mark1 != 0 ) p.drawText( margin + 2, ypos, displayText, mark1 ); if ( mark2 != charsVisible ) { QString rest( displayText.mid( mark2, charsVisible - mark2 ) ); p.drawText( margin + 2 + fm.width( displayText.left( mark2) ), ypos, rest ); } } p.setPen( g.foreground() ); int curXPos = margin + 2; if ( echoMode() != NoEcho ) curXPos += offset > cursorPos ? -1 : // ?: for scrolling case fm.width( displayText, cursorPos - offset ) - 1; int curYPos = ypos - fm.ascent(); d->cursorRepaintRect.setRect( curXPos-2, curYPos, 5, fm.height() ); d->pmDirty = FALSE; } bitBlt( this, e->rect().topLeft(), d->pm, e->rect() ); if ( hasFocus() ) { if ( cursorOn && d->cursorRepaintRect.intersects( e->rect() ) ) { QPainter p( this ); int curYTop = d->cursorRepaintRect.y(); int curYBot = d->cursorRepaintRect.bottom(); int curXPos = d->cursorRepaintRect.x() + 2; p.drawLine( curXPos, curYTop, curXPos, curYBot ); if ( style() != WindowsStyle ) { p.drawLine( curXPos - 2, curYTop, curXPos + 2, curYTop ); p.drawLine( curXPos - 2, curYBot, curXPos + 2, curYBot ); } } } else { delete d->pm; d->pm = 0; } }
void QMultiCheckListItem::paintCell(QPainter *p,const QColorGroup & cg, int col, int width, int align) { if ( !p ) return; QListView *lv = listView(); if ( !lv ) return; QListViewItem::paintCell(p,cg,col,width,align ); int marg = lv->itemMargin(); // int width = BoxSize + marg*2; // use a provate color group and set the text/highlighted text colors QColorGroup mcg = cg; if (checkBoxColumns.testBit(col)) { // Bold/Italic/use default checkboxes // code allmost identical to QCheckListItem Q_ASSERT( lv ); //### // I use the text color of defaultStyles[0], normalcol in parent listview // mcg.setColor( QColorGroup::Text, ((StyleListView*)lv)->normalcol ); int x = 0; if ( align == AlignCenter ) { QFontMetrics fm( lv->font() ); x = (width - BoxSize - fm.width(text(0)))/2; } int y = (height() - BoxSize) / 2; if ( !isEnabled() || disableStates.testBit(col)) p->setPen( QPen( lv->palette().color( QPalette::Disabled, QColorGroup::Text ), 2 ) ); else p->setPen( QPen( mcg.text(), 2 ) ); if ( isSelected() && lv->header()->mapToSection( 0 ) != 0 ) { p->fillRect( 0, 0, x + marg + BoxSize + 4, height(), mcg.brush( QColorGroup::Highlight ) ); if ( isEnabled() ) p->setPen( QPen( mcg.highlightedText(), 2 ) ); // FIXME! - use defaultstyles[0].selecol. luckily not used :) } p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); x++; y++; if ( checkStates.testBit(col) ) { QPointArray a( 7*2 ); int i, xx, yy; xx = x+1+marg; yy = y+5; for ( i=0; i<3; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( i=3; i<7; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } p->drawLineSegments( a ); } } }
void MarkListTable::paintCell( QPainter *p, int row, int col) { QColorGroup cg = QApplication::palette()->normal(); if ( col == 0 ) { if ( items.at( row )->select() ) { //p->setBrush( selectColor ); //p->setPen( selectColor ); p->setBrush(cg.base()); p->setPen(cg.base()); } else { p->setBrush(cg.base()); p->setPen(cg.base()); } p->drawRect(0,0,cellWidth(0),cellHeight()); if( items.at( row )->mark() ) { int xOffset=6; int yOffset=3; if ( items.at( row )->select() ) p->setPen( cg.text() ); //p->setPen( selectTextColor ); else p->setPen( cg.text() ); p->drawLine( xOffset+4, yOffset, xOffset+4, yOffset+9 ); p->setPen( red ); p->drawLine( xOffset+3, yOffset+1, xOffset, yOffset+4 ); p->drawLine( xOffset+3, yOffset+1, xOffset+3, yOffset+4 ); p->drawLine( xOffset, yOffset+4, xOffset+3, yOffset+4 ); } else { int xOffset=4; int yOffset=5; p->setPen( cg.dark() ); p->setBrush( cg.dark() ); p->drawEllipse( xOffset+4, yOffset, 4, 4 ); //p->setPen( cg.mid() ); //p->setBrush( cg.mid() ); //p->drawEllipse( xOffset+5, yOffset+1, 2, 2 ); p->setPen( white ); p->drawPoint( xOffset+5, yOffset+1); } } /*if ( col == 1 ) { if ( items.at( row )->select() ) { p->setBrush(selectColor); p->setPen(selectColor); p->drawRect(0,0,cellWidth(1),cellHeight()); //qDrawShadePanel( p, 3, 2, cellHeight( 1 ) - 6, cellHeight(1)-4, // cg, FALSE, 1, &QBrush(colorGroup().light())); p->setBrush(white); p->setPen(black); p->drawRect(3,2,cellHeight( 1 ) - 7, cellHeight(1)-5); } else { p->setBrush(cg.base()); p->setPen(cg.base()); p->drawRect(0,0,cellWidth(1),cellHeight()); //qDrawShadePanel( p, 3, 2, cellHeight( 1 ) - 6, cellHeight(1)-4, // cg, FALSE,1 ); p->setBrush(white); p->setPen(black); p->drawRect(3,2,cellHeight( 1 ) - 7, cellHeight(1)-5); } //QFontMetrics fm = p->fontMetrics(); //int yPos; // vertical text position //if ( 10 < fm.height() ) // yPos = fm.ascent() + fm.leading()/2; //else // yPos = 5 - fm.height()/2 + fm.ascent(); //p->drawText( 4, yPos, items.at( row )->text() ); }*/ if ( col == 1 ) { if ( items.at( row )->select() ) { p->setBrush(selectColor); p->setPen(selectColor); } else { p->setBrush(cg.base()); p->setPen(cg.base()); } p->drawRect(0,0,cellWidth(2),cellHeight()); /* if ( items.at( row )->select() ) { QColorGroup cg = QApplication::palette()->normal(); qDrawShadePanel( p, 0, 0, cellWidth( 1 ) - 1, cellHeight(), cg, FALSE, 1, &QBrush(colorGroup().light())); }*/ if ( items.at( row )->select() ) p->setPen(selectTextColor); else p->setPen(cg.text()); QFontMetrics fm = p->fontMetrics(); int yPos; // vertical text position /*if ( 10 < fm.height() ) yPos = fm.ascent() + fm.leading()/2; else*/ yPos = cellHeight()-fm.leading()/2; yPos = fm.ascent() + fm.leading()/2+1; p->drawText( 4, yPos, items.at( row )->text() ); } }
void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h) { #ifndef QT_NO_MENUDATA const QColorGroup & g = pal.active(); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); if ( checkable ) maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks int checkcol = maxpmw; if ( mi && mi->isSeparator() ) { // draw separator p->setPen( g.dark() ); p->drawLine( x, y, x+w, y ); p->setPen( g.light() ); p->drawLine( x, y+1, x+w, y+1 ); return; } QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x, y, w, h, fill); if ( !mi ) return; if ( mi->isChecked() ) { if ( act && !dis ) { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Button ) ); } else { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); } } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); } if ( mi->iconSet() ) { // draw iconset QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; if (act && !dis ) mode = QIconSet::Active; QPixmap pixmap; if ( mode == QIconSet::Disabled ) pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); else pixmap = mi->iconSet()->pixmap(); int pixw = pixmap.width(); int pixh = pixmap.height(); if ( act && !dis ) { if ( !mi->isChecked() ) qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); } else if ( checkable ) { // just "checking"... int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; if ( mi->isChecked() ) { drawCheckMark( p, x + motifItemFrame + 2, y+motifItemFrame, mw, mh, itemg, act, dis ); } } p->setPen( act ? g.highlightedText() : g.buttonText() ); QColor discol; if ( dis ) { discol = itemg.text(); p->setPen( discol ); } int xm = motifItemFrame + checkcol + motifItemHMargin; if ( mi->custom() ) { int m = motifItemVMargin; p->save(); if ( dis && !act ) { p->setPen( g.light() ); mi->custom()->paint( p, itemg, act, enabled, x+xm+1, y+m+1, w-xm-tab+1, h-2*m ); p->setPen( discol ); } mi->custom()->paint( p, itemg, act, enabled, x+xm, y+m, w-xm-tab+1, h-2*m ); p->restore(); } QString s = mi->text(); if ( !s.isNull() ) { // draw text int t = s.find( '\t' ); int m = motifItemVMargin; const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; if ( t >= 0 ) { // draw tab text if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); p->setPen( discol ); } p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); } if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t ); p->setPen( discol ); } p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); } else if ( mi->pixmap() ) { // draw pixmap QPixmap *pixmap = mi->pixmap(); if ( pixmap->depth() == 1 ) p->setBackgroundMode( OpaqueMode ); p->drawPixmap( x+xm, y+motifItemFrame, *pixmap ); if ( pixmap->depth() == 1 ) p->setBackgroundMode( TransparentMode ); } if ( mi->popup() ) { // draw sub menu arrow int dim = (h-2*motifItemFrame) / 2; if ( act ) { if ( !dis ) discol = white; QColorGroup g2( discol, g.highlight(), white, white, dis ? discol : white, discol, white ); drawArrow( p, RightArrow, FALSE, x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, dim, dim, g2, TRUE ); } else { drawArrow( p, RightArrow, FALSE, x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, dim, dim, g, mi->isEnabled() ); } } #endif }