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


C++ QAbstractButton::setIcon方法代码示例

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


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

示例1: updateButtons

void QDockWidgetPrivate::updateButtons()
{
    Q_Q(QDockWidget);
    QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);

    QStyleOptionDockWidget opt;
    q->initStyleOption(&opt);

    bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
    bool nativeDeco = dwLayout->nativeWindowDeco();
    bool hideButtons = nativeDeco || customTitleBar;

    bool canClose = hasFeature(this, QDockWidget::DockWidgetClosable);
    bool canFloat = hasFeature(this, QDockWidget::DockWidgetFloatable);

    QAbstractButton *button
        = qobject_cast<QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::FloatButton));
    button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q));
    button->setVisible(canFloat && !hideButtons);

    button
        = qobject_cast <QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::CloseButton));
    button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q));
    button->setVisible(canClose && !hideButtons);

    q->setAttribute(Qt::WA_ContentsPropagated,
                    (canFloat || canClose) && !hideButtons);

    layout->invalidate();
}
开发者ID:phen89,项目名称:rtqt,代码行数:30,代码来源:qdockwidget.cpp

示例2: QWizard

FirstRunWizard::FirstRunWizard(QWidget* parent, Qt::WindowFlags flags)
        : QWizard(parent, flags)
{
    setWindowTitle(tr("Shaman first run"));

    addPage(new IntroPage);
    addPage(new SecurityPage);
    addPage(new ConfigurationPage);
#ifdef KDE4_INTEGRATION
    addPage(new KDEPage);
#endif
    addPage(new FinishPage);

#ifdef KDE4_INTEGRATION
    QAbstractButton *bt = button(CancelButton);
    bt->setIcon(KIcon("dialog-close"));
    setButton(CancelButton, bt);

    bt = button(BackButton);
    bt->setIcon(KIcon("go-previous"));
    setButton(BackButton, bt);

    bt = button(NextButton);
    bt->setIcon(KIcon("go-next"));
    bt->setLayoutDirection(Qt::RightToLeft);
    setButton(NextButton, bt);
#endif

    setButtonText(CancelButton, tr("Skip wizard"));
    setButtonText(NextButton, tr("Next"));
    setButtonText(BackButton, tr("Back"));
}
开发者ID:drf,项目名称:shaman1,代码行数:32,代码来源:firstrunwizard.cpp

示例3: QToolButton

QAbstractButton *FormMultiWidget::makeButton(const QIcon &icon, const char *slot)
{
    QAbstractButton *btn = new QToolButton(this);
    btn->setIcon(icon);
    btn->setFixedSize(icon.availableSizes().first() /* + something */);
    btn->setFocusPolicy(Qt::NoFocus);
    connect(btn, SIGNAL(clicked()), slot);
    return btn;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:9,代码来源:messageeditorwidgets.cpp

示例4: on_buttonNewGame_clicked

void TicTacToe::on_buttonNewGame_clicked()
{
	QListIterator<QAbstractButton *> i(gameField->buttons());
	while (i.hasNext())
	{
		QAbstractButton *qab = i.next();
		qab->setEnabled(true);
		qab->setIcon(QIcon());
		qab->setWhatsThis("");
	}
	buttonNewGame->setEnabled(false);
	switchPlayer();
}
开发者ID:CodeGamer,项目名称:Labyrinth,代码行数:13,代码来源:TicTacToe.cpp

示例5: setButtonIcon

void Dialog::setButtonIcon(ButtonCode button, const QIcon &icon) {
    QAbstractButton *b = getButton(button);
    if (b) {
        b->setIcon(icon);
    }
}
开发者ID:CDrummond,项目名称:carbon,代码行数:6,代码来源:dialog.cpp

示例6: QWidget

SlideShow::SlideShow(QWidget *parent)
    : QWidget(parent)
    , imageViewer(0)
    , playlist(0)
    , statusLabel(0)
    , countdownLabel(0)
    , playButton(0)
    , stopButton(0)
    , viewerLayout(0)
{
    imageViewer = new QMediaImageViewer(this);

    connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
            this, SLOT(stateChanged(QMediaImageViewer::State)));
    connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
            this, SLOT(statusChanged(QMediaImageViewer::MediaStatus)));
    connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int)));

    playlist = new QMediaPlaylist;
    imageViewer->bind(playlist);

    connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
    connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));

    connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
    connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));

    QVideoWidget *videoWidget = new QVideoWidget;
    imageViewer->bind(videoWidget);

    statusLabel = new QLabel(tr("%1 Images").arg(0));
    statusLabel->setAlignment(Qt::AlignCenter);

    viewerLayout = new QStackedLayout;
    viewerLayout->setStackingMode(QStackedLayout::StackAll);
    viewerLayout->addWidget(videoWidget);
    viewerLayout->addWidget(statusLabel);

    statusLabel = new QLabel(tr("%1 Images").arg(0));
    statusLabel->setAlignment(Qt::AlignCenter);

    viewerLayout = new QStackedLayout;
    viewerLayout->setStackingMode(QStackedLayout::StackAll);
    viewerLayout->addWidget(videoWidget);
    viewerLayout->addWidget(statusLabel);

    QMenu *openMenu = new QMenu(this);
    openMenu->addAction(tr("Directory..."), this, SLOT(openDirectory()));
    openMenu->addAction(tr("Playlist..."), this, SLOT(openPlaylist()));

    QToolButton *openButton = new QToolButton;
    openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
    openButton->setMenu(openMenu);
    openButton->setPopupMode(QToolButton::InstantPopup);

    playButton = new QToolButton;
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
    playButton->setEnabled(false);

    connect(playButton, SIGNAL(clicked()), this, SLOT(play()));
    connect(this, SIGNAL(enableButtons(bool)), playButton, SLOT(setEnabled(bool)));

    stopButton = new QToolButton;
    stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
    stopButton->setEnabled(false);

    connect(stopButton, SIGNAL(clicked()), imageViewer, SLOT(stop()));

    QAbstractButton *nextButton = new QToolButton;
    nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward));
    nextButton->setEnabled(false);

    connect(nextButton, SIGNAL(clicked()), playlist, SLOT(next()));
    connect(this, SIGNAL(enableButtons(bool)), nextButton, SLOT(setEnabled(bool)));

    QAbstractButton *previousButton = new QToolButton;
    previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward));
    previousButton->setEnabled(false);

    connect(previousButton, SIGNAL(clicked()), playlist, SLOT(previous()));
    connect(this, SIGNAL(enableButtons(bool)), previousButton, SLOT(setEnabled(bool)));

    countdownLabel = new QLabel;

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addStretch(1);
    controlLayout->addWidget(previousButton);
    controlLayout->addWidget(stopButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(nextButton);
    controlLayout->addStretch(1);
    controlLayout->addWidget(countdownLabel);

    QBoxLayout *layout = new QVBoxLayout;
    layout->addLayout(viewerLayout);
    layout->addLayout(controlLayout);

    setLayout(layout);
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:101,代码来源:slideshow.cpp


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