int KexiDBImageBox::realLineWidth() const { switch (frameShape()) { case QFrame::NoFrame: // shadow, line, midline unused return 0; case QFrame::Box: switch (frameShadow()) { case QFrame::Plain: // midline unused return lineWidth(); default: // sunken, raised: return 2 * lineWidth() + midLineWidth(); } break; case QFrame::Panel: // shadow, midline unused return lineWidth(); case QFrame::WinPanel: // shadow, line, midline unused return 2; case QFrame::StyledPanel: { // shadow, line, midline unused QStyleOptionFrameV3 option; option.initFrom(this); return style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option, this); } default: return lineWidth(); } }
/*! \internal Mostly for the sake of Q3Frame */ void QFrame::drawFrame(QPainter *p) { Q_D(QFrame); QStyleOptionFrameV3 opt; opt.init(this); int frameShape = d->frameStyle & QFrame::Shape_Mask; int frameShadow = d->frameStyle & QFrame::Shadow_Mask; opt.frameShape = Shape(int(opt.frameShape) | frameShape); opt.rect = frameRect(); switch (frameShape) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: opt.lineWidth = d->lineWidth; opt.midLineWidth = d->midLineWidth; break; default: // most frame styles do not handle customized line and midline widths // (see updateFrameWidth()). opt.lineWidth = d->frameWidth; break; } if (frameShadow == Sunken) opt.state |= QStyle::State_Sunken; else if (frameShadow == Raised) opt.state |= QStyle::State_Raised; style()->drawControl(QStyle::CE_ShapedFrame, &opt, p, this); }
void QgsColorBox::paintEvent( QPaintEvent *event ) { Q_UNUSED( event ); QPainter painter( this ); QStyleOptionFrameV3 option; option.initFrom( this ); option.state = hasFocus() ? QStyle::State_Active : QStyle::State_None; style()->drawPrimitive( QStyle::PE_Frame, &option, &painter ); if ( mDirty ) { createBox(); } //draw background image painter.drawImage( QPoint( mMargin, mMargin ), *mBoxImage ); //draw cross lines double xPos = mMargin + ( width() - 2 * mMargin - 1 ) * ( double )xComponentValue() / ( double )valueRangeX(); double yPos = mMargin + ( height() - 2 * mMargin - 1 ) - ( height() - 2 * mMargin - 1 ) * ( double )yComponentValue() / ( double )valueRangeY(); painter.setBrush( Qt::white ); painter.setPen( Qt::NoPen ); painter.drawRect( xPos - 1, mMargin, 3, height() - 2 * mMargin - 1 ); painter.drawRect( mMargin, yPos - 1, width() - 2 * mMargin - 1, 3 ); painter.setPen( Qt::black ); painter.drawLine( xPos, mMargin, xPos, height() - mMargin - 1 ); painter.drawLine( mMargin, yPos, width() - mMargin - 1, yPos ); painter.end(); }
void paintFrame() { QPainter painter( editor ); QStyleOptionFrameV3 option; option.initFrom( editor ); option.palette = originalPalette; option.rect = editor->frameRect(); option.frameShape = editor->frameShape(); switch ( option.frameShape ) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: option.lineWidth = editor->lineWidth(); option.midLineWidth = editor->midLineWidth(); break; default: // most frame styles do not handle customized line and midline widths // (see updateFrameWidth()). option.lineWidth = editor->frameWidth(); break; } if ( editor->frameShadow() == QFrame::Sunken ) { option.state |= QStyle::State_Sunken; } else if ( editor->frameShadow() == QFrame::Raised ) { option.state |= QStyle::State_Raised; } editor->style()->drawControl( QStyle::CE_ShapedFrame, &option, &painter, editor ); }
/*! Draw the border of the plot canvas \param painter Painter \sa setBorderRadius() */ void QwtPlotCanvas::drawBorder( QPainter *painter ) { if ( d_data->borderRadius > 0 ) { if ( frameWidth() > 0 ) { QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), d_data->borderRadius, d_data->borderRadius, palette(), frameWidth(), frameStyle() ); } } else { #if QT_VERSION >= 0x040500 #if QT_VERSION < 0x050000 QStyleOptionFrameV3 opt; #else QStyleOptionFrame opt; #endif opt.init(this); int frameShape = frameStyle() & QFrame::Shape_Mask; int frameShadow = frameStyle() & QFrame::Shadow_Mask; opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape ); #if 0 opt.rect = frameRect(); #endif switch (frameShape) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: { opt.lineWidth = lineWidth(); opt.midLineWidth = midLineWidth(); break; } default: { opt.lineWidth = frameWidth(); break; } } if ( frameShadow == Sunken ) opt.state |= QStyle::State_Sunken; else if ( frameShadow == Raised ) opt.state |= QStyle::State_Raised; style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, this); #else drawFrame( painter ); #endif } }
void CodeLineEdit::paintEvent(QPaintEvent *event) { if(!mMultiline) QLineEdit::paintEvent(event); if(mMultiline || mCode) { QPainter painter(this); if(mMultiline) { QStyleOptionFrameV3 panel; panel.initFrom(this); if(!mEmbedded) { panel.lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &panel, this); panel.midLineWidth = 0; panel.state |= QStyle::State_Sunken; style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &painter, this); } painter.setBrush(panel.palette.text()); QFont italicFont = font(); italicFont.setStyle(QFont::StyleItalic); painter.setFont(italicFont); QPalette pal = palette(); pal.setCurrentColorGroup(QPalette::Disabled); style()->drawItemText(&painter, rect(), Qt::AlignCenter, pal, false, tr("Multiline, double-click to edit"), QPalette::Text); } if(mCode) { QPolygon polygon; QColor color; if(isEnabled()) color = QColor(255, 0, 0, 200); else color = QColor(100, 0, 0, 200); painter.setPen(Qt::NoPen); int offset = (mEmbedded ? 0 : 4); polygon << QPoint(offset, offset) << QPoint(6 + offset, offset) << QPoint(offset, 6 + offset); painter.setBrush(QBrush(color)); painter.drawPolygon(polygon); } } }
QSize LineEdit::sizeHint () const { QFontMetrics fm(font()); int h = qMax(fm.height(), 14) + 4; int w = fm.width(QLatin1Char('x')) * 17 + 4; QStyleOptionFrameV3 opt; opt.initFrom(this); return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this)); }
void PartResizerWidget::paintEvent(QPaintEvent*) { // draw sunken frame QPainter painter(this); QStyleOptionFrameV3 opt; opt.initFrom(this); opt.frameShape = QFrame::StyledPanel; opt.rect = contentsRect(); opt.lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this); opt.midLineWidth = 0; opt.state |= QStyle::State_Sunken; style()->drawPrimitive(QStyle::PE_PanelLineEdit, &opt, &painter, this); }
void RatingWidget::paintEvent(QPaintEvent* e) { QStylePainter p(this); // Draw the background QStyleOptionFrameV3 opt; opt.initFrom(this); opt.state |= QStyle::State_Sunken; opt.frameShape = QFrame::StyledPanel; opt.lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this); opt.midLineWidth = 0; p.drawPrimitive(QStyle::PE_PanelLineEdit, opt); // Draw the stars painter_.Paint(&p, rect(), hover_rating_ == -1.0 ? rating_ : hover_rating_); }
//! Reimplements QListView::resizeEvent. void TraceWidget::resizeEvent(QResizeEvent * event) { QListWidget::resizeEvent(event); QStyleOptionFrameV3 option; option.initFrom(this); const QRect client = style()->subElementRect( QStyle::SE_FrameContents, &option, this); const QRect view = viewport()->rect(); const QRect visual = QStyle::visualRect(layoutDirection(), view, QRect( client.left(), client.top(), cycleBarWidth, view.height() - view.top())); cbar_->setGeometry(visual); }
/*! \internal Updates the frame widths from the style. */ void QFramePrivate::updateStyledFrameWidths() { Q_Q(const QFrame); QStyleOptionFrameV3 opt; opt.initFrom(q); opt.lineWidth = lineWidth; opt.midLineWidth = midLineWidth; opt.frameShape = QFrame::Shape(frameStyle & QFrame::Shape_Mask); QRect cr = q->style()->subElementRect(QStyle::SE_ShapedFrameContents, &opt, q); leftFrameWidth = cr.left() - opt.rect.left(); topFrameWidth = cr.top() - opt.rect.top(); rightFrameWidth = opt.rect.right() - cr.right(), bottomFrameWidth = opt.rect.bottom() - cr.bottom(); frameWidth = qMax(qMax(leftFrameWidth, rightFrameWidth), qMax(topFrameWidth, bottomFrameWidth)); }
/*! Draw the border of the canvas \param painter Painter */ void QwtPlotAbstractCanvas::drawBorder( QPainter *painter ) { const QWidget *w = canvasWidget(); if ( d_data->borderRadius > 0 ) { const int frameWidth = w->property( "frameWidth" ).toInt(); if ( frameWidth > 0 ) { const int frameShape = w->property( "frameShape" ).toInt(); const int frameShadow = w->property( "frameShadow" ).toInt(); const QRectF frameRect = w->property( "frameRect" ).toRect(); QwtPainter::drawRoundedFrame( painter, frameRect, d_data->borderRadius, d_data->borderRadius, w->palette(), frameWidth, frameShape | frameShadow ); } } else { #if QT_VERSION >= 0x040500 const int frameShape = w->property( "frameShape" ).toInt(); const int frameShadow = w->property( "frameShadow" ).toInt(); #if QT_VERSION < 0x050000 QStyleOptionFrameV3 opt; #else QStyleOptionFrame opt; #endif opt.init( w ); opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape ); switch (frameShape) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: { opt.lineWidth = w->property( "lineWidth" ).toInt(); opt.midLineWidth = w->property( "midLineWidth" ).toInt(); break; } default: { opt.lineWidth = w->property( "frameWidth" ).toInt(); break; } } if ( frameShadow == QFrame::Sunken ) opt.state |= QStyle::State_Sunken; else if ( frameShadow == QFrame::Raised ) opt.state |= QStyle::State_Raised; w->style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, w ); #else // TODO: do we really need Qt 4.4 ? #endif } }
void QgsColorWheel::paintEvent( QPaintEvent *event ) { Q_UNUSED( event ); QPainter painter( this ); //draw a frame QStyleOptionFrameV3 option = QStyleOptionFrameV3(); option.initFrom( this ); option.state = this->hasFocus() ? QStyle::State_Active : QStyle::State_None; style()->drawPrimitive( QStyle::PE_Frame, &option, &painter ); if ( !mWidgetImage || !mWheelImage || !mTriangleImage ) { createImages( size() ); } //draw everything in an image mWidgetImage->fill( Qt::transparent ); QPainter imagePainter( mWidgetImage ); imagePainter.setRenderHint( QPainter::Antialiasing ); if ( mWheelDirty ) { //need to redraw the wheel image createWheel(); } //draw wheel centered on widget QPointF center = QPointF( width() / 2.0, height() / 2.0 ); imagePainter.drawImage( QPointF( center.x() - ( mWheelImage->width() / 2.0 ), center.y() - ( mWheelImage->height() / 2.0 ) ), *mWheelImage ); //draw hue marker int h = hue(); double length = mWheelImage->width() / 2.0; QLineF hueMarkerLine = QLineF( center.x(), center.y(), center.x() + length, center.y() ); hueMarkerLine.setAngle( h ); imagePainter.save(); //use sourceIn mode for nicer antialiasing imagePainter.setCompositionMode( QPainter::CompositionMode_SourceIn ); QPen pen; pen.setWidth( 2 ); //adapt pen color for hue pen.setColor( h > 20 && h < 200 ? Qt::black : Qt::white ); imagePainter.setPen( pen ); imagePainter.drawLine( hueMarkerLine ); imagePainter.restore(); //draw triangle if ( mTriangleDirty ) { createTriangle(); } imagePainter.drawImage( QPointF( center.x() - ( mWheelImage->width() / 2.0 ), center.y() - ( mWheelImage->height() / 2.0 ) ), *mTriangleImage ); //draw current color marker double triangleRadius = length - mWheelThickness - 1; //adapted from equations at https://github.com/timjb/colortriangle/blob/master/colortriangle.js by Tim Baumann double lightness = mCurrentColor.lightnessF(); double hueRadians = ( h * M_PI / 180.0 ); double hx = cos( hueRadians ) * triangleRadius; double hy = -sin( hueRadians ) * triangleRadius; double sx = -cos( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double sy = -sin( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double vx = -cos( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double vy = sin( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double mx = ( sx + vx ) / 2.0; double my = ( sy + vy ) / 2.0; double a = ( 1 - 2.0 * fabs( lightness - 0.5 ) ) * mCurrentColor.hslSaturationF(); double x = sx + ( vx - sx ) * lightness + ( hx - mx ) * a; double y = sy + ( vy - sy ) * lightness + ( hy - my ) * a; //adapt pen color for lightness pen.setColor( lightness > 0.7 ? Qt::black : Qt::white ); imagePainter.setPen( pen ); imagePainter.setBrush( Qt::NoBrush ); imagePainter.drawEllipse( QPointF( x + center.x(), y + center.y() ), 4.0, 4.0 ); imagePainter.end(); //draw image onto widget painter.drawImage( QPoint( 0, 0 ), *mWidgetImage ); painter.end(); }
void QgsColorRampWidget::paintEvent( QPaintEvent *event ) { Q_UNUSED( event ); QPainter painter( this ); if ( mShowFrame ) { //draw frame QStyleOptionFrameV3 option; option.initFrom( this ); option.state = hasFocus() ? QStyle::State_KeyboardFocusChange : QStyle::State_None; style()->drawPrimitive( QStyle::PE_Frame, &option, &painter ); } if ( hasFocus() ) { //draw focus rect QStyleOptionFocusRect option; option.initFrom( this ); option.state = QStyle::State_KeyboardFocusChange; style()->drawPrimitive( QStyle::PE_FrameFocusRect, &option, &painter ); } if ( mComponent != QgsColorWidget::Alpha ) { int maxValue = ( mOrientation == QgsColorRampWidget::Horizontal ? width() : height() ) - 1 - 2 * mMargin; QColor color = QColor( mCurrentColor ); color.setAlpha( 255 ); QPen pen; pen.setWidth( 0 ); painter.setPen( pen ); painter.setBrush( Qt::NoBrush ); //draw background ramp for ( int c = 0; c <= maxValue; ++c ) { int colorVal = componentRange() * ( double )c / maxValue; //vertical sliders are reversed if ( mOrientation == QgsColorRampWidget::Vertical ) { colorVal = componentRange() - colorVal; } alterColor( color, mComponent, colorVal ); if ( color.hue() < 0 ) { color.setHsv( hue(), color.saturation(), color.value() ); } pen.setColor( color ); painter.setPen( pen ); if ( mOrientation == QgsColorRampWidget::Horizontal ) { //horizontal painter.drawLine( c + mMargin, mMargin, c + mMargin, height() - mMargin - 1 ); } else { //vertical painter.drawLine( mMargin, c + mMargin, width() - mMargin - 1, c + mMargin ); } } } else if ( mComponent == QgsColorWidget::Alpha ) { //alpha ramps are drawn differently //start with the checkboard pattern QBrush checkBrush = QBrush( transparentBackground() ); painter.setBrush( checkBrush ); painter.setPen( Qt::NoPen ); painter.drawRect( mMargin, mMargin, width() - 2 * mMargin - 1, height() - 2 * mMargin - 1 ); QLinearGradient colorGrad; if ( mOrientation == QgsColorRampWidget::Horizontal ) { //horizontal colorGrad = QLinearGradient( mMargin, 0, width() - mMargin - 1, 0 ); } else { //vertical colorGrad = QLinearGradient( 0, mMargin, 0, height() - mMargin - 1 ); } QColor transparent = QColor( mCurrentColor ); transparent.setAlpha( 0 ); colorGrad.setColorAt( 0, transparent ); QColor opaque = QColor( mCurrentColor ); opaque.setAlpha( 255 ); colorGrad.setColorAt( 1, opaque ); QBrush colorBrush = QBrush( colorGrad ); painter.setBrush( colorBrush ); painter.drawRect( mMargin, mMargin, width() - 2 * mMargin - 1, height() - 2 * mMargin - 1 ); } if ( mOrientation == QgsColorRampWidget::Horizontal ) { //draw marker triangles for horizontal ramps painter.setRenderHint( QPainter::Antialiasing ); painter.setBrush( QBrush( Qt::black ) ); painter.setPen( Qt::NoPen ); painter.translate( mMargin + ( width() - 2 * mMargin ) * ( double )componentValue() / componentRange(), mMargin - 1 ); painter.drawPolygon( mTopTriangle ); painter.translate( 0, height() - mMargin - 2 ); painter.setBrush( QBrush( Qt::white ) ); painter.drawPolygon( mBottomTriangle ); painter.end(); } else { //draw cross lines for vertical ramps int ypos = mMargin + ( height() - 2 * mMargin - 1 ) - ( height() - 2 * mMargin - 1 ) * ( double )componentValue() / componentRange(); painter.setBrush( Qt::white ); painter.setPen( Qt::NoPen ); painter.drawRect( mMargin, ypos - 1, width() - 2 * mMargin - 1, 3 ); painter.setPen( Qt::black ); painter.drawLine( mMargin, ypos, width() - mMargin - 1, ypos ); } }
//----------------------------------------------------------------------------- void ctkCollapsibleButton::paintEvent(QPaintEvent * _event) { Q_D(ctkCollapsibleButton); QPainter p(this); // Draw Button QStyleOptionButton opt; this->initStyleOption(&opt); // We don't want to have the highlight effect on the button when mouse is // over a child. We want the highlight effect only when the mouse is just // over itself. // same as this->underMouse() bool exclusiveMouseOver = false; if (opt.state & QStyle::State_MouseOver) { QRect buttonRect = opt.rect; QList<QWidget*> _children = this->findChildren<QWidget*>(); QList<QWidget*>::ConstIterator it; for (it = _children.constBegin(); it != _children.constEnd(); ++it ) { if ((*it)->underMouse()) { // the mouse has been moved from the collapsible button to one // of its children. The paint event rect is the child rect, this // is why we have to request another paint event to redraw the // button to remove the highlight effect. if (!_event->rect().contains(buttonRect)) {// repaint the button rect. this->update(buttonRect); } opt.state &= ~QStyle::State_MouseOver; exclusiveMouseOver = true; break; } } if (d->ExclusiveMouseOver && !exclusiveMouseOver) { // the mouse is over the widget, but not over the children. As it // has been de-highlighted in the past, we should refresh the button // rect to re-highlight the button. if (!_event->rect().contains(buttonRect)) {// repaint the button rect. this->update(buttonRect); } } } d->ExclusiveMouseOver = exclusiveMouseOver; QSize indicatorSize = QSize(style()->pixelMetric(QStyle::PM_IndicatorWidth, &opt, this), style()->pixelMetric(QStyle::PM_IndicatorHeight, &opt, this)); opt.iconSize = indicatorSize; style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &p, this); // TBD is PE_PanelButtonCommand better ? //style()->drawPrimitive(QStyle::PE_PanelButtonCommand, &opt, &p, this); int buttonHeight = opt.rect.height(); uint tf = d->TextAlignment; if (this->style()->styleHint(QStyle::SH_UnderlineShortcut, &opt, this)) { tf |= Qt::TextShowMnemonic; } else { tf |= Qt::TextHideMnemonic; } int textWidth = opt.fontMetrics.boundingRect(opt.rect, tf, opt.text).width(); int indicatorSpacing = this->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &opt, this); int buttonMargin = this->style()->pixelMetric(QStyle::PM_ButtonMargin, &opt, this); // Draw Indicator QStyleOption indicatorOpt; indicatorOpt.init(this); if (d->IndicatorAlignment & Qt::AlignLeft) { indicatorOpt.rect = QRect((buttonHeight - indicatorSize.width()) / 2, (buttonHeight - indicatorSize.height()) / 2, indicatorSize.width(), indicatorSize.height()); } else if (d->IndicatorAlignment & Qt::AlignHCenter) { int w = indicatorSize.width(); if (!opt.text.isEmpty() && (d->TextAlignment & Qt::AlignHCenter)) { w += textWidth + indicatorSpacing; } indicatorOpt.rect = QRect(opt.rect.x()+ opt.rect.width() /2 - w / 2, (buttonHeight - indicatorSize.height()) / 2, indicatorSize.width(), indicatorSize.height()); if (d->TextAlignment & Qt::AlignLeft && indicatorOpt.rect.left() < opt.rect.x() + buttonMargin + textWidth) { indicatorOpt.rect.moveLeft(opt.rect.x() + buttonMargin + textWidth); } else if (d->TextAlignment & Qt::AlignRight && indicatorOpt.rect.right() > opt.rect.right() - buttonMargin - textWidth) { indicatorOpt.rect.moveRight(opt.rect.right() - buttonMargin - textWidth); } } else if (d->IndicatorAlignment & Qt::AlignRight) { indicatorOpt.rect = QRect(opt.rect.width() - (buttonHeight - indicatorSize.width()) / 2 - indicatorSize.width(), (buttonHeight - indicatorSize.height()) / 2, indicatorSize.width(), indicatorSize.height()); } if (d->Collapsed) { style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &indicatorOpt, &p, this); } else { style()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &indicatorOpt, &p, this); } // Draw Text if (d->TextAlignment & Qt::AlignLeft) { if (d->IndicatorAlignment & Qt::AlignLeft) { opt.rect.setLeft(indicatorOpt.rect.right() + indicatorSpacing); } else { opt.rect.setLeft(opt.rect.x() + buttonMargin); } } else if (d->TextAlignment & Qt::AlignHCenter) { if (d->IndicatorAlignment & Qt::AlignHCenter) { opt.rect.setLeft(indicatorOpt.rect.right() + indicatorSpacing); } else { opt.rect.setLeft(opt.rect.x() + opt.rect.width() / 2 - textWidth / 2); if (d->IndicatorAlignment & Qt::AlignLeft) { opt.rect.setLeft( qMax(indicatorOpt.rect.right() + indicatorSpacing, opt.rect.left()) ); } } } else if (d->TextAlignment & Qt::AlignRight) { if (d->IndicatorAlignment & Qt::AlignRight) { opt.rect.setLeft(indicatorOpt.rect.left() - indicatorSpacing - textWidth); } else { opt.rect.setLeft(opt.rect.right() - buttonMargin - textWidth); } } // all the computations have been made infering the text would be left oriented tf &= ~Qt::AlignHCenter & ~Qt::AlignRight; tf |= Qt::AlignLeft; style()->drawItemText(&p, opt.rect, tf, opt.palette, (opt.state & QStyle::State_Enabled), opt.text, QPalette::ButtonText); // Draw Frame around contents QStyleOptionFrameV3 fopt; fopt.init(this); // HACK: on some styles, the frame doesn't exactly touch the button. // this is because the button has some kind of extra border. if (qobject_cast<QCleanlooksStyle*>(this->style()) != 0) { fopt.rect.setTop(buttonHeight - 1); } else { fopt.rect.setTop(buttonHeight); } fopt.frameShape = d->ContentsFrameShape; switch (d->ContentsFrameShadow) { case QFrame::Sunken: fopt.state |= QStyle::State_Sunken; break; case QFrame::Raised: fopt.state |= QStyle::State_Raised; break; default: case QFrame::Plain: break; } fopt.lineWidth = d->ContentsLineWidth; fopt.midLineWidth = d->ContentsMidLineWidth; style()->drawControl(QStyle::CE_ShapedFrame, &fopt, &p, this); }