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


C++ QStyleOption::init方法代码示例

本文整理汇总了C++中QStyleOption::init方法的典型用法代码示例。如果您正苦于以下问题:C++ QStyleOption::init方法的具体用法?C++ QStyleOption::init怎么用?C++ QStyleOption::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStyleOption的用法示例。


在下文中一共展示了QStyleOption::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paintEvent

void ReleaseDialog::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);

//    QPixmap pixmap("./login/images/login_bg.png");
//    QWidget::setMask(pixmap.mask());

//    QPainter painter(this->parentWidget());
//    painter.setPen(Qt::NoPen);
//    painter.setBrush(Qt::red);
//    painter.drawRect(QRect(10, 10, 50, 80));
}
开发者ID:JinduYin,项目名称:YQCMM,代码行数:15,代码来源:releasedialog.cpp

示例2: paintEvent

void PushButtonDone::paintEvent(QPaintEvent *)
{
    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);

    if("Cancel" == text_)
    {
        QFont font = p.font();
        font.setPointSize(24);
        p.setFont(font);
    }

    p.drawText(QPoint(9, 65), text_);
}
开发者ID:CalciferLorain,项目名称:Mindplus-Desktop,代码行数:16,代码来源:PushButtonDone.cpp

示例3: paintEvent

void ComboTabBar::paintEvent(QPaintEvent* ev)
{
    Q_UNUSED(ev);

    // This is needed to apply style sheets
    QStyleOption option;
    option.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &option, &p, this);

#ifndef Q_OS_MAC
    // Draw tabbar base even on parts of ComboTabBar that are not directly QTabBar
    QStyleOptionTabBarBaseV2 opt;
    TabBarHelper::initStyleBaseOption(&opt, m_mainTabBar, size());

    // Left container
    opt.rect.setX(m_leftContainer->x());
    opt.rect.setWidth(m_leftContainer->width());
    style()->drawPrimitive(QStyle::PE_FrameTabBarBase, &opt, &p);

    // Right container
    opt.rect.setX(m_rightContainer->x());
    opt.rect.setWidth(m_rightContainer->width());
    style()->drawPrimitive(QStyle::PE_FrameTabBarBase, &opt, &p);

    if (m_mainBarOverFlowed) {
        const int scrollButtonWidth = m_mainTabBarWidget->scrollButtonsWidth();

        // Left scroll button
        opt.rect.setX(m_mainTabBarWidget->x());
        opt.rect.setWidth(scrollButtonWidth);
        style()->drawPrimitive(QStyle::PE_FrameTabBarBase, &opt, &p);

        // Right scroll button
        opt.rect.setX(m_mainTabBarWidget->x() + m_mainTabBarWidget->width() - scrollButtonWidth);
        opt.rect.setWidth(scrollButtonWidth);
        style()->drawPrimitive(QStyle::PE_FrameTabBarBase, &opt, &p);
    }

    // Draw base even when main tabbar is empty
    if (normalTabsCount() == 0) {
        opt.rect.setX(m_mainTabBarWidget->x());
        opt.rect.setWidth(m_mainTabBarWidget->width());
        style()->drawPrimitive(QStyle::PE_FrameTabBarBase, &opt, &p);
    }
#endif
}
开发者ID:AwkwardDev,项目名称:qupzilla,代码行数:47,代码来源:combotabbar.cpp

示例4: paintEvent

void LaunchyWidget::paintEvent(QPaintEvent* event)
{
	// Do the default draw first to render any background specified in the stylesheet
	QStyleOption styleOption;
	styleOption.init(this);
	QPainter painter(this);
	painter.setRenderHint(QPainter::Antialiasing);
        style()->drawPrimitive(QStyle::PE_Widget, &styleOption, &painter, this);

	// Now draw the standard frame.png graphic if there is one
	if (frameGraphic)
	{
		painter.drawPixmap(0,0, *frameGraphic);
	}

	QWidget::paintEvent(event);
}
开发者ID:stream009,项目名称:launchy,代码行数:17,代码来源:main.cpp

示例5: file

void view::visualizer::callGraph::paintEvent(QPaintEvent *)
{
    QString filename = QString(((binspector *)thisParent)->getActiveAnalysisPath() + "/graphs/callGraph.png");

    QFile file(filename);
    if (file.exists())
    {
        QStyleOption opt;
        opt.init(this);
        QPainter p(this);

        QPixmap graph(filename);
        p.drawPixmap(0, 0, graph.scaled(size()));

        style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
    }
}
开发者ID:gismo141,项目名称:binSpector,代码行数:17,代码来源:callGraph.cpp

示例6: buttonShift

