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


C++ QToolButton::setIconSize方法代码示例

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


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

示例1: createPlayWidgetActions

void MusicSystemTrayMenu::createPlayWidgetActions()
{
    m_widgetAction = new QWidgetAction(this);
    QWidget *widgetActionContainer = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout(widgetActionContainer);
    vbox->setMargin(0);

    QWidget *widgetContainer = new QWidget(widgetActionContainer);
    QHBoxLayout *box = new QHBoxLayout(widgetContainer);
    box->setMargin(0);

    QToolButton *previousPlay = new QToolButton(widgetContainer);
    QToolButton *nextPlay = new QToolButton(widgetContainer);
    m_PlayOrStop = new QToolButton(widgetContainer);

    previousPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysprevious")));
    nextPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysnext")));
    m_PlayOrStop->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysplay")));

    previousPlay->setIconSize(QSize(40, 40));
    nextPlay->setIconSize(QSize(40, 40));
    m_PlayOrStop->setIconSize(QSize(45, 45));

    previousPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
    nextPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
    m_PlayOrStop->setStyleSheet(MusicUIObject::MToolButtonStyle01);

    previousPlay->setCursor(QCursor(Qt::PointingHandCursor));
    nextPlay->setCursor(QCursor(Qt::PointingHandCursor));
    m_PlayOrStop->setCursor(QCursor(Qt::PointingHandCursor));

    previousPlay->setToolTip(tr("Previous"));
    nextPlay->setToolTip(tr("Next"));
    m_PlayOrStop->setToolTip(tr("Play"));

    box->addWidget(previousPlay);
    box->addWidget(m_PlayOrStop);
    box->addWidget(nextPlay);

    m_showText = new QLabel(widgetActionContainer);
    m_showText->setAlignment(Qt::AlignCenter);
    m_showText->setStyleSheet(MusicUIObject::MCustomStyle12);
    vbox->addWidget(widgetContainer);
    vbox->addWidget(m_showText);
    widgetActionContainer->setLayout(vbox);
    m_widgetAction->setDefaultWidget(widgetActionContainer);

    connect(previousPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayPrevious()));
    connect(nextPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayNext()));
    connect(m_PlayOrStop, SIGNAL(clicked()), parent(), SLOT(musicStatePlay()));
}
开发者ID:AndyQsmart,项目名称:TTKMusicplayer,代码行数:51,代码来源:musicsystemtraymenu.cpp

示例2: parseROSParameters

  EmptyServiceCallInterfaceAction::EmptyServiceCallInterfaceAction( QWidget* parent )
    : rviz::Panel( parent )
  {
    parseROSParameters();

    QHBoxLayout* h_layout = new QHBoxLayout;
    h_layout->setAlignment(Qt::AlignLeft);
    layout = new QVBoxLayout();
    signal_mapper = new QSignalMapper(this);

    for(size_t i = 0; i < service_call_button_infos_.size();i++){
      ServiceCallButtonInfo target_button = service_call_button_infos_[i];
      QToolButton* tbutton = new QToolButton(this);
      tbutton->setText(target_button.text.c_str());
      tbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
      tbutton->setIconSize(QSize(100, 100));
      tbutton->setIcon(QIcon(QPixmap(QString(target_button.icon_file_path.c_str()))));
      connect(tbutton, SIGNAL(clicked()), signal_mapper, SLOT(map()));
      signal_mapper->setMapping(tbutton, i);
      h_layout->addWidget(tbutton);
    };
    connect(signal_mapper, SIGNAL(mapped(int)),
            this, SLOT(callRequestEmptyCommand(int)));
    layout->addLayout(h_layout);
    setLayout( layout );
  }
开发者ID:AtsushiSakai,项目名称:jsk_visualization,代码行数:26,代码来源:empty_service_call_interface.cpp

示例3: createWidget

QWidget *KToolBarPopupAction::createWidget(QWidget *_parent)
{
    QToolBar *parent = qobject_cast<QToolBar *>(_parent);
    if (!parent) {
        return QWidgetAction::createWidget(_parent);
    }
    QToolButton *button = new QToolButton(parent);
    button->setAutoRaise(true);
    button->setFocusPolicy(Qt::NoFocus);
    button->setIconSize(parent->iconSize());
    button->setToolButtonStyle(parent->toolButtonStyle());
    button->setDefaultAction(this);

    connect(parent, &QToolBar::iconSizeChanged,
            button, &QAbstractButton::setIconSize);
    connect(parent, &QToolBar::toolButtonStyleChanged,
            button, &QToolButton::setToolButtonStyle);
    connect(button, &QToolButton::triggered,
            parent, &QToolBar::actionTriggered);

    if (d->delayed)
        if (d->stickyMenu) {
            button->setPopupMode(QToolButton::MenuButtonPopup);
        } else {
            button->setPopupMode(QToolButton::DelayedPopup);
        }
    else {
        button->setPopupMode(QToolButton::InstantPopup);
    }

    return button;
}
开发者ID:SpiritSPb,项目名称:kwidgetsaddons,代码行数:32,代码来源:ktoolbarpopupaction.cpp

