本文整理汇总了C++中colorGroup函数的典型用法代码示例。如果您正苦于以下问题:C++ colorGroup函数的具体用法?C++ colorGroup怎么用?C++ colorGroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了colorGroup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: width
void HideButton::drawButton(QPainter *p)
{
if(m_arrow == Qt::LeftArrow)
{
p->setPen(colorGroup().mid());
p->drawLine(width() - 1, 0, width() - 1, height());
}
else if(m_arrow == Qt::RightArrow)
{
p->setPen(colorGroup().mid());
p->drawLine(0, 0, 0, height());
}
else if(m_arrow == Qt::UpArrow)
{
p->setPen(colorGroup().mid());
p->drawLine(0, height() - 1, width(), height() - 1);
}
else if(m_arrow == Qt::DownArrow)
{
p->setPen(colorGroup().mid());
p->drawLine(0, 0, width(), 0);
}
drawButtonLabel(p);
}
示例2: aRect
/*!
\brief Draw the knob
\param p painter
\param r borders of the knob
*/
void QwtKnob::drawKnob(QPainter *p, const QRect &r)
{
const int bw2 = d_borderWidth / 2;
QRect aRect(r.x() + bw2, r.y() + bw2,
r.width() - 2 * bw2, r.height() - 2 * bw2);
//
// draw button face
//
p->setBrush(colorGroup().brush(QColorGroup::Button));
p->drawEllipse(aRect);
//
// draw button shades
//
QPen pn;
pn.setWidth(d_borderWidth);
pn.setColor(colorGroup().light());
p->setPen(pn);
p->drawArc(aRect, 45*16,180*16);
pn.setColor(colorGroup().dark());
p->setPen(pn);
p->drawArc(aRect, 225*16,180*16);
//
// draw marker
//
if ( isValid() )
drawMarker(p, d_angle, colorGroup().buttonText());
}
示例3: contentsRect
/*!
\reimp
*/
void QProgressBar::drawContents( QPainter *p )
{
const QRect bar = contentsRect();
QSharedDoubleBuffer buffer( p, bar.x(), bar.y(), bar.width(), bar.height() );
QPoint pn = backgroundOffset();
buffer.painter()->setBrushOrigin( -pn.x(), -pn.y() );
const QPixmap *bpm = paletteBackgroundPixmap();
if ( bpm )
buffer.painter()->fillRect( bar, QBrush( paletteBackgroundColor(), *bpm ) );
else
buffer.painter()->fillRect( bar, paletteBackgroundColor() );
buffer.painter()->setFont( p->font() );
QStyle::SFlags flags = QStyle::Style_Default;
if (isEnabled())
flags |= QStyle::Style_Enabled;
if (hasFocus())
flags |= QStyle::Style_HasFocus;
style().drawControl(QStyle::CE_ProgressBarGroove, buffer.painter(), this,
QStyle::visualRect(style().subRect(QStyle::SR_ProgressBarGroove, this), this ),
colorGroup(), flags);
style().drawControl(QStyle::CE_ProgressBarContents, buffer.painter(), this,
QStyle::visualRect(style().subRect(QStyle::SR_ProgressBarContents, this), this ),
colorGroup(), flags);
if (percentageVisible())
style().drawControl(QStyle::CE_ProgressBarLabel, buffer.painter(), this,
QStyle::visualRect(style().subRect(QStyle::SR_ProgressBarLabel, this), this ),
colorGroup(), flags);
}
示例4: getChildRect
void KTabCtl::paintEvent(QPaintEvent *)
{
if (!tabs)
return;
if( !blBorder )
return;
QPainter p;
p.begin(this);
int y0 = getChildRect().top() - 1;
int y1 = getChildRect().bottom() + 2;
int x1 = getChildRect().right() + 2;
int x0 = getChildRect().left() - 1;
p.setPen( colorGroup().light() );
p.drawLine(x0, y0, x1 - 1, y0); /* top line */
p.drawLine(x0, y0 + 1, x0, y1); /* left line */
p.setPen(black);
p.drawLine(x1, y1, x0, y1); /* bottom line */
p.drawLine(x1, y1 - 1, x1, y0);
p.setPen(colorGroup().dark());
p.drawLine(x0 + 1, y1 - 1, x1 - 1, y1 - 1); /* bottom */
p.drawLine(x1 - 1, y1 - 2, x1 - 1, y0 + 1);
p.end();
}
示例5: lineWidth
/*!
Draw the frame around the dial
\param painter Painter
\sa QwtDial::lineWidth, QwtDial::frameShadow
*/
void QwtDial::drawFrame(QPainter *painter)
{
const int lw = lineWidth();
const int off = (lw + 1) % 2;
QRect r = boundingRect();
r.setRect(r.x() + lw / 2 - off, r.y() + lw / 2 - off,
r.width() - lw + off + 1, r.height() - lw + off + 1);
if ( lw > 0 )
{
switch(d_frameShadow)
{
case QwtDial::Raised:
QwtPainter::drawRoundFrame(painter, r,
lw, colorGroup(), FALSE);
break;
case QwtDial::Sunken:
QwtPainter::drawRoundFrame(painter, r,
lw, colorGroup(), TRUE);
break;
default: // Plain
{
painter->save();
painter->setPen(QPen(Qt::black, lw));
painter->setBrush(Qt::NoBrush);
painter->drawEllipse(r);
painter->restore();
}
}
}
}
示例6: scaleDraw
/*!
Draw the whole QwtThermo.
\param painter Painter
\param rect Update rectangle
*/
void QwtThermo::draw(QPainter *painter, const QRect& rect)
{
if ( !d_data->thermoRect.contains(rect) )
{
if (d_data->scalePos != NoScale)
{
#if QT_VERSION < 0x040000
scaleDraw()->draw(painter, colorGroup());
#else
scaleDraw()->draw(painter, palette());
#endif
}
qDrawShadePanel(painter,
d_data->thermoRect.x() - d_data->borderWidth,
d_data->thermoRect.y() - d_data->borderWidth,
d_data->thermoRect.width() + 2 * d_data->borderWidth,
d_data->thermoRect.height() + 2 * d_data->borderWidth,
#if QT_VERSION < 0x040000
colorGroup(),
#else
palette(),
#endif
true, d_data->borderWidth, 0);
}
drawThermo(painter);
}
示例7: contentsRect
void QProgressBar::drawContents( QPainter *p )
{
const int unit_width = 9; // includes 2 bg pixels
const int unit_height = 12;
const QRect bar = contentsRect();
if ( style() == WindowsStyle ) {
// Draw nu units out of a possible u of unit_width width, each
// a rectangle bordered by background color, all in a sunken panel
// with a percentage text display at the end.
QFontMetrics fm = p->fontMetrics();
int textw = fm.width("100%");
int u = (bar.width() - textw - 2/*panel*/) / unit_width;
int ox = ( bar.width() - (u*unit_width+textw) ) / 2;
if (total_steps) { // Sanity check
// ### This part doesn't change as often as percentage does.
int nu = ( u * progress_val + total_steps/2 ) / total_steps;
int x = bar.x() + ox;
int uh = QMIN(bar.height()-4, unit_height);
int vm = (bar.height()-4 - uh)/2 + 2;
p->setPen(NoPen);
for (int i=0; i<nu; i++) {
p->fillRect( x+2, bar.y()+vm,
unit_width-2, bar.height()-vm-vm,
QApplication::winStyleHighlightColor() );
x += unit_width;
}
}
// ### This part doesn't actually change.
const QRect r( ox + bar.x(), bar.y(), u*unit_width + 2, bar.height() );
qDrawShadePanel( p, r, colorGroup(), TRUE, 1 );
// ### This part changes every percentage change.
p->setPen( colorGroup().text() );
p->fillRect( r.x()+r.width(), bar.y(), textw, bar.height(),
backgroundColor() );
p->drawText( r.x()+r.width(), bar.y(), textw, bar.height(),
AlignRight | AlignVCenter, progress_str );
} else {
if (total_steps) { // Sanity check
int pw = bar.width() * progress_val / total_steps;
p->setPen( colorGroup().base() );
p->setClipRect( bar.x(), bar.y(), pw, bar.height() );
p->fillRect( bar, QApplication::winStyleHighlightColor() );
p->drawText( bar, AlignCenter, progress_str );
p->setPen( QApplication::winStyleHighlightColor() );
p->setClipRect( bar.x()+pw, bar.y(), bar.width()-pw, bar.height() );
}
p->fillRect( bar, colorGroup().base() );
p->setPen( colorGroup().text() );
p->drawText( bar, AlignCenter, progress_str );
}
}
示例8: style
//! Draw the focus indication
void QwtPlotCanvas::drawFocusIndicator(QPainter *painter, const QRect &rect)
{
#if QT_VERSION < 300
style().drawFocusRect(painter, rect, colorGroup());
#else
style().drawPrimitive(QStyle::PE_FocusRect, painter,
rect, colorGroup());
#endif
}
示例9: qDrawWinButton
void KTriangleButton::paint( QPainter *painter )
{
if ( isDown() || isOn() )
{
if ( style() == WindowsStyle )
qDrawWinButton( painter, 0, 0, width(),
height(), colorGroup(), TRUE );
else
qDrawShadePanel( painter, 0, 0, width(),
height(), colorGroup(), TRUE, 2, 0L );
}
else if ( raised )
{
if ( style() == WindowsStyle )
qDrawWinButton( painter, 0, 0, width(), height(),
colorGroup(), FALSE );
else
qDrawShadePanel( painter, 0, 0, width(), height(),
colorGroup(), FALSE, 2, 0L );
}
if (dir==Right)
{
int x=width()/4;
int y=height()*2/6;
int l=height()-y*2;
int i=0;
int maxi=width()-2*x;
double m=((double)(l/2))/maxi;
while (i<=maxi)
{
painter->drawLine(x,y+(int)(i*m),x,y+l-(int)(i*m));
x++;
i++;
};
}
else if (dir==Left)
{
int x=width()/4;
int y=height()*2/6;
int l=height()-y*2;
int i=0;
int maxi=width()-2*x;
x=width()-x;
double m=((double)(l/2))/maxi;
while (i<=maxi)
{
painter->drawLine(x,y+(int)(i*m),x,y+l-(int)(i*m));
x--;
i++;
};
};
}
示例10: style
void StyledButton::drawButton( QPainter *paint )
{
style().drawPrimitive(QStyle::PE_ButtonBevel, paint, rect(), colorGroup(),
isDown() ? QStyle::Style_Sunken : QStyle::Style_Default);
drawButtonLabel(paint);
if (hasFocus())
style().drawPrimitive(QStyle::PE_FocusRect, paint,
style().subRect(QStyle::SR_PushButtonFocusRect, this),
colorGroup(), QStyle::Style_Default);
}
示例11: style
void ColorButton::drawButton(QPainter *p)
{
style().drawPrimitive(QStyle::PE_ButtonBevel, p, rect(), colorGroup(),
isDown() ? QStyle::Style_Down : QStyle::Style_Raised);
drawButtonLabel(p);
if (hasFocus())
style().drawPrimitive(QStyle::PE_FocusRect, p,
style().subRect(QStyle::SR_PushButtonFocusRect, this),
colorGroup(), QStyle::Style_Default);
}
示例12: drawButtonLabel
void StringBody::drawButton(QPainter *painter) {
if (appearance == HYPERLINK) {
drawButtonLabel(painter);
if (hasFocus()) {
style().drawFocusRect(
painter, rect(), colorGroup(), &colorGroup().button());
}
} else {
QPushButton::drawButton(painter);
}
}
示例13: paint
void QGroupBox::paintEvent( QPaintEvent *event )
{
QPainter paint( this );
if ( lenvisible && !isCheckable() ) { // draw title
QFontMetrics fm = paint.fontMetrics();
int h = fm.height();
int tw = fm.width( str, lenvisible ) + fm.width(QChar(' '));
int x;
int marg = bFlat ? 0 : 8;
if ( align & AlignHCenter ) // center alignment
x = frameRect().width()/2 - tw/2;
else if ( align & AlignRight ) // right alignment
x = frameRect().width() - tw - marg;
else if ( align & AlignLeft ) // left alignment
x = marg;
else { // auto align
if( QApplication::reverseLayout() )
x = frameRect().width() - tw - marg;
else
x = marg;
}
QRect r( x, 0, tw, h );
int va = style().styleHint(QStyle::SH_GroupBox_TextLabelVerticalAlignment, this);
if(va & AlignTop)
r.moveBy(0, fm.descent());
QColor pen( (QRgb) style().styleHint(QStyle::SH_GroupBox_TextLabelColor, this ) );
if (!style().styleHint(QStyle::SH_UnderlineAccelerator, this))
va |= NoAccel;
style().drawItem( &paint, r, ShowPrefix | AlignHCenter | va, colorGroup(),
isEnabled(), 0, str, -1, ownPalette() ? 0 : &pen );
paint.setClipRegion( event->region().subtract( r ) ); // clip everything but title
#ifndef QT_NO_CHECKBOX
} else if ( d->checkbox ) {
QRect cbClip = d->checkbox->geometry();
QFontMetrics fm = paint.fontMetrics();
cbClip.setX( cbClip.x() - fm.width(QChar(' ')) );
cbClip.setWidth( cbClip.width() + fm.width(QChar(' ')) );
paint.setClipRegion( event->region().subtract( cbClip ) );
#endif
}
if ( bFlat ) {
QRect fr = frameRect();
QPoint p1( fr.x(), fr.y() + 1 );
QPoint p2( fr.x() + fr.width(), p1.y() );
// ### This should probably be a style primitive.
qDrawShadeLine( &paint, p1, p2, colorGroup(), TRUE,
lineWidth(), midLineWidth() );
} else {
drawFrame(&paint);
}
drawContents( &paint ); // draw the contents
}
示例14: cr
//! Draw the slider into the specified rectangle.
void QwtSlider::drawSlider(QPainter *p, const QRect &r)
{
QRect cr(r);
if (d_bgStyle & BgTrough)
{
qDrawShadePanel(p, r.x(), r.y(),
r.width(), r.height(),
colorGroup(), TRUE, d_borderWidth,0);
cr.setRect(r.x() + d_borderWidth,
r.y() + d_borderWidth,
r.width() - 2 * d_borderWidth,
r.height() - 2 * d_borderWidth);
p->fillRect(cr.x(), cr.y(), cr.width(), cr.height(),
colorGroup().brush(QColorGroup::Mid));
}
if ( d_bgStyle & BgSlot)
{
int ws = 4;
int ds = d_thumbLength / 2 - 4;
if ( ds < 1 )
ds = 1;
QRect rSlot;
if (orientation() == Qt::Horizontal)
{
if ( cr.height() & 1 )
ws++;
rSlot = QRect(cr.x() + ds,
cr.y() + (cr.height() - ws) / 2,
cr.width() - 2 * ds, ws);
}
else
{
if ( cr.width() & 1 )
ws++;
rSlot = QRect(cr.x() + (cr.width() - ws) / 2,
cr.y() + ds,
ws, cr.height() - 2 * ds);
}
p->fillRect(rSlot.x(), rSlot.y(), rSlot.width(), rSlot.height(),
colorGroup().brush(QColorGroup::Dark));
qDrawShadePanel(p, rSlot.x(), rSlot.y(),
rSlot.width(), rSlot.height(), colorGroup(), TRUE, 1 ,0);
}
if ( isValid() )
drawThumb(p, cr, xyPosition(value()));
}
示例15: qDrawWinPanel
void QSlider::drawWinGroove( QPainter *p, QCOORD c )
{
if ( orient == Horizontal ) {
qDrawWinPanel( p, 0, c - 2, width(), 4, colorGroup(), TRUE );
p->setPen( colorGroup().foreground() );
p->drawLine( 1, c - 1, width() - 3, c - 1 );
} else {
qDrawWinPanel( p, c - 2, 0, 4, height(), colorGroup(), TRUE );
p->setPen( colorGroup().foreground() );
p->drawLine( c - 1, 1, c - 1, height() - 3 );
}
}