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


C++ QColorGroup类代码示例

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


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

示例1: QMAX

/*!
  Draw a compass needle 
*/
void QwtCompassMagnetNeedle::drawThinNeedle(
    QPainter *painter, const QColorGroup &cg,
    const QPoint &center, int length, double direction) 
{
    const int colorOffset = 10;
    const int width = QMAX(qRound(length / 6.0), 3);

    painter->save();

    const QPoint arrowCenter(center.x() + 1, center.y() + 1);

    drawPointer(painter, cg.brush(QColorGroup::Dark), colorOffset, 
        arrowCenter, length, width, direction);
    drawPointer(painter, cg.brush(QColorGroup::Light), -colorOffset, 
        arrowCenter, length, width, direction + 180.0);
    
    drawKnob(painter, arrowCenter, width, 
        cg.brush(QColorGroup::Base), TRUE);

    painter->restore();
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:24,代码来源:qwt_dial_needle.cpp

示例2: 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

示例3: feedbackPixmap

QPixmap LinkDisplay::feedbackPixmap(int width, int height, const QColorGroup &colorGroup, bool isDefaultColor)
{
	int theWidth  = qMin(width, maxWidth());
	int theHeight = qMin(height, heightForWidth(theWidth));
	QPixmap pixmap(theWidth, theHeight);
	pixmap.fill(colorGroup.background());
	QPainter painter(&pixmap);
	paint(&painter, 0, 0, theWidth, theHeight, colorGroup, isDefaultColor,
	      /*isSelected=*/false, /*isHovered=*/false, /*isIconButtonHovered=*/false);
	painter.end();
	return pixmap;
}
开发者ID:perihelion,项目名称:basket,代码行数:12,代码来源:linklabel.cpp

示例4: 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

示例5: drawBevelButton

void FreshStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
				     const QColorGroup &g, bool sunken,
				     bool /*editable*/,
				     bool enabled,
				     const QBrush *fill )
{
    drawBevelButton( p, x, y, w, h, g, FALSE, fill );
    drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill );
    drawArrow( p, QStyle::DownArrow, sunken,
	       x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled,
	       &g.brush( QColorGroup::Button ) );

}
开发者ID:opieproject,项目名称:opie,代码行数:13,代码来源:fresh.cpp

示例6: drawCheckMark

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

示例7: listView

//////////////////////////////////////////////////////////////////////////////////////////
/// CLASS QueueItem
//////////////////////////////////////////////////////////////////////////////////////////
void
QueueItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
    KListViewItem::paintCell( p, cg, column, width, align );

    QString str = QString::number( ( static_cast<KListView *>( listView() ) )->itemIndex( this ) + 1 );

    //draw the symbol's outline
    uint fw = p->fontMetrics().width( str ) + 2;
    const uint w  = 16; //keep this even
    const uint h  = height() - 2;

    p->setBrush( cg.highlight() );
    p->setPen( cg.highlight().dark() ); //TODO blend with background color
    p->drawEllipse( width - fw - w/2, 1, w, h );
    p->drawRect( width - fw, 1, fw, h );
    p->setPen( cg.highlight() );
    p->drawLine( width - fw, 2, width - fw, h - 1 );

    fw += 2; //add some more padding
    p->setPen( cg.highlightedText() );
    p->drawText( width - fw, 2, fw, h-1, Qt::AlignCenter, str );
}
开发者ID:tmarques,项目名称:waheela,代码行数:26,代码来源:queuemanager.cpp

示例8: mycg

