本文整理汇总了C++中qDrawShadePanel函数的典型用法代码示例。如果您正苦于以下问题:C++ qDrawShadePanel函数的具体用法?C++ qDrawShadePanel怎么用?C++ qDrawShadePanel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qDrawShadePanel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backgroundRect
void WhiteBoardColorChooser::paintEvent(QPaintEvent *e)
{
QFrame::paintEvent(e);
QPainter tPaint;
tPaint.begin(this);
tPaint.drawPixmap(swapPixmapRect().topLeft(), m_swapPixmap);
QRect bgRect = backgroundRect();
QRect bgRectInside = QRect(bgRect.x () + 2, bgRect.y () + 2,
bgRect.width () - 4, bgRect.height () - 4);
tPaint.fillRect(bgRectInside, m_backgroundColor);
qDrawShadePanel(&tPaint, bgRect, palette(),
false/*not sunken*/, 2/*lineWidth*/,
0/*never fill*/);
QRect fgRect = foregroundRect();
QRect fgRectInside = QRect(fgRect.x () + 2, fgRect.y () + 2,
fgRect.width () - 4, fgRect.height () - 4);
tPaint.fillRect(fgRectInside, m_foregroundColor);
qDrawShadePanel(&tPaint, fgRect, palette (),
false/*not sunken*/, 2/*lineWidth*/,
0/*never fill*/);
tPaint.end();
}
示例2: qDrawShadePanel
//! Draw the thumb at a position
void QwtSlider::drawThumb(QPainter *p, const QRect &sliderRect, int pos)
{
pos++; // shade line points one pixel below
if (orientation() == Qt::Horizontal)
{
qDrawShadePanel(p, pos - d_thumbLength / 2,
sliderRect.y(), d_thumbLength, sliderRect.height(),
colorGroup(), FALSE, d_borderWidth,
&colorGroup().brush(QColorGroup::Button));
qDrawShadeLine(p, pos, sliderRect.y(),
pos, sliderRect.y() + sliderRect.height() - 2,
colorGroup(), TRUE, 1);
}
else // Vertical
{
qDrawShadePanel(p,sliderRect.x(), pos - d_thumbLength / 2,
sliderRect.width(), d_thumbLength,
colorGroup(),FALSE, d_borderWidth,
&colorGroup().brush(QColorGroup::Button));
qDrawShadeLine(p, sliderRect.x(), pos,
sliderRect.x() + sliderRect.width() - 2, pos,
colorGroup(), TRUE, 1);
}
}
示例3: qDrawShadePanel
//! Draw the thumb at a position
void QwtSlider::drawThumb(QPainter *p, const QRect &sliderRect, int pos)
{
pos++; // shade line points one pixel below
if (orientation() == Qt::Horizontal)
{
qDrawShadePanel(p, pos - d_data->thumbLength / 2,
sliderRect.y(), d_data->thumbLength, sliderRect.height(),
#if QT_VERSION < 0x040000
colorGroup(),
#else
palette(),
#endif
false, d_data->borderWidth,
#if QT_VERSION < 0x040000
&colorGroup().brush(QColorGroup::Button)
#else
&palette().brush(QPalette::Button)
#endif
);
qDrawShadeLine(p, pos, sliderRect.y(),
pos, sliderRect.y() + sliderRect.height() - 2,
#if QT_VERSION < 0x040000
colorGroup(),
#else
palette(),
#endif
true, 1);
}
else // Vertical
{
qDrawShadePanel(p,sliderRect.x(), pos - d_data->thumbLength / 2,
sliderRect.width(), d_data->thumbLength,
#if QT_VERSION < 0x040000
colorGroup(),
#else
palette(),
#endif
false, d_data->borderWidth,
#if QT_VERSION < 0x040000
&colorGroup().brush(QColorGroup::Button)
#else
&palette().brush(QPalette::Button)
#endif
);
qDrawShadeLine(p, sliderRect.x(), pos,
sliderRect.x() + sliderRect.width() - 2, pos,
#if QT_VERSION < 0x040000
colorGroup(),
#else
palette(),
#endif
true, 1);
}
}
示例4: 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++;
};
};
}
示例5: 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()));
}
示例6: innerRect
/*!
Draw the slider into the specified rectangle.
\param painter Painter
\param sliderRect Bounding rectangle of the slider
*/
void QwtSlider::drawSlider(
QPainter *painter, const QRect &sliderRect ) const
{
QRect innerRect( sliderRect );
if ( d_data->hasTrough )
{
const int bw = d_data->borderWidth;
innerRect = sliderRect.adjusted( bw, bw, -bw, -bw );
painter->fillRect( innerRect, palette().brush( QPalette::Mid ) );
qDrawShadePanel( painter, sliderRect, palette(), true, bw, NULL );
}
const QSize handleSize = qwtHandleSize( d_data->handleSize,
d_data->orientation, d_data->hasTrough );
if ( d_data->hasGroove )
{
const int slotExtent = 4;
const int slotMargin = 4;
QRect slotRect;
if ( orientation() == Qt::Horizontal )
{
int slotOffset = qMax( 1, handleSize.width() / 2 - slotMargin );
int slotHeight = slotExtent + ( innerRect.height() % 2 );
slotRect.setWidth( innerRect.width() - 2 * slotOffset );
slotRect.setHeight( slotHeight );
}
else
{
int slotOffset = qMax( 1, handleSize.height() / 2 - slotMargin );
int slotWidth = slotExtent + ( innerRect.width() % 2 );
slotRect.setWidth( slotWidth );
slotRect.setHeight( innerRect.height() - 2 * slotOffset );
}
slotRect.moveCenter( innerRect.center() );
QBrush brush = palette().brush( QPalette::Dark );
qDrawShadePanel( painter, slotRect, palette(), true, 1 , &brush );
}
if ( isValid() )
drawHandle( painter, handleRect(), transform( value() ) );
}
示例7: innerRect
/*!
Draw the slider into the specified rectangle.
\param painter Painter
\param sliderRect Bounding rectangle of the slider
*/
void QwtSlider::drawSlider(
QPainter *painter, const QRect &sliderRect ) const
{
QRect innerRect( sliderRect );
if ( d_data->bgStyle & QwtSlider::Trough )
{
const int bw = d_data->borderWidth;
qDrawShadePanel( painter, sliderRect, palette(), true, bw, NULL );
innerRect = sliderRect.adjusted( bw, bw, -bw, -bw );
painter->fillRect( innerRect, palette().brush( QPalette::Mid ) );
}
if ( d_data->bgStyle & QwtSlider::Groove )
{
int ws = 4;
int ds = d_data->handleSize.width() / 2 - 4;
if ( ds < 1 )
ds = 1;
QRect rSlot;
if ( orientation() == Qt::Horizontal )
{
if ( innerRect.height() & 1 )
ws++;
rSlot = QRect( innerRect.x() + ds,
innerRect.y() + ( innerRect.height() - ws ) / 2,
innerRect.width() - 2 * ds, ws );
}
else
{
if ( innerRect.width() & 1 )
ws++;
rSlot = QRect( innerRect.x() + ( innerRect.width() - ws ) / 2,
innerRect.y() + ds,
ws, innerRect.height() - 2 * ds );
}
QBrush brush = palette().brush( QPalette::Dark );
qDrawShadePanel( painter, rSlot, palette(), true, 1 , &brush );
}
if ( isValid() )
drawHandle( painter, innerRect, transform( value() ) );
}
示例8: painter
/*!
Paint event handler
\param event Paint event
*/
void QwtThermo::paintEvent( QPaintEvent *event )
{
QPainter painter( this );
painter.setClipRegion( event->region() );
QStyleOption opt;
opt.init(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
const QRect tRect = pipeRect();
if ( !tRect.contains( event->rect() ) )
{
if ( d_data->scalePosition != QwtThermo::NoScale )
scaleDraw()->draw( &painter, palette() );
}
const int bw = d_data->borderWidth;
const QBrush brush = palette().brush( QPalette::Base );
qDrawShadePanel( &painter,
tRect.adjusted( -bw, -bw, bw, bw ),
palette(), true, bw,
d_data->autoFillPipe ? &brush : NULL );
drawLiquid( &painter, tRect );
}
示例9: painter
void QColorButton::paintEvent( QPaintEvent * event )
{
QPainter painter( this );
int x, y, w, h;
QStyleOptionButton opt;
opt.rect = event->rect();
style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &painter, this);
QRect r = style()->subElementRect( QStyle::SE_PushButtonContents, &opt, this );
r.getRect(&x, &y, &w, &h);
//int margin = style()->pixelMetric( QStyle::PM_ButtonMargin, &opt, this );
//x += margin;
//y += margin;
//w -= 2*margin;
//h -= 2*margin;
//if (isOn() || isDown()) {
// x += style()->pixelMetric( QStyle::PM_ButtonShiftHorizontal, &opt, this );
// y += style()->pixelMetric( QStyle::PM_ButtonShiftVertical, &opt, this );
//}
const QColor fillCol = isEnabled() ? col : palette().background().color();
qDrawShadePanel( &painter, x, y, w, h, palette(), true, 1, NULL);
if ( fillCol.isValid() )
painter.fillRect( x+1, y+1, w-2, h-2, fillCol );
//if ( hasFocus() ) {
// QRect focusRect = style()->subElementRect( QStyle::SE_PushButtonFocusRect, &opt, this );
// style()->drawPrimitive( QStyle::PE_FrameFocusRect, &opt, &painter, this );
//}
}
示例10: qDrawShadePanel
/*!\reimp
*/
void QCDEStyle::drawIndicator( QPainter* p,
int x, int y, int w, int h, const QColorGroup &g,
int s, bool down, bool /* enabled */ )
{
bool showUp = !down && s == QButton::Off;
QBrush fill = down ? g.brush( QColorGroup::Mid ) :
g.brush( QColorGroup::Button );
qDrawShadePanel( p, x, y, w, h, g, !showUp, defaultFrameWidth(), &fill );
if (s != QButton::Off) {
QPointArray a( 7*2 );
int i, xx, yy;
xx = x+3;
yy = y+5;
for ( i=0; i<3; i++ ) {
a.setPoint( 2*i, xx, yy );
a.setPoint( 2*i+1, xx, yy+2 );
xx++; yy++;
}
yy -= 2;
for ( i=3; i<7; i++ ) {
a.setPoint( 2*i, xx, yy );
a.setPoint( 2*i+1, xx, yy+2 );
xx++; yy--;
}
if ( s == QButton::NoChange )
p->setPen( g.dark() );
else
p->setPen( g.foreground() );
p->drawLineSegments( a );
}
}
示例11: p
void KexiDBComboBox::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.setPen(palette().color(QPalette::Text));
// QColorGroup cg(palette().active());
// if ( hasFocus() )
// cg.setColor(QColorGroup::Base, cg.highlight());
// else
QPalette pal(palette());
pal.setColor(QColorGroup::Base, paletteBackgroundColor()); //update base color using (reimplemented) bg color
if (width() < 5 || height() < 5) {
qDrawShadePanel(&p, rect(), pal, false /* !sunken */,
2 /*line width*/, &pal.brush(QPalette::Button)/*fill*/);
return;
}
#ifdef __GNUC__
#warning TODO KexiDBComboBox::paintEvent()
#else
#pragma WARNING( TODO KexiDBComboBox::paintEvent() )
#endif
QStyleOptionComboBox option;
option.palette = pal;
option.initFrom(d->paintedCombo);
if (isEnabled())
option.state |= QStyle::State_Enabled;
if (hasFocus())
option.state |= QStyle::State_HasFocus;
if (d->mouseOver)
option.state |= QStyle::State_MouseOver;
style()->drawComplexControl(QStyle::CC_ComboBox, &option, &p, d->paintedCombo);
#if 0 //TODO
//! @todo support reverse layout
//bool reverse = QApplication::reverseLayout();
style()->drawComplexControl(QStyle::CC_ComboBox, &option, &p, d->paintedCombo /*this*/
flags, (uint)QStyle::SC_All,
(d->buttonPressed ? QStyle::SC_ComboBoxArrow : QStyle::SC_None)
);
if (d->isEditable) {
//if editable, editor paints itself, nothing to do
} else { //not editable: we need to paint the current item
QRect editorGeometry(this->editorGeometry());
if (hasFocus()) {
if (0 == qstrcmp(style()->name(), "windows")) //a hack
p.fillRect(editorGeometry, cg.brush(QColorGroup::Highlight));
QRect r(QStyle::visualRect(style()->subRect(QStyle::SR_ComboBoxFocusRect, d->paintedCombo), this));
r = QRect(r.left() - 1, r.top() - 1, r.width() + 2, r.height() + 2); //enlare by 1 pixel each side to avoid covering by the subwidget
style()->drawPrimitive(QStyle::PE_FocusRect, &p,
r, cg, flags | QStyle::Style_FocusAtBorder, QStyleOption(cg.highlight()));
}
//todo
}
#endif
}
示例12: qDrawShadePanel
void qDrawShadePanel(QPainter *p, const QRect &r,
const QPalette &pal, bool sunken,
int lineWidth, const QBrush *fill)
{
qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken,
lineWidth, fill);
}
示例13: frameWidth
/*!
Draw the border of the canvas
\param painter Painter
*/
void QwtPlotGLCanvas::drawBorder( QPainter *painter )
{
const int fw = frameWidth();
if ( fw <= 0 )
return;
if ( frameShadow() == QwtPlotGLCanvas::Plain )
{
qDrawPlainRect( painter, frameRect(),
palette().shadow().color(), lineWidth() );
}
else
{
if ( frameShape() == QwtPlotGLCanvas::Box )
{
qDrawShadeRect( painter, frameRect(), palette(),
frameShadow() == Sunken, lineWidth(), midLineWidth() );
}
else
{
qDrawShadePanel( painter, frameRect(), palette(),
frameShadow() == Sunken, lineWidth() );
}
}
}
示例14: QPainter
void KviThemedLineEdit::paintEvent(QPaintEvent * event)
{
#ifdef COMPILE_PSEUDO_TRANSPARENCY
QPainter * p = new QPainter(this);
QPalette pal = palette();
// In Qt5 QStyle::drawPrimitive seems to always overwrite the background, no matter what.
qDrawShadePanel(p, 0, 0, width(), height(), palette(), true, 1, nullptr);
QRect r(1, 1, width() - 2, height() - 2);
if(KVI_OPTION_BOOL(KviOption_boolUseCompositingForTransparency) && g_pApp->supportsCompositing())
{
p->setCompositionMode(QPainter::CompositionMode_Source);
QColor col = KVI_OPTION_COLOR(KviOption_colorGlobalTransparencyFade);
col.setAlphaF((float)((float)KVI_OPTION_UINT(KviOption_uintGlobalTransparencyChildFadeFactor) / (float)100));
p->fillRect(r, col);
p->restore();
}
else if(g_pShadedChildGlobalDesktopBackground)
{
QPoint pnt;
if(m_pKviWindow)
pnt = m_pKviWindow->isDocked() ? mapTo(g_pMainWindow, r.topLeft()) : mapTo(m_pKviWindow, r.topLeft());
else
pnt = mapToGlobal(event->rect().topLeft());
p->drawTiledPixmap(r, *(g_pShadedChildGlobalDesktopBackground), pnt);
}
delete p;
#endif
QLineEdit::paintEvent(event);
}
示例15: qDrawShadePanel
void KColorCells::paintCell( TQPainter *painter, int row, int col )
{
TQBrush brush;
int w = 1;
if (shade)
{
qDrawShadePanel( painter, 1, 1, cellWidth()-2,
cellHeight()-2, colorGroup(), true, 1, &brush );
w = 2;
}
TQColor color = colors[ row * numCols() + col ];
if (!color.isValid())
{
if (!shade) return;
color = backgroundColor();
}
painter->setPen( color );
painter->setBrush( TQBrush( color ) );
painter->drawRect( w, w, cellWidth()-w*2, cellHeight()-w*2 );
if ( row * numCols() + col == selected )
painter->drawWinFocusRect( w, w, cellWidth()-w*2, cellHeight()-w*2 );
}