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


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

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


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

示例1: addEmoticon

/*! Add smileys by setting a imgage file and a textlist of textual representations. */
void EmoticonMenu::addEmoticon(const QString &imgPath, const QStringList &texts)
{
    QToolButton *button = new QToolButton(this);
    button->setIcon(QIcon(imgPath));
    button->setAutoRaise(true);
    button->setToolTip(texts.first());
    button->setProperty("smiley", QString("<img src=\"%1\" />").arg(imgPath));
    connect(button, &QToolButton::clicked, this, &EmoticonMenu::onEmoticonTriggered);
    connect(button, &QToolButton::clicked, this, &EmoticonMenu::close);

    layout->addWidget(button, layout->count()/5, layout->count()%5);
    getSmileyHash().insert(imgPath, texts);
}
开发者ID:lance0,项目名称:ProjectTox-Qt-GUI,代码行数:14,代码来源:emoticonmenu.cpp

示例2: foreach

 foreach (MVAbstractViewFactory* f, factories) {
     QToolButton* button = new QToolButton;
     QFont font = button->font();
     font.setPixelSize(14);
     button->setFont(font);
     button->setText(f->name());
     button->setProperty("action_name", f->id());
     d->m_flow_layout->addWidget(button);
     d->m_viewMapper->setMapping(button, f);
     QObject::connect(button, SIGNAL(clicked()), d->m_viewMapper, SLOT(map()));
     //QObject::connect(f, SIGNAL(enabledChanged(bool)), button, SLOT(setEnabled(bool)));
     d->m_buttons[f->name()] = button;
 }
开发者ID:magland,项目名称:mountainlab,代码行数:13,代码来源:mvopenviewscontrol.cpp

示例3: createWidget

Core::NavigationView FolderNavigationWidgetFactory::createWidget()
{
    Core::NavigationView n;
    FolderNavigationWidget *fnw = new FolderNavigationWidget;
    n.widget = fnw;
    QToolButton *filter = new QToolButton;
    filter->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));
    filter->setToolTip(tr("Filter Files"));
    filter->setPopupMode(QToolButton::InstantPopup);
    filter->setProperty("noArrow", true);
    QMenu *filterMenu = new QMenu(filter);
    filterMenu->addAction(fnw->m_filterHiddenFilesAction);
    filter->setMenu(filterMenu);
    n.dockToolBarWidgets << filter << fnw->m_toggleSync;
    return n;
}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:16,代码来源:foldernavigationwidget.cpp

示例4: newToolButton

QToolButton* courseEditDockWidget::newToolButton(int cp_num, int cr_num, const QIcon& icon, const QString& text)
{
	Q_UNUSED(icon);
	QToolButton* button = new QToolButton();
	button->setToolButtonStyle(Qt::ToolButtonIconOnly);
	button->setToolTip(text);
	button->setProperty("name",cr_num);

	Symbol* symstr;
	for (int i=0; i<controller->getMap()->getNumSymbols(); i++)
	{
		symstr=controller->getMap()->getSymbol(i);
		if (symstr->getNumberAsString()==reinterpret_cast<courseWidget::cpVector*>(cw->getcontrolpoints(rownum))->at(cp_num)->value(cw->xml_names[cr_num]))
		{
			button->setIcon(QPixmap::fromImage(symstr->getIcon(controller->getMap(),false).copy()));
			break;
		}
	}
	button->setText(text);
	button->setWhatsThis("<a href=\"courses.html#setup\">See more</a>");
	return button;
}
开发者ID:aivarszo,项目名称:mapper,代码行数:22,代码来源:course_edit_dock_widget.cpp

示例5: QWidget

weapon_filter_quick_opt_widget::weapon_filter_quick_opt_widget(filter_p f, QWidget* parent)
    : QWidget( parent )
    , filter_( *static_cast<weapon_filter*>( f.get() ) )

