本文整理汇总了C++中QColorGroup::brightText方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::brightText方法的具体用法?C++ QColorGroup::brightText怎么用?C++ QColorGroup::brightText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColorGroup
的用法示例。
在下文中一共展示了QColorGroup::brightText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawControl
void MetalStyle::drawControl( ControlElement element,
QPainter *p,
const QWidget *widget,
const QRect &r,
const QColorGroup &cg,
SFlags how,
const QStyleOption& opt ) const
{
switch( element ) {
case CE_PushButton:
{
const QPushButton *btn;
btn = (const QPushButton*)widget;
int x1, y1, x2, y2;
r.coords( &x1, &y1, &x2, &y2 );
p->setPen( cg.foreground() );
p->setBrush( QBrush(cg.button(), NoBrush) );
QBrush fill;
if ( btn->isDown() )
fill = cg.brush( QColorGroup::Mid );
else if ( btn->isOn() )
fill = QBrush( cg.mid(), Dense4Pattern );
else
fill = cg.brush( QColorGroup::Button );
if ( btn->isDefault() ) {
QPointArray a;
a.setPoints( 9,
x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1,
x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 );
p->setPen( Qt::black );
p->drawPolyline( a );
x1 += 2;
y1 += 2;
x2 -= 2;
y2 -= 2;
}
SFlags flags = Style_Default;
if ( btn->isOn() )
flags |= Style_On;
if ( btn->isDown() )
flags |= Style_Down;
if ( !btn->isFlat() && !btn->isDown() )
flags |= Style_Raised;
drawPrimitive( PE_ButtonCommand, p,
QRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1),
cg, flags, opt );
if ( btn->isMenuButton() ) {
flags = Style_Default;
if ( btn->isEnabled() )
flags |= Style_Enabled;
int dx = ( y1 - y2 - 4 ) / 3;
drawPrimitive( PE_ArrowDown, p,
QRect(x2 - dx, dx, y1, y2 - y1),
cg, flags, opt );
}
if ( p->brush().style() != NoBrush )
p->setBrush( NoBrush );
break;
}
case CE_PushButtonLabel:
{
const QPushButton *btn;
btn = (const QPushButton*)widget;
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int x1, y1, x2, y2;
r.coords( &x1, &y1, &x2, &y2 );
int dx = 0;
int dy = 0;
if ( btn->isMenuButton() )
dx = ( y2 - y1 ) / 3;
if ( btn->isOn() || btn->isDown() ) {
dx--;
dy--;
}
if ( dx || dy )
p->translate( dx, dy );
x += 2;
y += 2;
w -= 4;
h -= 4;
drawItem( p, QRect( x, y, w, h ),
AlignCenter|ShowPrefix,
cg, btn->isEnabled(),
btn->pixmap(), btn->text(), -1,
(btn->isDown() || btn->isOn())? &cg.brightText() : &cg.buttonText() );
if ( dx || dy )
p->translate( -dx, -dy );
break;
}
default:
QWindowsStyle::drawControl( element, p, widget, r, cg, how, opt );
//.........这里部分代码省略.........