示例4: addAlert

QtChatWindow::AlertID QtChatWindow::addAlert(const std::string& alertText) {
	QWidget* alertWidget = new QWidget(this);
	QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget);
	alertLayout_->addWidget(alertWidget);
	QLabel* alertLabel = new QLabel(this);
	alertLabel->setText(alertText.c_str());
	alertLayout->addWidget(alertLabel);

	QToolButton* closeButton = new QToolButton(alertWidget);
	closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
	closeButton->setIconSize(QSize(16,16));
	closeButton->setCursor(Qt::ArrowCursor);
	closeButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
	connect (closeButton, SIGNAL(clicked()), this, SLOT(handleAlertButtonClicked()));

	alertLayout->addWidget(closeButton);
	QPalette palette = alertWidget->palette();
	palette.setColor(QPalette::Window, QColor(Qt::yellow));
	palette.setColor(QPalette::WindowText, QColor(Qt::black));
	alertWidget->setStyleSheet(alertStyleSheet_);
	alertLabel->setStyleSheet(alertStyleSheet_);

	AlertID id = nextAlertId_++;
	alertWidgets_[id] = alertWidget;
	return id;
}
开发者ID:jyhong836,项目名称:swift,代码行数:26,代码来源:QtChatWindow.cpp

示例5: QToolButton

QWidget* ToolAction::createWidget( QWidget *parent )
{
    QToolBar *toolBar = qobject_cast< QToolBar * >( parent );
    if ( !toolBar )
        return 0;

    QToolButton *button = new QToolButton( toolBar );
    button->setAutoRaise( true );
    button->setFocusPolicy( Qt::NoFocus );
    button->setIconSize( toolBar->iconSize() );
    button->setToolButtonStyle( toolBar->toolButtonStyle() );
    button->setPopupMode( QToolButton::DelayedPopup );
    button->setMenu( new QMenu( button ) );
    button->setCheckable( true );
    connect(toolBar, &QToolBar::iconSizeChanged, button, &QToolButton::setIconSize);
    connect(toolBar, &QToolBar::toolButtonStyleChanged, button, &QToolButton::setToolButtonStyle);
    connect(button, &QToolButton::triggered, toolBar, &QToolBar::actionTriggered);
    connect( button->menu(), &QMenu::triggered, this, &ToolAction::slotNewDefaultAction );

    m_buttons.append( button );

    if ( !m_actions.isEmpty() )
    {
        button->setDefaultAction( m_actions.first() );
        foreach ( QAction *action, m_actions )
        {
            button->menu()->addAction( action );
            if ( action->isChecked() )
                button->setDefaultAction( action );
        }
开发者ID:KDE,项目名称:okular,代码行数:30,代码来源:toolaction.cpp

示例6: clearIcon

dtkSearchField::dtkSearchField(QWidget *parent) : QWidget(parent)
{
    QLineEdit *lineEdit = new QLineEdit(this);
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SIGNAL(textChanged(QString)));
    connect(lineEdit, SIGNAL(editingFinished()),
            this, SIGNAL(editingFinished()));
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setText(QString)));

    QToolButton *clearButton = new QToolButton(this);
    QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
    clearButton->setIcon(QIcon(clearIcon));
    clearButton->setIconSize(clearIcon.size());
    clearButton->setFixedSize(clearIcon.size());
    clearButton->setStyleSheet("border: none;");
    clearButton->hide();
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));

    d = new dtkSearchFieldPrivate(this, lineEdit, clearButton);

    lineEdit->setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(d->clearButtonPaddedWidth()));
    const int width = qMax(lineEdit->minimumSizeHint().width(), d->clearButtonPaddedWidth());
    const int height = qMax(lineEdit->minimumSizeHint().height(), d->clearButtonPaddedHeight());
    lineEdit->setMinimumSize(width, height);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(lineEdit);
}
开发者ID:NicolasSchnitzler,项目名称:dtk,代码行数:30,代码来源:dtkSearchField.cpp

