当前位置: 首页>>代码示例>>C++>>正文


C++ QColorGroup::text方法代码示例

本文整理汇总了C++中QColorGroup::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::text方法的具体用法?C++ QColorGroup::text怎么用?C++ QColorGroup::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QColorGroup的用法示例。


在下文中一共展示了QColorGroup::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HTMLColors

    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	
    };
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:56,代码来源:helper.cpp

示例2: paintCell

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());

	}
}
开发者ID:Universefei,项目名称:Terralib-analysis,代码行数:35,代码来源:TeQtBigTable.cpp

示例3: paint

	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);
		}
	}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:35,代码来源:canvaswidget.cpp

示例4: paintCell

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);
}
开发者ID:Voker57,项目名称:psi,代码行数:25,代码来源:optionsdlg.cpp

示例5: paintCell

  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);
  }
开发者ID:iegor,项目名称:kdesktop,代码行数:26,代码来源:domtreeview.cpp

示例6: paint

/**
 * @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 );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:37,代码来源:ocheckitem.cpp

示例7: drawExclusiveIndicator

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 );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:33,代码来源:fresh.cpp

示例8: paintCell

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;
}
开发者ID:WMFO,项目名称:rivendell,代码行数:32,代码来源:list_listviewitem.cpp

示例9: paintCell

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);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:44,代码来源:driveritem.cpp

示例10: init

// A ctor.
QsciStyle::QsciStyle(int style)
{
    init(style);

    QColorGroup cg = QApplication::palette().active();
    setColor(cg.text());
    setPaper(cg.base());

    setFont(QApplication::font());
    setEolFill(false);
}
开发者ID:paralect,项目名称:robomongo-deps,代码行数:12,代码来源:qscistyle.cpp

示例11: paint

/** 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);
}
开发者ID:perihelion,项目名称:basket,代码行数:53,代码来源:linklabel.cpp

示例12: paintCell

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));
    }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:18,代码来源:kpopmenu.cpp

示例13: drawIndicator

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
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:44,代码来源:qwindowsstyle.cpp

示例14: paint

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() );
}
开发者ID:petrpopov,项目名称:transactions,代码行数:21,代码来源:cell.cpp

示例15: flagPixmap

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;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:22,代码来源:marklist.cpp


注:本文中的QColorGroup::text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。