void FreshStyle::drawIndicator ( QPainter * p, int x, int y, int w, int h,
	const QColorGroup &cg, int state, bool down, bool enabled )
{
    QColorGroup mycg( cg );
    mycg.setBrush( QColorGroup::Button, QBrush() );
    QBrush fill;
    drawButton( p, x, y, w, h, mycg, TRUE, 0 );
    if ( down )
	fill = cg.brush( QColorGroup::Button );
    else
	fill = cg.brush( enabled ? QColorGroup::Base : QColorGroup::Background );
    mycg.setBrush( QColorGroup::Button, fill );
    p->fillRect( x+1, y+1, w-2, h-2, fill );
    if ( state != 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 ( state == QButton::NoChange ) {
	    p->setPen( mycg.dark() );
	} else {
	    p->setPen( mycg.text() );
	}
	p->drawLineSegments( a );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:37,代码来源:fresh.cpp

示例9: drawButton

void FreshStyle::drawButton( QPainter *p, int x, int y, int w, int h,
                                const QColorGroup &cg, bool sunken, const QBrush* fill )
{
    QPen oldPen = p->pen();
    int off = sunken ? 1 : 0;
    p->fillRect( x+1+off, y+1+off, w-3, h-3, fill?(*fill):cg.brush(QColorGroup::Button) );

    int x2 = x+w-1;
    int y2 = y+h-1;

    if ( sunken )
	p->setPen( cg.dark() );
    else
	p->setPen( cg.light() );
    p->drawLine( x, y, x, y2-1 );
    p->drawLine( x, y, x2, y );

    if ( sunken ) {
	p->setPen( white );
	p->drawLine( x+1, y+1, x+1, y2-2 );
	p->drawLine( x+1, y+1, x2-2, y+1 );
    }

    if ( sunken )
	p->setPen( cg.light() );
    else
	p->setPen( cg.dark() );
    p->drawLine( x2, y+1, x2, y2 );
    p->drawLine( x, y2, x2, y2 );

    if ( !sunken ) {
	p->setPen( white );
	p->drawLine( x2-1, y+1, x2-1, y2-1 );
	p->drawLine( x+1, y2-1, x2-1, y2-1 );
    }
    p->setPen( oldPen );
}
开发者ID:opieproject,项目名称:opie,代码行数:37,代码来源:fresh.cpp

示例10: id

/*!
  Paint an axis

  \param painter Painter
  \param axisId Axis id (QwtPolar::Axis)
*/
void QwtPolarGrid::drawAxis( QPainter *painter, int axisId ) const
{
  if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
    return;

  AxisData &axis = d_data->axisData[axisId];

  painter->setPen( axis.pen );
  painter->setFont( axis.font );

#if QT_VERSION < 0x040000
  QColorGroup cg;
  cg.setColor( QColorGroup::Foreground, axis.pen.color() );
  cg.setColor( QColorGroup::Text, axis.pen.color() );

  axis.scaleDraw->draw( painter, cg );
#else
  QPalette pal;
  pal.setColor( QPalette::Foreground, axis.pen.color() );
  pal.setColor( QPalette::Text, axis.pen.color() );

  axis.scaleDraw->draw( painter, pal );
#endif
}
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:30,代码来源:qwt_polar_grid.cpp

示例11: QBrush

void QSimpleRichText::draw( QPainter *p,  int x, int y, const QRect& clipRect,
			    const QColorGroup& cg, const QBrush* paper ) const
{
    p->save();
    if ( d->cachedWidth < 0 )
	d->adjustSize(p);

    QRect r = clipRect;
    if ( !r.isNull() )
	r.moveBy( -x, -y );

    if ( paper )
	d->doc->setPaper( new QBrush( *paper ) );
    QColorGroup g = cg;
    if ( d->doc->paper() )
	g.setBrush( QColorGroup::Base, *d->doc->paper() );

    if ( !clipRect.isNull() )
	p->setClipRect( clipRect, QPainter::CoordPainter );
    p->translate( x, y );
    d->doc->draw( p, r, g, paper );
    p->translate( -x, -y );
    p->restore();
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:24,代码来源:qsimplerichtext.cpp

示例12: FLAccessControl

FLAccessControlForm::FLAccessControlForm() : FLAccessControl() {
  QColorGroup cg;
  QColor bg = qApp->palette().color( QPalette::Active, QColorGroup::Background );
  cg.setColor( QColorGroup::Foreground, bg );
  cg.setColor( QColorGroup::Text, bg );
  cg.setColor( QColorGroup::ButtonText, bg );
  cg.setColor( QColorGroup::Base, bg );
  cg.setColor( QColorGroup::Background, bg );
  pal.setDisabled( cg );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:10,代码来源:FLAccessControlFactory.cpp

示例13: drawViewer

void PColorButton::drawViewer(QPainter* p, const QColorGroup& cg, const QRect& r, const QVariant& value)
{
/*    p->setBrush(value.toColor());
    p->setPen(Qt::NoPen);
    p->drawRect(r);*/
    p->setPen(Qt::NoPen);
    p->setBrush(cg.background());
    p->drawRect(r);

    p->setBrush(value.toColor());
    p->setPen(Qt::SolidLine);
    QRect r2(r);
    r2.setTopLeft(r.topLeft() + QPoint(5,5));
    r2.setBottomRight(r.bottomRight() - QPoint(5,5));
    p->drawRect(r2);
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:16,代码来源:pcolorbutton.cpp

示例14: drawWinShades

void
QWindowsStyle::drawPanel( QPainter *p, int x, int y, int w, int h,
		const QColorGroup &g, bool sunken,
		   int lineWidth, const QBrush* fill)
{
    if ( lineWidth == 2 ) {
	if (sunken)
	    drawWinShades( p, x, y, w, h,
			   g.dark(), g.light(), g.shadow(), g.midlight(),
			   fill );
	else
	    drawWinShades( p, x, y, w, h,
			   g.light(), g.shadow(), g.midlight(), g.dark(),
			   fill );
    }
    else
	QStyle::drawPanel( p, x, y, w, h, g, sunken, lineWidth, fill );
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:18,代码来源:qwindowsstyle.cpp

示例15: 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


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