示例7: genOptions

void SettingsWindow::genOptions()
{
    QCheckBox *checkPlugins = new QCheckBox(tr("Enable Plugins"));
    QCheckBox *checkJava = new QCheckBox(tr("Enable Java"));
    QCheckBox *checkJavaScript = new QCheckBox(tr("Enable JavaScript"));
    QCheckBox *checkJavascriptCanOpenWindows = new QCheckBox(tr("JavaScript can open windows"));
    QCheckBox *checkJavascriptCanAccessClipboard = new QCheckBox(tr("JavaScript can access clipboard"));

    QToolButton *btnCheckAll = new QToolButton;
    btnCheckAll->setIcon(QIcon(":/img/menu.png"));
    btnCheckAll->setIconSize(QSize(0,0));
    btnCheckAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnCheckAll->setText(tr("Select all"));
    btnCheckAll->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

    // --------------------------

    QWidget *spacer = new QWidget;
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSpacing(10);
    mainLayout->setContentsMargins(0,10,0,0);
    mainLayout->addWidget(checkPlugins);
    mainLayout->addWidget(checkJava);
    mainLayout->addWidget(checkJavaScript);
    mainLayout->addWidget(checkJavascriptCanOpenWindows);
    mainLayout->addWidget(checkJavascriptCanAccessClipboard);
    mainLayout->addWidget(btnCheckAll);
    mainLayout->addWidget(spacer);

    tabOptions = new SettingsPanel;
    tabOptions->setTitle(tr("Options"));
    tabOptions->setMainLayout(mainLayout);
}
开发者ID:gustawho,项目名称:dooscape,代码行数:35,代码来源:settingswindow.cpp

示例8: UpdateRecentProjects

void WelcomeWidget::UpdateRecentProjects(
    const QVector<RecentProject> &recent_projects) {
  ui->tableWidgetRecent->clearContents();
  ui->tableWidgetRecent->setRowCount(recent_projects.count());
  int row = 0;
  QSignalMapper *mapper = new QSignalMapper;
  for (const RecentProject &recent_project : recent_projects) {
    QTableWidgetItem *item_name = new QTableWidgetItem(recent_project.name());
    QTableWidgetItem *item_path = new QTableWidgetItem(recent_project.path());
    QToolButton *erase = new QToolButton;
    erase->setStyleSheet("border: 0;");
    erase->setCursor(QCursor(Qt::PointingHandCursor));
    erase->setIcon(QIcon(":/icons/images/remove.png"));
    erase->setIconSize(QSize(12, 12));
    connect(erase, SIGNAL(clicked()), mapper, SLOT(map()));
    mapper->setMapping(erase, row);
    QFont font = item_name->font();
    font.setBold(true);
    item_name->setFont(font);
    item_name->setToolTip(recent_project.name());
    item_path->setToolTip(recent_project.path());
    ui->tableWidgetRecent->setIndexWidget(
          ui->tableWidgetRecent->model()->index(row, 0), erase);
    ui->tableWidgetRecent->setItem(row, 1, item_name);
    ui->tableWidgetRecent->setItem(row, 2, item_path);
    ++row;
  }
  connect(mapper, SIGNAL(mapped(int)),
          parent_, SLOT(RemoveRecentProject(int)));
}
开发者ID:joachimvalente,项目名称:tracklib,代码行数:30,代码来源:welcomewidget.cpp

示例9: createToolButton

QToolButton* OurUserItemWidget::createToolButton(const QIcon& icon, const QSize iconSize, const QString& toolTip)
{
    QToolButton* toolButton = new QToolButton(this);
    toolButton->setIcon(icon);
    toolButton->setIconSize(iconSize);
    toolButton->setToolTip(toolTip);
    toolButton->setAutoRaise(true);

    return toolButton;
}
开发者ID:SwordBearer,项目名称:ProjectTox-Qt-GUI,代码行数:10,代码来源:ouruseritemwidget.cpp

示例10: getButton

QToolButton* ProcessingManager::getButton(const QString& icon, const QString& text, const QString& tooltip) {
    QToolButton* button = new QToolButton();
    button->setIcon(ApplicationData::icon(icon));
    button->setText(text);
    button->setIconSize(QSize(32, 32));
    button->setFixedHeight(60);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setToolTip("Remove all images from queue");
    return button;
}
开发者ID:C-CINA,项目名称:2dx,代码行数:10,代码来源:ProcessingManager.cpp

