本文整理汇总了C++中QColorGroup::setBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::setBrush方法的具体用法?C++ QColorGroup::setBrush怎么用?C++ QColorGroup::setBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColorGroup
的用法示例。
在下文中一共展示了QColorGroup::setBrush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapToInactivePixmapRole
void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm )
{
QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem());
QColorGroup cg = editPalette.inactive();
if ( !pm.isNull() )
cg.setBrush( role, QBrush( cg.color( role ), pm ) );
else
cg.setBrush( role, QBrush( cg.color( role ) ) );
editPalette.setInactive( cg );
setPreviewPalette( editPalette );
}
示例2: mapToActivePixmapRole
void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm )
{
QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem());
QColorGroup cg = editPalette.active();
if ( !pm.isNull() )
cg.setBrush( role, QBrush( cg.color( role ), pm ) );
else
cg.setBrush( role, QBrush( cg.color( role ) ) );
editPalette.setActive( cg );
buildActiveEffect();
if(checkBuildInactive->isChecked())
buildInactive();
if(checkBuildDisabled->isChecked())
buildDisabled();
setPreviewPalette( editPalette );
}
示例3: drawPrimitive
/*!\reimp
*/
void QPlatinumStyle::drawPrimitive( PrimitiveElement pe,
QPainter *p,
const QRect &r,
const QColorGroup &cg,
SFlags flags,
const QStyleOption& opt ) const
{
switch (pe) {
case PE_HeaderSection:
{
// adjust the sunken flag, otherwise headers are drawn
// sunken...
if ( flags & Style_Sunken )
flags ^= Style_Sunken;
drawPrimitive( PE_ButtonBevel, p, r, cg, flags, opt );
break;
}
case PE_ButtonTool:
{
// tool buttons don't change color when pushed in platinum,
// so we need to make the mid and button color the same
QColorGroup myCG = cg;
QBrush fill;
// quick trick to make sure toolbuttons drawn sunken
// when they are activated...
if ( flags & Style_On )
flags |= Style_Sunken;
fill = myCG.brush( QColorGroup::Button );
myCG.setBrush( QColorGroup::Mid, fill );
drawPrimitive( PE_ButtonBevel, p, r, myCG, flags, opt );
break;
}
case PE_ButtonBevel:
{
int x,
y,
w,
h;
r.rect( &x, &y, &w, &h );
QPen oldPen = p->pen();
if ( w * h < 1600 ||
QABS(w - h) > 10 ) {
// small buttons
if ( !(flags & (Style_Sunken | Style_Down)) ) {
p->fillRect( x + 2, y + 2, w - 4, h - 4,
cg.brush(QColorGroup::Button) );
// the bright side
p->setPen( cg.dark() );
// the bright side
p->setPen( cg.dark() );
p->drawLine( x, y, x + w - 1, y );
p->drawLine( x, y, x, y + h - 1 );
p->setPen( cg.light() );
p->drawLine( x + 1, y + 1, x + w - 2, y + 1 );
p->drawLine( x + 1, y + 1, x + 1, y + h - 2 );
// the dark side
p->setPen( cg.mid() );
p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 );
p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 3 );
p->setPen( cg.dark().dark() );
p->drawLine( x + 1, y + h - 1, x + w - 1,
y + h - 1 );
p->drawLine( x + w - 1, y + 1,
x + w - 1,
y + h - 2 );
} else {
p->fillRect(x + 2, y + 2,
w - 4, h - 4,
cg.brush( QColorGroup::Mid ));
// the dark side
p->setPen( cg.dark().dark() );
p->drawLine( x, y, x + w - 1, y );
p->drawLine( x, y, x, y + h - 1 );
p->setPen( cg.mid().dark());
p->drawLine( x + 1, y + 1,
x + w-2, y + 1);
p->drawLine( x + 1, y + 1,
x + 1, y + h - 2 );
// the bright side!
p->setPen(cg.button());
p->drawLine( x + 1, y + h - 2,
x + w - 2,
y + h - 2 );
p->drawLine( x + w - 2, y + 1,
x + w - 2,
y + h - 2 );
//.........这里部分代码省略.........