{
    QHBoxLayout* lay = new QHBoxLayout(this);
    lay->setContentsMargins(0, 0, 0, 0);
    
    group_ = new QButtonGroup(this);
    group_->setExclusive(false);
    
    BOOST_FOREACH(Gear g, forbidden( AllGear ) ) {
        QToolButton* tb = new QToolButton( this );
        tb->setProperty("gear", g);
        tb->setIcon( QIcon( icon(g) ) );
        tb->setToolTip(gear(g));
        tb->setCheckable(true);
        tb->setAutoRaise(true);
        group_->addButton(tb, g);

        lay->addWidget(tb);
    }
开发者ID:keyndark,项目名称:urtconnector,代码行数:22,代码来源:weapon_filter.cpp

示例6: init


//.........这里部分代码省略.........
        StateView *view = m_views.last();
        if (view)
            view->scene()->copy();
    });

    connect(m_actionHandler->action(ActionCut), &QAction::triggered, this, [this]() {
        StateView *view = m_views.last();
        if (view)
            view->scene()->cut();
    });

    connect(m_actionHandler->action(ActionPaste), &QAction::triggered, this, [this]() {
        StateView *view = m_views.last();
        if (view)
            view->scene()->paste(view->view()->mapToScene(QPoint(30, 30)));
    });

    connect(m_actionHandler->action(ActionExportToImage), &QAction::triggered, this, &MainWidget::exportToImage);
    connect(m_actionHandler->action(ActionScreenshot), &QAction::triggered, this, &MainWidget::saveScreenShot);

    connect(m_errorPane->warningModel(), &WarningModel::warningsChanged, this, [this]() {
        m_actionHandler->action(ActionFullNamespace)->setEnabled(m_errorPane->warningModel()->count(Warning::ErrorType) <= 0);
    });

    connect(m_actionHandler->action(ActionFullNamespace), &QAction::triggered, this, [this](bool checked) {
        m_document->setUseFullNameSpace(checked);
    });

    connect(m_actionHandler->action(ActionAlignLeft), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignLeft); });
    connect(m_actionHandler->action(ActionAlignRight), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignRight); });
    connect(m_actionHandler->action(ActionAlignTop), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignTop); });
    connect(m_actionHandler->action(ActionAlignBottom), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignBottom); });
    connect(m_actionHandler->action(ActionAlignHorizontal), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignHorizontal); });
    connect(m_actionHandler->action(ActionAlignVertical), &QAction::triggered, this, [this]() { alignButtonClicked(ActionAlignVertical); });
    connect(m_actionHandler->action(ActionAdjustWidth), &QAction::triggered, this, [this]() { adjustButtonClicked(ActionAdjustWidth); });
    connect(m_actionHandler->action(ActionAdjustHeight), &QAction::triggered, this, [this]() { adjustButtonClicked(ActionAdjustHeight); });
    connect(m_actionHandler->action(ActionAdjustSize), &QAction::triggered, this, [this]() { adjustButtonClicked(ActionAdjustSize); });

    connect(m_actionHandler->action(ActionStatistics), &QAction::triggered, this, [this]() {
        StatisticsDialog dialog;
        dialog.setDocument(m_document);
        dialog.exec();
    });

    // Init ToolButtons
    auto stateColorButton = new ColorToolButton("StateColor", ":/scxmleditor/images/state_color.png", tr("State Color"));
    auto fontColorButton = new ColorToolButton("FontColor", ":/scxmleditor/images/font_color.png", tr("Font Color"));
    QToolButton *alignToolButton = createToolButton(toolButtonIcon(ActionAlignLeft), tr("Align Left"), QToolButton::MenuButtonPopup);
    QToolButton *adjustToolButton = createToolButton(toolButtonIcon(ActionAdjustWidth), tr("Adjust Width"), QToolButton::MenuButtonPopup);

    // Connect state color change
    connect(stateColorButton, &ColorToolButton::colorSelected, [this](const QString &color) {
        StateView *view = m_views.last();
        if (view)
            view->scene()->setEditorInfo(Constants::C_SCXML_EDITORINFO_STATECOLOR, color);
    });

    // Connect font color change
    connect(fontColorButton, &ColorToolButton::colorSelected, [this](const QString &color) {
        StateView *view = m_views.last();
        if (view)
            view->scene()->setEditorInfo(Constants::C_SCXML_EDITORINFO_FONTCOLOR, color);
    });

    // Connect alignment change
    alignToolButton->setProperty("currentAlignment", ActionAlignLeft);
    connect(alignToolButton, &QToolButton::clicked, this, [=] {
        StateView *view = m_views.last();
        if (view)
            view->scene()->alignStates(alignToolButton->property("currentAlignment").toInt());
    });

    // Connect alignment change
    adjustToolButton->setProperty("currentAdjustment", ActionAdjustWidth);
    connect(adjustToolButton, &QToolButton::clicked, this, [=] {
        StateView *view = m_views.last();
        if (view)
            view->scene()->adjustStates(adjustToolButton->property("currentAdjustment").toInt());
    });

    auto alignmentMenu = new QMenu(tr("Alignment"), this);
    for (int i = ActionAlignLeft; i <= ActionAlignVertical; ++i)
        alignmentMenu->addAction(m_actionHandler->action(ActionType(i)));
    alignToolButton->setMenu(alignmentMenu);

    auto adjustmentMenu = new QMenu(tr("Adjustment"), this);
    for (int i = ActionAdjustWidth; i <= ActionAdjustSize; ++i)
        adjustmentMenu->addAction(m_actionHandler->action(ActionType(i)));
    adjustToolButton->setMenu(adjustmentMenu);

    m_toolButtons << stateColorButton << fontColorButton << alignToolButton << adjustToolButton;

    const QSettings *s = Core::ICore::settings();
    m_horizontalSplitter->restoreState(s->value(Constants::C_SETTINGS_SPLITTER).toByteArray());

    m_actionHandler->action(ActionPaste)->setEnabled(false);

    connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
            this, &MainWidget::saveSettings);
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:101,代码来源:mainwidget.cpp