示例11: connect

/**
 * function that emulates button factory:)
 * @param icon
 * @param tip
 * @param dstobj
 * @param slot_method
 * @param layout
 * @return 
 */
QToolButton *MediaApp::initButton(QStyle::StandardPixmap icon, const QString & tip, QObject* dstobj, const char* slot_method, QLayout* layout) {
    QToolButton* button = new QToolButton;
    button->setIcon(style()->standardIcon(icon));
    button->setIconSize(QSize(20, 20));
    button->setToolTip(tip);
    connect(button, SIGNAL(clicked()), dstobj, slot_method);
    layout->addWidget(button);

    return button;
}
开发者ID:helcl42,项目名称:Streaming,代码行数:19,代码来源:MediaApp.cpp

示例12: QLabel

MusicSongsSummariziedFloatWidget::MusicSongsSummariziedFloatWidget(QWidget *parent)
    : QLabel(parent)
{
    setWindowFlags( Qt::Window | Qt::FramelessWindowHint );
    setObjectName("MainWidget");
    setStyleSheet("#MainWidget{background:rgba(0, 0, 0, 60);}");

    resize(60, 25);
    MusicUtils::widgetToRound(this, 10, 10);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    QToolButton *locationButton = new QToolButton(this);
    QToolButton *searchButton = new QToolButton(this);
    layout->addWidget(locationButton);
    layout->addWidget(searchButton);

    locationButton->setIcon(QIcon(QString::fromUtf8(":/appTools/location")));
    locationButton->setIconSize(QSize(20, 20));
    locationButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    locationButton->setCursor(QCursor(Qt::PointingHandCursor));
    searchButton->setIcon(QIcon(QString::fromUtf8(":/appTools/search")));
    searchButton->setIconSize(QSize(20, 20));
    searchButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    searchButton->setCursor(QCursor(Qt::PointingHandCursor));
    connect(locationButton, SIGNAL(clicked()), SIGNAL(musicCurrentPlayLocation()));
    connect(searchButton, SIGNAL(clicked()), SIGNAL(musicSearch()));

    m_currentAnimationValue = 1;
    m_timer.setInterval(3*1000);
    connect(&m_timer, SIGNAL(timeout()), SLOT(leaveTimeout()));

    m_animation = new QPropertyAnimation(this, "windowOpacity");
    m_animation->setDuration(1000);
    connect(m_animation, SIGNAL(finished()), SLOT(animationFinished()));

    M_CONNECTION->setValue("MusicSongsSummariziedFloatWidget", this);
    M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicBottomAreaWidget");
    M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicApplication");
    m_timer.start();
}
开发者ID:aquarius20th,项目名称:QT_TTKMusicplayer,代码行数:42,代码来源:musicsongssummariziedfloatwidget.cpp

示例13: QToolButton

QToolButton* 
EchonestSteerer::initButton( QWidget* parent )
{
    QToolButton* btn = new QToolButton( parent );
    btn->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
    btn->setIconSize( QSize( 14, 14 ) );
    btn->setToolButtonStyle( Qt::ToolButtonIconOnly );
    btn->setAutoRaise( true );
    btn->setContentsMargins( 0, 0, 0, 0 );
    return btn;
}
开发者ID:LittleForker,项目名称:tomahawk,代码行数:11,代码来源:EchonestSteerer.cpp

示例14: QToolButton

QToolButton *
PlayerWidget::createToolButton(QWidget *parent, const char *name, int size)
{
	QToolButton *toolButton = new QToolButton(parent);
	toolButton->setObjectName(name);
	toolButton->setMinimumSize(size, size);
	toolButton->setIconSize(size >= 32 ? QSize(size - 6, size - 6) : QSize(size, size));
	toolButton->setAutoRaise(true);
	toolButton->setFocusPolicy(Qt::NoFocus);
	return toolButton;
}
开发者ID:arthurtiteica,项目名称:subtitlecomposer,代码行数:11,代码来源:playerwidget.cpp

示例15: createButton

QToolButton* DiagramToolBox::createButton(QAction* action)
{
	int size = 1.8 * QFontMetrics(font()).height();

	QToolButton* newButton = new QToolButton();
	newButton->setDefaultAction(action);
	newButton->setToolTip(action->text());
	newButton->setIconSize(QSize(size, size));

	return newButton;
}
开发者ID:jaallen85,项目名称:jade-legacy,代码行数:11,代码来源:DiagramToolBox.cpp


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