本文整理汇总了C++中QColorGroup::midlight方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::midlight方法的具体用法?C++ QColorGroup::midlight怎么用?C++ QColorGroup::midlight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColorGroup
的用法示例。
在下文中一共展示了QColorGroup::midlight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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 ) );
}
示例3: 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 );
}
示例4: 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
};
示例5: 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 );
}
}
示例6: 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
}
示例7: 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 );
//.........这里部分代码省略.........
示例8: drawPrimitive
//.........这里部分代码省略.........
} else {
p->fillRect( x + 3, y + 3, w - 6,
h - 6,
cg.brush( QColorGroup::Mid ) );
// the dark side
p->setPen( cg.dark().dark().dark() );
p->drawLine( x, y, x + w - 1, y );
p->drawLine( x, y, x, y + h - 1 );
p->setPen( cg.dark().dark() );
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.mid().dark() );
p->drawLine( x + 2, y + 2,
x + 2, y + w - 2 );
p->drawLine( x + 2, y + 2,
x + w - 2, y + 2 );
// the bright side!
p->setPen( cg.button() );
p->drawLine( x + 2, 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.midlight() );
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 );
p->setPen( cg.dark() );
p->drawLine( x, y + h - 1,
x + w - 1,
y + h - 1 );
p->drawLine( x + w - 1, y,
x + w - 1,
y + h - 1 );
// 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 );