示例7: buildLayout


//.........这里部分代码省略.........

   removeButton->setMenu(removeMenu);

   connect(applyButton, SIGNAL(clicked()), this, SLOT(onShaderApplyClicked()));

   topButtonLayout = new QHBoxLayout();
   topButtonLayout->addWidget(loadButton);
   topButtonLayout->addWidget(saveButton);
   topButtonLayout->addWidget(removeButton);
   topButtonLayout->addWidget(applyButton);

   m_layout->addLayout(topButtonLayout);

   /* NOTE: We assume that parameters are always grouped in order by the pass number, e.g., all parameters for pass 0 come first, then params for pass 1, etc. */
   for (i = 0; avail_shader && i < avail_shader->passes; i++)
   {
      QFormLayout *form = NULL;
      QGroupBox *groupBox = NULL;
      QFileInfo fileInfo(avail_shader->pass[i].source.path);
      QString shaderBasename = fileInfo.completeBaseName();
      QHBoxLayout *filterScaleHBoxLayout = NULL;
      QComboBox *filterComboBox = new QComboBox(this);
      QComboBox *scaleComboBox = new QComboBox(this);
      QToolButton *moveDownButton = NULL;
      QToolButton *moveUpButton = NULL;
      unsigned j = 0;

      /* Sometimes video_shader shows 1 pass with no source file, when there are really 0 passes. */
      if (shaderBasename.isEmpty())
         continue;

      hasPasses = true;

      filterComboBox->setProperty("pass", i);
      scaleComboBox->setProperty("pass", i);

      moveDownButton = new QToolButton(this);
      moveDownButton->setText("↓");
      moveDownButton->setProperty("pass", i);

      moveUpButton = new QToolButton(this);
      moveUpButton->setText("↑");
      moveUpButton->setProperty("pass", i);

      /* Can't move down if we're already at the bottom. */
      if (i < avail_shader->passes - 1)
         connect(moveDownButton, SIGNAL(clicked()), this, SLOT(onShaderPassMoveDownClicked()));
      else
         moveDownButton->setDisabled(true);

      /* Can't move up if we're already at the top. */
      if (i > 0)
         connect(moveUpButton, SIGNAL(clicked()), this, SLOT(onShaderPassMoveUpClicked()));
      else
         moveUpButton->setDisabled(true);

      for (;;)
      {
         QString filterLabel = getFilterLabel(j);

         if (filterLabel.isEmpty())
            break;

         if (j == 0)
            filterLabel = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE);
开发者ID:DSkywalk,项目名称:RetroArch,代码行数:66,代码来源:shaderparamsdialog.cpp

示例8: initExtraControllers

void VPiano::initExtraControllers()
{
    QWidget *w = NULL;
    QCheckBox *chkbox = NULL;
    Knob *knob = NULL;
    QSpinBox *spin = NULL;
    QSlider *slider = NULL;
    QToolButton *button = NULL;
    foreach(const QString& s, m_extraControls) {
        QString lbl;
        int control = 0;
        int type = 0;
        int minValue = 0;
        int maxValue = 127;
        int defValue = 0;
        int value = 0;
        int size = 100;
        QString fileName;
        ExtraControl::decodeString( s, lbl, control, type,
                                    minValue, maxValue, defValue,
                                    size, fileName );
        if (m_ctlState[m_channel].contains(control))
            value = m_ctlState[m_channel][control];
        else
            value = defValue;
        switch(type) {
        case 0:
            chkbox = new QCheckBox(this);
            if (dlgPreferences()->getStyledWidgets()) {
                chkbox->setStyle(m_dialStyle);
            }
            chkbox->setProperty(MIDICTLONVALUE, maxValue);
            chkbox->setProperty(MIDICTLOFFVALUE, minValue);
            chkbox->setChecked(bool(value));
            connect(chkbox, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
            w = chkbox;
            break;
        case 1:
            knob = new Knob(this);
            knob->setFixedSize(32, 32);
            knob->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL);
            knob->setMinimum(minValue);
            knob->setMaximum(maxValue);
            knob->setValue(value);
            knob->setToolTip(QString::number(value));
            knob->setDefaultValue(defValue);
            knob->setDialMode(Knob::LinearMode);
            connect(knob, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int)));
            w = knob;
            break;
        case 2:
            spin = new QSpinBox(this);
            spin->setMinimum(minValue);
            spin->setMaximum(maxValue);
            spin->setValue(value);
            connect(spin, SIGNAL(valueChanged(int)), SLOT(slotExtraController(int)));
            w = spin;
            break;
        case 3:
            slider = new QSlider(this);
            slider->setOrientation(Qt::Horizontal);
            slider->setFixedWidth(size);
            slider->setMinimum(minValue);
            slider->setMaximum(maxValue);
            slider->setToolTip(QString::number(value));
            slider->setValue(value);
            connect(slider, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int)));
            w = slider;
            break;
        case 4:
            button = new QToolButton(this);
            button->setText(lbl);
            button->setProperty(MIDICTLONVALUE, maxValue);
            button->setProperty(MIDICTLOFFVALUE, minValue);
            connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
            w = button;
            break;
        case 5:
            control = 255;
            button = new QToolButton(this);
            button->setText(lbl);
            button->setProperty(SYSEXFILENAME, fileName);
            button->setProperty(SYSEXFILEDATA, readSysexDataFile(fileName));
            connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
            w = button;
            break;
        default:
            w = NULL;
        }
        if (w != NULL) {
            if (!lbl.isEmpty() && type < 4) {
                QLabel *qlbl = new QLabel(lbl, this);
                qlbl->setMargin(TOOLBARLABELMARGIN);
                ui.toolBarExtra->addWidget(qlbl);
                //connect(qlbl, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*)));
            }
            w->setProperty(MIDICTLNUMBER, control);
            w->setFocusPolicy(Qt::NoFocus);
            ui.toolBarExtra->addWidget(w);
            //connect(w, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*)));
//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:vmpk,代码行数:101,代码来源:vpiano.cpp


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