当前位置: 首页>>代码示例>>C++>>正文


C++ qDrawShadePanel函数代码示例

本文整理汇总了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();
        }
开发者ID:KDE,项目名称:konversation,代码行数:26,代码来源:whiteboardcolorchooser.cpp

示例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);
    }
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:27,代码来源:qwt_slider.cpp

示例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);
    }
}
开发者ID:szmurlor,项目名称:fiver,代码行数:57,代码来源:qwt_slider.cpp

示例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++;
        };
        
    };
    
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:55,代码来源:ktrianglebutton.cpp

示例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()));
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:54,代码来源:qwt_slider.cpp

示例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() ) );
}
开发者ID:151706061,项目名称:sofa,代码行数:56,代码来源:qwt_slider.cpp

示例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() ) );
}
开发者ID:Aconex,项目名称:pcp,代码行数:55,代码来源:qwt_slider.cpp

示例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 );
}
开发者ID:151706061,项目名称:sofa,代码行数:31,代码来源:qwt_thermo.cpp

示例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 );
    //}
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:31,代码来源:qcolorbutton.cpp

示例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 );
    }
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:34,代码来源:qcdestyle.cpp

示例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
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:60,代码来源:kexidbcombobox.cpp

示例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);
}
开发者ID:crobertd,项目名称:qtbase,代码行数:7,代码来源:qdrawutil.cpp

示例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() );
        }
    }
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:29,代码来源:qwt_plot_glcanvas.cpp

示例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);
}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:33,代码来源:KviThemedLineEdit.cpp

示例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 );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:25,代码来源:kcolordialog.cpp


注:本文中的qDrawShadePanel函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。