本文整理汇总了C++中QColorGroup::shadow方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::shadow方法的具体用法?C++ QColorGroup::shadow怎么用?C++ QColorGroup::shadow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColorGroup
的用法示例。
在下文中一共展示了QColorGroup::shadow方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDrawWinPanel
void qDrawWinPanel( QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken,
const QBrush *fill )
{
if ( sunken )
qDrawWinShades( p, x, y, w, h,
g.dark(), g.light(), g.shadow(), g.midlight(), fill );
else
qDrawWinShades( p, x, y, w, h,
g.light(), g.shadow(), g.midlight(), g.dark(), fill );
}
示例2: drawButton
/*!
Draws a press-sensitive shape.
*/
void QWindowsStyle::drawButton( QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken, const QBrush* fill)
{
if (sunken)
drawWinShades( p, x, y, w, h,
g.shadow(), g.light(), g.dark(), g.button(),
fill?fill: &g.brush( QColorGroup::Button ) );
else
drawWinShades( p, x, y, w, h,
g.light(), g.shadow(), g.button(), g.dark(),
fill?fill:&g.brush( QColorGroup::Button ) );
}
示例3: drawComboButton
/*!\reimp
*/
void QWindowsStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken ,
bool /* editable */,
bool enabled,
const QBrush *fill )
{
qDrawWinPanel(p, x, y, w, h, g, TRUE,
fill?fill:(enabled?&g.brush( QColorGroup::Base ):
&g.brush( QColorGroup::Background )));
// the special reversed left shadow panel ( slightly different from drawPanel() )
//qDrawWinPanel(p, w-2-16,2,16,h-4, g, sunken);
// #### DO SUNKEN!
if ( sunken )
drawWinShades( p, x+w-2-16, y+2, 16, h-4,
g.dark(), g.dark(), g.button(), g.button(),
fill ? fill : &g.brush( QColorGroup::Button ) );
else
drawWinShades( p, x+w-2-16, y+2, 16, h-4,
g.midlight(), g.shadow(), g.light(), g.dark(),
fill ? fill : &g.brush( QColorGroup::Button ) );
drawArrow( p, QStyle::DownArrow, sunken,
x+w-2-16+ 2, y+2+ 2, 16- 4, h-4- 4, g, enabled,
fill ? fill : &g.brush( QColorGroup::Button ) );
}
示例4: drawSliderGroove
/*!\reimp
*/
void QWindowsStyle::drawSliderGroove( QPainter *p,
int x, int y, int w, int h,
const QColorGroup& g, QCOORD c,
Orientation orient )
{
if ( orient == Horizontal ) {
qDrawWinPanel( p, x, y + c - 2, w, 4, g, TRUE );
p->setPen( g.shadow() );
p->drawLine( x+1, y + c - 1, x + w - 3, y + c - 1 );
} else {
qDrawWinPanel( p, x + c - 2, y, 4, h, g, TRUE );
p->setPen( g.shadow() );
p->drawLine( x + c - 1, y + 1, x + c - 1, y + h - 3 );
}
}
示例5: fill
/*!\reimp
*/
void
QWindowsStyle::drawPushButton( QPushButton* btn, QPainter *p)
{
#ifndef QT_NO_PUSHBUTTON
QColorGroup g = btn->colorGroup();
int x1, y1, x2, y2;
btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates
p->setPen( g.foreground() );
p->setBrush( QBrush(g.button(),NoBrush) );
int diw = buttonDefaultIndicatorWidth();
if ( btn->isDefault() || btn->autoDefault() ) {
if ( btn->isDefault() ) {
p->setPen( g.shadow() );
p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
}
x1 += diw;
y1 += diw;
x2 -= diw;
y2 -= diw;
}
bool clearButton = TRUE;
if ( btn->isDown() ) {
if ( btn->isDefault() ) {
p->setPen( g.dark() );
p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
} else {
drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE,
&g.brush( QColorGroup::Button ) );
}
} else {
if ( btn->isToggleButton() && btn->isOn() && btn->isEnabled() ) {
QBrush fill(g.light(), Dense4Pattern );
drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE, &fill );
clearButton = FALSE;
} else {
if ( !btn->isFlat() )
drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, btn->isOn(),
&g.brush( QColorGroup::Button ) );
}
}
if ( clearButton ) {
if (btn->isDown())
p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
p->fillRect( x1+2, y1+2, x2-x1-3, y2-y1-3,
g.brush( QColorGroup::Button ) );
if (btn->isDown())
p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
}
if ( p->brush().style() != NoBrush )
p->setBrush( NoBrush );
#endif
}
示例6: 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 );
}
示例7: 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
};
示例8: drawExclusiveIndicator
void QWindowsStyle::drawExclusiveIndicator( QPainter* p,
int x, int y, int w, int h, const QColorGroup &g,
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 pts2[] = { // black lines
2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 };
static const QCOORD pts3[] = { // background lines
2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 };
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), pts1 );
a.translate( x, y );
p->setPen( g.dark() );
p->drawPolyline( a );
a.setPoints( QCOORDARRLEN(pts2), pts2 );
a.translate( x, y );
p->setPen( g.shadow() );
p->drawPolyline( a );
a.setPoints( QCOORDARRLEN(pts3), pts3 );
a.translate( x, y );
p->setPen( g.midlight() );
p->drawPolyline( a );
a.setPoints( QCOORDARRLEN(pts4), pts4 );
a.translate( x, y );
p->setPen( g.light() );
p->drawPolyline( a );
a.setPoints( QCOORDARRLEN(pts5), pts5 );
a.translate( x, y );
QColor fillColor = ( down || !enabled ) ? g.button() : g.base();
p->setPen( fillColor );
p->setBrush( fillColor ) ;
p->drawPolygon( a );
if ( on ) {
p->setPen( NoPen );
p->setBrush( g.text() );
p->drawRect( x+5, y+4, 2, 4 );
p->drawRect( x+4, y+5, 4, 2 );
}
}
示例9: qDrawShadePanel
void qDrawShadePanel( QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken,
int lineWidth, const QBrush *fill )
{
if ( w == 0 || h == 0 )
return;
if ( !( w > 0 && h > 0 && lineWidth >= 0 ) ) {
#if defined(QT_CHECK_RANGE)
qWarning( "qDrawShadePanel() Invalid parameters." );
#endif
}
QColor shade = g.dark();
QColor light = g.light();
if ( fill ) {
if ( fill->color() == shade )
shade = g.shadow();
if ( fill->color() == light )
light = g.midlight();
}
QPen oldPen = p->pen(); // save pen
QPointArray a( 4*lineWidth );
if ( sunken )
p->setPen( shade );
else
p->setPen( light );
int x1, y1, x2, y2;
int i;
int n = 0;
x1 = x;
y1 = y2 = y;
x2 = x+w-2;
for ( i=0; i<lineWidth; i++ ) { // top shadow
a.setPoint( n++, x1, y1++ );
a.setPoint( n++, x2--, y2++ );
}
x2 = x1;
y1 = y+h-2;
for ( i=0; i<lineWidth; i++ ) { // left shadow
a.setPoint( n++, x1++, y1 );
a.setPoint( n++, x2++, y2-- );
}
p->drawLineSegments( a );
n = 0;
if ( sunken )
p->setPen( light );
else
p->setPen( shade );
x1 = x;
y1 = y2 = y+h-1;
x2 = x+w-1;
for ( i=0; i<lineWidth; i++ ) { // bottom shadow
a.setPoint( n++, x1++, y1-- );
a.setPoint( n++, x2, y2-- );
}
x1 = x2;
y1 = y;
y2 = y+h-lineWidth-1;
for ( i=0; i<lineWidth; i++ ) { // right shadow
a.setPoint( n++, x1--, y1++ );
a.setPoint( n++, x2--, y2 );
}
p->drawLineSegments( a );
if ( fill ) { // fill with fill color
QBrush oldBrush = p->brush();
p->setPen( Qt::NoPen );
p->setBrush( *fill );
p->drawRect( x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2 );
p->setBrush( oldBrush );
}
p->setPen( oldPen ); // restore pen
}
示例10: drawScrollBarControls
void FreshStyle::drawScrollBarControls( QPainter* p, const QScrollBar* sb, int sliderStart, uint controls, uint activeControl )
{
#define ADD_LINE_ACTIVE ( activeControl == AddLine )
#define SUB_LINE_ACTIVE ( activeControl == SubLine )
QColorGroup g = sb->colorGroup();
int sliderMin, sliderMax, sliderLength, buttonDim;
scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
if ( controls == (AddLine | SubLine | AddPage | SubPage | Slider | First | Last ) )
p->fillRect( 0, 0, sb->width(), sb->height(), g.brush( QColorGroup::Mid ));
if (sliderStart > sliderMax) { // sanity check
sliderStart = sliderMax;
}
int dimB = buttonDim;
QRect addB;
QRect subB;
QRect addPageR;
QRect subPageR;
QRect sliderR;
int addX, addY, subX, subY;
int length = HORIZONTAL ? sb->width() : sb->height();
int extent = HORIZONTAL ? sb->height() : sb->width();
if ( HORIZONTAL ) {
subY = addY = ( extent - dimB ) / 2;
subX = length - dimB - dimB;
addX = length - dimB;
} else {
subX = addX = ( extent - dimB ) / 2;
subY = length - dimB - dimB;
addY = length - dimB;
}
int sliderEnd = sliderStart + sliderLength;
int sliderW = extent;
if ( HORIZONTAL ) {
subB.setRect( subX,subY+1,dimB,dimB-1 );
addB.setRect( addX,addY+1,dimB,dimB-1 );
subPageR.setRect( 0, 0,
sliderStart+1, sliderW );
addPageR.setRect( sliderEnd-1, 0, subX - sliderEnd+1, sliderW );
sliderR .setRect( sliderStart, 1, sliderLength, sliderW-1 );
} else {
subB.setRect( subX+1,subY,dimB-1,dimB );
addB.setRect( addX+1,addY,dimB-1,dimB );
subPageR.setRect( 0, 0, sliderW,
sliderStart+1 );
addPageR.setRect( 0, sliderEnd-1, sliderW, subY - sliderEnd+1 );
sliderR .setRect( 1, sliderStart, sliderW-1, sliderLength );
}
bool maxedOut = (sb->maxValue() == sb->minValue());
if ( controls & AddLine ) {
drawBevelButton( p, addB.x(), addB.y(),
addB.width(), addB.height(), g,
ADD_LINE_ACTIVE);
p->setPen(g.shadow());
drawArrow( p, VERTICAL ? DownArrow : RightArrow,
FALSE, addB.x()+2, addB.y()+2,
addB.width()-4, addB.height()-4, g, !maxedOut,
&g.brush( QColorGroup::Button ));
}
if ( controls & SubLine ) {
drawBevelButton( p, subB.x(), subB.y(),
subB.width(), subB.height(), g,
SUB_LINE_ACTIVE );
p->setPen(g.shadow());
drawArrow( p, VERTICAL ? UpArrow : LeftArrow,
FALSE, subB.x()+2, subB.y()+2,
subB.width()-4, subB.height()-4, g, !maxedOut,
&g.brush( QColorGroup::Button ));
}
if ( controls & SubPage )
p->fillRect( subPageR.x(), subPageR.y(), subPageR.width(),
subPageR.height(), g.brush( QColorGroup::Mid ));
if ( controls & AddPage )
p->fillRect( addPageR.x(), addPageR.y(), addPageR.width(),
addPageR.height(), g.brush( QColorGroup::Mid ));
if ( controls & Slider ) {
QPoint bo = p->brushOrigin();
p->setBrushOrigin(sliderR.topLeft());
drawBevelButton( p, sliderR.x(), sliderR.y(),
sliderR.width(), sliderR.height(), g,
FALSE, &g.brush( QColorGroup::Button ) );
p->setBrushOrigin(bo);
drawRiffles( p, sliderR.x(), sliderR.y(),
sliderR.width(), sliderR.height(), g, HORIZONTAL );
}
// ### perhaps this should not be able to accept focus if maxedOut?
if ( sb->hasFocus() && (controls & Slider) )
p->drawWinFocusRect( sliderR.x()+2, sliderR.y()+2,
//.........这里部分代码省略.........
示例11: drawSlider
/*!\reimp
*/
void QWindowsStyle::drawSlider( QPainter *p,
int x, int y, int w, int h,
const QColorGroup &g,
Orientation orient, bool tickAbove, bool tickBelow )
{
#ifndef QT_NO_SLIDER
// 4444440
// 4333310
// 4322210
// 4322210
// 4322210
// 4322210
// *43210*
// **410**
// ***0***
const QColor c0 = g.shadow();
const QColor c1 = g.dark();
// const QColor c2 = g.button();
const QColor c3 = g.midlight();
const QColor c4 = g.light();
int x1 = x;
int x2 = x+w-1;
int y1 = y;
int y2 = y+h-1;
p->fillRect( x, y, w, h, g.brush( QColorGroup::Background ) );
if ( tickAbove && tickBelow || !tickAbove && !tickBelow ) {
qDrawWinButton( p, QRect(x,y,w,h), g, FALSE,
&g.brush( QColorGroup::Button ) );
return;
}
enum { SlUp, SlDown, SlLeft, SlRight } dir;
if ( orient == Horizontal )
if ( tickAbove )
dir = SlUp;
else
dir = SlDown;
else
if ( tickAbove )
dir = SlLeft;
else
dir = SlRight;
QPointArray a;
int d = 0;
switch ( dir ) {
case SlUp:
y1 = y1 + w/2;
d = (w + 1) / 2 - 1;
a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d );
break;
case SlDown:
y2 = y2 - w/2;
d = (w + 1) / 2 - 1;
a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1 );
break;
case SlLeft:
d = (h + 1) / 2 - 1;
x1 = x1 + h/2;
a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1);
break;
case SlRight:
d = (h + 1) / 2 - 1;
x2 = x2 - h/2;
a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1 );
break;
}
QBrush oldBrush = p->brush();
p->setBrush( g.brush( QColorGroup::Button ) );
p->setPen( NoPen );
p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
p->drawPolygon( a );
p->setBrush( oldBrush );
if ( dir != SlUp ) {
p->setPen( c4 );
p->drawLine( x1, y1, x2, y1 );
p->setPen( c3 );
p->drawLine( x1, y1+1, x2, y1+1 );
}
if ( dir != SlLeft ) {
p->setPen( c3 );
p->drawLine( x1+1, y1+1, x1+1, y2 );
p->setPen( c4 );
//.........这里部分代码省略.........
示例12: drawScrollBarControls
/*!\reimp
*/
void QWindowsStyle::drawScrollBarControls( QPainter* p, const QScrollBar* sb, int sliderStart, uint controls, uint activeControl )
{
#ifndef QT_NO_SCROLLBAR
#define ADD_LINE_ACTIVE ( activeControl == AddLine )
#define SUB_LINE_ACTIVE ( activeControl == SubLine )
QColorGroup g = sb->colorGroup();
int sliderMin, sliderMax, sliderLength, buttonDim;
scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
if (sliderStart > sliderMax) { // sanity check
sliderStart = sliderMax;
}
int b = 0;
int dimB = buttonDim;
QRect addB;
QRect subB;
QRect addPageR;
QRect subPageR;
QRect sliderR;
int addX, addY, subX, subY;
int length = HORIZONTAL ? sb->width() : sb->height();
int extent = HORIZONTAL ? sb->height() : sb->width();
if ( HORIZONTAL ) {
subY = addY = ( extent - dimB ) / 2;
subX = b;
addX = length - dimB - b;
} else {
subX = addX = ( extent - dimB ) / 2;
subY = b;
addY = length - dimB - b;
}
subB.setRect( subX,subY,dimB,dimB );
addB.setRect( addX,addY,dimB,dimB );
int sliderEnd = sliderStart + sliderLength;
int sliderW = extent - b*2;
if ( HORIZONTAL ) {
subPageR.setRect( subB.right() + 1, b,
sliderStart - subB.right() - 1 , sliderW );
addPageR.setRect( sliderEnd, b, addX - sliderEnd, sliderW );
sliderR .setRect( sliderStart, b, sliderLength, sliderW );
} else {
subPageR.setRect( b, subB.bottom() + 1, sliderW,
sliderStart - subB.bottom() - 1 );
addPageR.setRect( b, sliderEnd, sliderW, addY - sliderEnd );
sliderR .setRect( b, sliderStart, sliderW, sliderLength );
}
bool maxedOut = (sb->maxValue() == sb->minValue());
if ( controls & AddLine ) {
qDrawWinPanel( p, addB.x(), addB.y(),
addB.width(), addB.height(), g,
ADD_LINE_ACTIVE, &g.brush( QColorGroup::Button ) );
drawArrow( p, VERTICAL ? DownArrow : RightArrow,
ADD_LINE_ACTIVE, addB.x()+2, addB.y()+2,
addB.width()-4, addB.height()-4, g, !maxedOut );
}
if ( controls & SubLine ) {
qDrawWinPanel( p, subB.x(), subB.y(),
subB.width(), subB.height(), g,
SUB_LINE_ACTIVE, &g.brush( QColorGroup::Button ) );
drawArrow( p, VERTICAL ? UpArrow : LeftArrow,
SUB_LINE_ACTIVE, subB.x()+2, subB.y()+2,
subB.width()-4, subB.height()-4, g, !maxedOut );
}
QBrush br =
g.brush( QColorGroup::Light ).pixmap() ?
g.brush( QColorGroup::Light ) :
QBrush(g.light(), Dense4Pattern);
p->setBrush( br );
p->setPen( NoPen );
p->setBackgroundMode( OpaqueMode );
if ( maxedOut ) {
p->drawRect( sliderR );
} else {
if ( (controls & SubPage && SubPage == activeControl) ||
(controls & AddPage && AddPage == activeControl) ) {
QBrush b = p->brush();
QColor c = p->backgroundColor();
// p->fillRect( AddPage == activeControl? addPageR : subPageR, g.fillDark() );
p->setBackgroundColor( g.dark() );
p->setBrush( QBrush(g.shadow(), Dense4Pattern) );
p->drawRect( AddPage == activeControl? addPageR : subPageR );
p->setBackgroundColor( c );
p->setBrush( b );
}
if ( controls & SubPage && SubPage != activeControl)
p->drawRect( subPageR );
if ( controls & AddPage && AddPage != activeControl)
p->drawRect( addPageR );
if ( controls & Slider ) {
if ( !maxedOut ) {
QPoint bo = p->brushOrigin();
if ( !sb->testWState(WState_GlobalBrushOrigin) )
//.........这里部分代码省略.........
示例13: drawComplexControl
/*!\reimp
*/
void QPlatinumStyle::drawComplexControl( ComplexControl control,
QPainter *p,
const QWidget *widget,
const QRect &r,
const QColorGroup &cg,
SFlags how,
SCFlags sub,
SCFlags subActive,
const QStyleOption& opt ) const
{
switch ( control ) {
case CC_ComboBox:
{
int x,
y,
w,
h;
r.rect( &x, &y, &w, &h );
p->fillRect( x + 2, y + 2, w - 4,
h - 4, cg.brush(QColorGroup::Button) );
// the bright side
p->setPen(cg.shadow());
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 - 2 );
p->setPen (cg.shadow() );
p->drawLine( x + 1, y + h - 1,
x + w - 1, y + h - 1 );
p->drawLine( x + w - 1, y,
x + w - 1, y + h - 1 );
// top left corner:
p->setPen( cg.background() );
p->drawPoint( x, y );
p->drawPoint( x + 1, y );
p->drawPoint( x, y + 1 );
p->setPen( cg.shadow() );
p->drawPoint( x + 1, y + 1 );
p->setPen( white );
p->drawPoint( x + 3, y + 3 );
// bottom left corner:
p->setPen( cg.background() );
p->drawPoint( x, y + h - 1 );
p->drawPoint( x + 1, y + h - 1 );
p->drawPoint( x, y + h - 2 );
p->setPen( cg.shadow() );
p->drawPoint( x + 1, y + h - 2 );
// top right corner:
p->setPen( cg.background() );
p->drawPoint( x + w - 1, y );
p->drawPoint( x + w - 2, y );
p->drawPoint( x + w - 1, y + 1 );
p->setPen( cg.shadow() );
p->drawPoint( x + w - 2, y + 1 );
// bottom right corner:
p->setPen( cg.background() );
p->drawPoint( x + w - 1, y + h - 1 );
p->drawPoint( x + w - 2, y + h - 1 );
p->drawPoint( x + w - 1, y + h - 2 );
p->setPen( cg.shadow() );
p->drawPoint( x + w - 2, y + h - 2 );
p->setPen( cg.dark() );
p->drawPoint( x + w - 3, y + h - 3 );
if ( sub & SC_ComboBoxArrow ) {
QRect rTmp = querySubControlMetrics( CC_ComboBox, widget,
SC_ComboBoxArrow, opt );
int xx = rTmp.x(),
yy = rTmp.y(),
ww = rTmp.width(),
hh = rTmp.height();
// the bright side
p->setPen( cg.mid() );
p->drawLine( xx, yy+2, xx, yy+hh-3 );
p->setPen( cg.button() );
p->drawLine( xx+1, yy+1, xx+ww-2, yy+1 );
p->drawLine( xx+1, yy+1, xx+1, yy+hh-2 );
p->setPen( cg.light() );
p->drawLine( xx+2, yy+2, xx+2, yy+hh-2 );
p->drawLine( xx+2, yy+2, xx+ww-2, yy+2 );
//.........这里部分代码省略.........
示例14: drawPrimitive
//.........这里部分代码省略.........
// corners
p->setPen( mixedColor(cg.dark().dark().dark(),
cg.dark()) );
p->drawPoint( x, y + h - 1 );
p->drawPoint( x + w - 1, y );
p->setPen( mixedColor(cg.dark().dark(), cg.midlight()) );
p->drawPoint( x + 1, y + h - 2 );
p->drawPoint( x + w - 2, y + 1 );
p->setPen( mixedColor(cg.mid().dark(), cg.button() ) );
p->drawPoint( x + 2, y + h - 3 );
p->drawPoint( x + w - 3, y + 2 );
}
}
p->setPen( oldPen );
break;
}
case PE_ButtonCommand:
{
QPen oldPen = p->pen();
int x,
y,
w,
h;
r.rect( &x, &y, &w, &h);
if ( !(flags & (Style_Down | Style_On)) ) {
p->fillRect( x+3, y+3, w-6, h-6,
cg.brush( QColorGroup::Button ));
// the bright side
p->setPen( cg.shadow() );
p->drawLine( x, y, x+w-1, y );
p->drawLine( x, y, x, y + h - 1 );
p->setPen( cg.button() );
p->drawLine( x + 1, y + 1, x + w - 2, y + 1 );
p->drawLine( x + 1, y + 1, x + 1, y + h - 2 );
p->setPen( cg.light() );
p->drawLine( x + 2, y + 2, x + 2, y + h - 2 );
p->drawLine( x + 2, y + 2, x + w - 2, y + 2 );
// the dark side!
p->setPen( cg.mid() );
p->drawLine( x + 3, y + h - 3 ,x + w - 3, y + h - 3 );
p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 );
p->setPen( cg.dark() );
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 - 2 );
p->setPen( cg.shadow() );
p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 );
p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 );
// top left corner:
p->setPen( cg.background() );
p->drawPoint( x, y );
p->drawPoint( x + 1, y );
p->drawPoint( x, y+1 );