static QSize buttonShift(const QwtLegendItem *w)
{
#if QT_VERSION < 0x040000
    const int ph = w->style().pixelMetric(
        QStyle::PM_ButtonShiftHorizontal, w);
    const int pv = w->style().pixelMetric(
        QStyle::PM_ButtonShiftVertical, w);
#else
    QStyleOption option;
    option.init(w);

    const int ph = w->style()->pixelMetric(
        QStyle::PM_ButtonShiftHorizontal, &option, w);
    const int pv = w->style()->pixelMetric(
        QStyle::PM_ButtonShiftVertical, &option, w);
#endif
    return QSize(ph, pv);
}
开发者ID:elcuco,项目名称:data_mining_demo,代码行数:18,代码来源:qwt_legend_item.cpp

示例7: paintEvent

/*! 
   \brief Qt Paint Event
   \param event Paint event
*/
void QwtWheel::paintEvent( QPaintEvent *event )
{
    QPainter painter( this );
    painter.setClipRegion( event->region() );

    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

    qDrawShadePanel( &painter, 
        contentsRect(), palette(), true, d_data->borderWidth );

    drawWheelBackground( &painter, wheelRect() );
    drawTicks( &painter, wheelRect() );

    if ( hasFocus() )
        QwtPainter::drawFocusRect( &painter, this );
}
开发者ID:TheLortex,项目名称:Robotique-MJC-2011,代码行数:22,代码来源:qwt_wheel.cpp

示例8: setOrientation

//-----------------------------------------------------------------------------
void ctkExpandButton::setOrientation(Qt::Orientation newOrientation)
{
  Q_D(ctkExpandButton);
  QStyleOption opt;
  opt.init(this);
  if(newOrientation == Qt::Horizontal)
    {
    d->defaultPixmap = this->style()->standardPixmap(
        QStyle::SP_ToolBarHorizontalExtensionButton, &opt);
    d->orientation = Qt::Horizontal;
    }
  else
    {
    d->defaultPixmap = this->style()->standardPixmap(
        QStyle::SP_ToolBarVerticalExtensionButton, &opt);
    d->orientation = Qt::Vertical;
    }
  this->updateIcon(d->direction);
}
开发者ID:jhnstrk,项目名称:CTK,代码行数:20,代码来源:ctkExpandButton.cpp

示例9: paintEvent

/*!
   Qt paint event handler
   \param event Paint event
*/
void QwtSlider::paintEvent( QPaintEvent *event )
{
    QPainter painter( this );
    painter.setClipRegion( event->region() );

    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

    if ( d_data->scalePosition != QwtSlider::NoScale )
    {
        if ( !d_data->sliderRect.contains( event->rect() ) )
            scaleDraw()->draw( &painter, palette() );
    }

    drawSlider( &painter, d_data->sliderRect );

    if ( hasFocus() )
        QwtPainter::drawFocusRect( &painter, this, d_data->sliderRect );
}
开发者ID:151706061,项目名称:sofa,代码行数:24,代码来源:qwt_slider.cpp

示例10: minimumSizeHint

/*!
  \brief Return a minimum size hint
*/
QSize QwtArrowButton::minimumSizeHint() const
{
    const QSize asz = arrowSize( Qt::RightArrow, QSize() );

    QSize sz(
        2 * Margin + ( MaxNum - 1 ) * Spacing + MaxNum * asz.width(),
        2 * Margin + asz.height()
    );

    if ( d_data->arrowType == Qt::UpArrow || d_data->arrowType == Qt::DownArrow )
        sz.transpose();

    QStyleOption styleOption;
    styleOption.init( this );

    sz = style()->sizeFromContents( QStyle::CT_PushButton,
        &styleOption, sz, this );

    return sz;
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:23,代码来源:qwt_arrow_button.cpp

示例11: paintEvent

void GroupButton::paintEvent(QPaintEvent *) {
    QStyleOption opt;
    opt.init(this);
    QPainter painter(this);
    QPen pen(Qt::white, 5);
    painter.setPen(pen);

    QPainterPath path;
    path.addRect(this->rect());

    if (mButtonState == EGroupButtonState::clearAll) {
        painter.fillPath(path, QBrush(computeHighlightColor(mCheckedCount, mReachableCount)));
    } else {
        painter.fillPath(path, QBrush(QColor(32, 31, 31, 255)));
    }

    if (mIsSelected) {
        painter.drawPath(path);
    }
}
开发者ID:timsee,项目名称:Corluma,代码行数:20,代码来源:groupbutton.cpp

示例12: paintEvent

void CUiWidget_win::paintEvent(QPaintEvent *event)
{
	QStyleOption		opt;
	QPainter			p(this);
	QRect				r;
    //QPainterPath		path;
    //QRegion				region;
    //int					xroundness = 1, yroundness = 2;

	r = rect();
	opt.init(this);

    /*
	// isMaximized doesn't work here, because we change
	// the maximize logic, we can use the new 'widgetState' method
	if (isFullScreen() || widgetState() == Qt::WindowMaximized )
	{
		setMask(region);
	}
	else
	{
        path.addRoundRect(0, 0, r.width(), r.height(), xroundness, yroundness);
        p.setClipPath(path);
        region = p.clipRegion();
        setMask(region);
	}
    */
    QPalette    defaultPalette = QApplication::palette(this);
    /*
    QColor      c;
    QPixmap     pixmap(":/res/icons/woodbackground.png");

    for (int i = 0; i < QPalette::NColorGroups; ++i)
    {
        c = defaultPalette.brush(QPalette::ColorGroup(i), QPalette::Window).color();
        defaultPalette.setBrush(QPalette::ColorGroup(i), QPalette::Window, pixmap);
    }
    */
    setPalette(defaultPalette);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
开发者ID:jetcodes,项目名称:JetMind,代码行数:41,代码来源:CUiWidget_win.cpp

示例13: paintEvent

void MasterSlider::paintEvent(QPaintEvent *event)
{
    QPainter p(this);
    p.setPen(Qt::black);
    p.rotate(180);
    p.setRenderHint(QPainter::Antialiasing);
    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
    QColor myPenColor = QColor(0,0,0,255);
    QBrush *brush = new QBrush(myPenColor,Qt::SolidPattern);
    p.setPen(myPenColor);
    p.setBrush(*brush);

    unsigned short * levels = controllerm->getLevels(1);
    y = -300;
    int g = 0;
    for(int i = 0;i < numOuts;i++)
    {
        if(i == 4)
        {
            g = 0;
            y = -600;
        }
        x = -40 * (g + 1);
        unsigned short lax = levels[i];
        volRect = new QRect(x,y,30,lax/200);

        p.drawRect(*volRect);
        p.rotate(180);

        QString text = "";
        QString text2 = QString::number(i + 1);

        p.drawText(-x - 25,-y + 100, text.append(text2));
        p.rotate(180);
        g++;

    }
    p.rotate(180);
}
开发者ID:benwellard,项目名称:MixerFinal,代码行数:41,代码来源:masterslider.cpp

示例14: paintEvent

    void LiveChatMembersControl::paintEvent(QPaintEvent* _e)
    {
        QStyleOption opt;
        opt.init(this);

        QPainter painter(this);

        painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing);

        style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

        int maxCount = (geometry().width() - sv(avatarWithFrameHeight)) / (sv(avatarWithFrameHeight) - sv(avatarIntersection) - sv(frameWidth)) + 1;

        int xOffset = 0;
        
        for (const auto& chat : members_)
        {
            if (maxCount <= 0)
                break;

            painter.setBrush(Qt::white);
            painter.setPen(Qt::white);

            painter.drawEllipse(xOffset, 0, sv(avatarWithFrameHeight), sv(avatarWithFrameHeight));

            bool isDefault = false;
            const auto &avatar = Logic::GetAvatarStorage()->GetRounded(chat.first, chat.second, Utils::scale_bitmap(sv(avatarHeight)), QString(), true, isDefault);

            if (!avatar->isNull())
            {
                painter.drawPixmap(xOffset + sv(frameWidth), sv(frameWidth), sv(avatarHeight), sv(avatarHeight), *avatar);
            }

            xOffset += sv(avatarWithFrameHeight) - sv(avatarIntersection) - sv(frameWidth);

            --maxCount;
        }


        return QWidget::paintEvent(_e);
    }
开发者ID:ICoderXI,项目名称:icqdesktop,代码行数:41,代码来源:LiveChatMembersControl.cpp

示例15: paintEvent

void ListMoodPreviewWidget::paintEvent(QPaintEvent *) {
    QStyleOption opt;
    opt.init(this);
    QPainter painter(this);
    QPen pen(Qt::white, 5);
    painter.setPen(pen);

    QPainterPath path;
    path.addRect(this->rect());

    painter.setRenderHint(QPainter::Antialiasing);
    if (mIsChecked) {
        painter.fillRect(this->rect(), QBrush(QColor(61, 142, 201)));
    } else {
        painter.fillRect(this->rect(), QBrush(QColor(32, 31, 31)));
    }

    if (mIsSelected) {
        painter.drawPath(path);
    }
}
开发者ID:timsee,项目名称:Corluma,代码行数:21,代码来源:listmoodpreviewwidget.cpp


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