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


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

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


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

示例1: creatToolbar

void MainWindow::creatToolbar()
{
    QToolButton *pointerButton = new QToolButton;
    pointerButton->setCheckable(true);
    pointerButton->setChecked(true);
    pointerButton->setIcon(QIcon(":/images/pointer.png"));

    QToolButton *linkButton = new QToolButton;
    linkButton->setCheckable(true);
    linkButton->setIcon(QIcon(":/images/link.png"));

    pointerTypeGroup = new QButtonGroup;
    pointerTypeGroup->addButton(pointerButton,FDBScene::MoveItem);
    pointerTypeGroup->addButton(linkButton,FDBScene::InsertLine);
    connect(pointerTypeGroup,SIGNAL(buttonClicked(int)),this,SLOT(pointerTypeGroupClicked(int)));

    editToolBar = addToolBar(tr("Edit"));
    editToolBar->addAction(addAndGateAction);
    editToolBar->addAction(addOrGateAction);
    editToolBar->addAction(addOrGateAction);
    editToolBar->addAction(addNotGateAction);
    //...
    editToolBar->addSeparator();

    editToolBar->addAction(cutAction);
    editToolBar->addAction(copyAction);
    editToolBar->addAction(pasteAction);
    editToolBar->addSeparator();
    editToolBar->addAction(deleteAction);
    editToolBar->addAction(bringToFrontAction);
    editToolBar->addAction(sendToBackAction);
    editToolBar->addWidget(pointerButton);
    editToolBar->addWidget(linkButton);
}
开发者ID:SloanAufderstrase,项目名称:QtDemo_GraphicsPaint,代码行数:34,代码来源:mainwindow.cpp

示例2: createToolbars

void fmSegmentsImpl::createToolbars()
{
	mainToolBar = addToolBar(tr("Start"));
	mainToolBar->addAction(startAction);

	editToolBar = addToolBar(tr("Edit"));
  //editToolBar->addAction(deleteAction);
	editToolBar->addAction(clearAction);

	QToolButton *pointerButton = new QToolButton;
  pointerButton->setCheckable(true);
  pointerButton->setIcon(QIcon("./images/pointer.png"));
  QToolButton *linePointerButton = new QToolButton;
  linePointerButton->setCheckable(true);
	linePointerButton->setChecked(true);
  linePointerButton->setIcon(QIcon("./images/linepointer.png"));

  pointerTypeGroup = new QButtonGroup;
  pointerTypeGroup->addButton(pointerButton, int(SegmentScene::MoveSegment));
  pointerTypeGroup->addButton(linePointerButton, int(SegmentScene::InsertSegment));
  connect(pointerTypeGroup, SIGNAL(buttonClicked(int )), this, SLOT(pointerGroupClicked(int )));

	pointerToolbar = addToolBar(tr("Pointer type"));
  pointerToolbar->addWidget(pointerButton);
  pointerToolbar->addWidget(linePointerButton);
}
开发者ID:nikolnikon,项目名称:nonintersecting-segments,代码行数:26,代码来源:fmSegmentsImpl.cpp

示例3: createToolbars

void MainWindow::createToolbars()
{
	QToolButton *dragButton = new QToolButton;
	dragButton->setCheckable(true);
	dragButton->setChecked(true);
	dragButton->setIcon(QIcon(":/images/pointer.png"));

	QToolButton *linePointerButton = new QToolButton;
	linePointerButton->setCheckable(true);
	linePointerButton->setIcon(QIcon(":/images/linepointer.png"));

	m_pointerTypeGroup = new QButtonGroup(this);
	m_pointerTypeGroup->addButton(dragButton, int(BTEditorScene::Mode::Drag));
	m_pointerTypeGroup->addButton(linePointerButton, int(BTEditorScene::Mode::InsertLine));
	connect(m_pointerTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onPointerTypeGroupClicked(int)));

	m_sceneScaleCombo = new QComboBox;
	QStringList scales;
	scales << tr("25%") << tr("50%") << tr("75%") << tr("100%") << tr("150%") << tr("200%");
	m_sceneScaleCombo->addItems(scales);
	m_sceneScaleCombo->setCurrentIndex(3);
	connect(m_sceneScaleCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(onSceneScaleChanged(QString)));

	m_pointerToolbar = addToolBar(tr("pointer"));
	m_pointerToolbar->addWidget(dragButton);
	m_pointerToolbar->addWidget(linePointerButton);
	m_pointerToolbar->addWidget(m_sceneScaleCombo);
}
开发者ID:RayRiver,项目名称:QBTEditor,代码行数:28,代码来源:mainwindow.cpp

示例4: createToolbars

void MainWindow::createToolbars()
{
    editToolBar = addToolBar(tc->toUnicode("Edit"));
    editToolBar->addAction(deleteAction);
    editToolBar->addAction(toFrontAction);
    editToolBar->addAction(sendBackAction);
	editToolBar->addAction(checkAction);
    editToolBar->addAction(BHAct);
	editToolBar->addAction(JHAct);


	QToolButton *pointerButton = new QToolButton;
    pointerButton->setCheckable(true);
    pointerButton->setChecked(true);
    pointerButton->setIcon(QIcon(":/images/pointer.png"));



    pointerTypeGroup = new QButtonGroup;
    pointerTypeGroup->addButton(pointerButton, int(MoveItem));
    connect(pointerTypeGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(pointerGroupClicked(int)));




    pointerToolbar = addToolBar(tc->toUnicode("Pointer type"));
    pointerToolbar->addWidget(pointerButton);



	QToolButton *BanButton = new QToolButton;
    BanButton->setCheckable(true);

	QToolButton *TransButton = new QToolButton;
    TransButton->setCheckable(true);
    TransButton->setChecked(true);
    BanButton->setIcon(QIcon(":/images/ban.png"));
	TransButton->setIcon(QIcon(":/images/scale.png"));



    BorTGroup = new QButtonGroup;
    BorTGroup->addButton(BanButton, 1);
    connect(BorTGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(BorTGroupClicked(int)));
	BorTGroup->addButton(TransButton, 0);
    connect(BorTGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(BorTGroupClicked(int)));




    BorTToolbar = addToolBar(tc->toUnicode("Pointer type"));
    BorTToolbar->addWidget(BanButton);
	BorTToolbar->addWidget(TransButton);

}
开发者ID:Nobu19800,项目名称:RMC,代码行数:58,代码来源:mainwindow.cpp

示例5: createToolbars

void MainWindow::createToolbars()
{
  
  //////////////////
  QToolBar *fileToolBar;
  fileToolBar = addToolBar(tr("fileToolbar"));
  fileToolBar->addAction(newAction);
  fileToolBar->addAction(openFileAction);
  //  fileToolBar->addAction(saveAction);
  fileToolBar->addAction(saveProjectAction);
  
  //Button for contexts related
  contextItemsButtonGroup = new QButtonGroup(this);  
  QToolButton *selectItemToolButton = new QToolButton(this);  
  selectItemToolButton ->setCheckable(true);
  selectItemToolButton ->setChecked(true);
  selectItemToolButton ->setIcon(QIcon(":/images/pointer.png"));  
  
  QToolButton *insertLineToolButton = new QToolButton(this);
  insertLineToolButton->setCheckable(true);  
  insertLineToolButton->setIcon(QIcon(":/images/linepointer.png"));  
  
  QToolButton *insertPolygonToolButton = new QToolButton(this);
  insertPolygonToolButton->setCheckable(true);  
  insertPolygonToolButton->setIcon(QIcon(":/images/polygon.png"));  
  
  contextItemsButtonGroup->addButton(selectItemToolButton,int(RbeVisualizeWidget_GraphicsScene::ITEM_SELECTION_MODE));
  contextItemsButtonGroup->addButton(insertLineToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_LINE_MODE));  
  contextItemsButtonGroup->addButton(insertPolygonToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_POLYGON_MODE));
  
  QToolBar *contextItemsButtonGroupToolBar;    
  contextItemsButtonGroupToolBar = addToolBar(tr("contextItemsButtonGroup"));
  contextItemsButtonGroupToolBar->addWidget(selectItemToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertLineToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertPolygonToolButton);    
  
  connect(contextItemsButtonGroup, SIGNAL(buttonClicked(int)),
          this, SLOT(contextItemsButtonGroupClicked()));
  
  
  ////////////////////RULE TOOLBAR  
  QToolBar *ruleToolBar;
  ruleToolBar = addToolBar(tr("ruleToolbar"));
  ruleToolBar->addAction(newRuleAction);
  
  ////////////////////
  QToolBar *runToolBar;
  runToolBar = addToolBar(tr("runToolbar"));  
  //runToolBar->addAction(runAnimateAction);
  runToolBar->addAction(openVideoAction);
  runToolBar->addAction(runVirtualFencingAction);  
  //////////////////////
  QToolBar *exitToolBar;
  exitToolBar = addToolBar((tr("exitToolBar")));
  exitToolBar->addAction(exitAction);
  
}
开发者ID:heroddaji,项目名称:rulebasedengine,代码行数:57,代码来源:MainWindow.cpp

示例6: QWidget

VESPERSBeamSelectorView::VESPERSBeamSelectorView(QWidget *parent)
	: QWidget(parent)
{
	currentBeam_ = 0;

	beams_ = new QButtonGroup;

	QToolButton *temp = new QToolButton;
	temp->setText("Pink");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 0);

	temp = new QToolButton;
	temp->setText("10%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 1);

	temp = new QToolButton;
	temp->setText("1.6%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 2);

	temp = new QToolButton;
	temp->setText("Si");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 3);

	connect(beams_, SIGNAL(buttonClicked(int)), this, SLOT(changeBeam(int)));
	connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onCurrentBeamChanged(VESPERS::Beam)));

	progressBar_ = new QProgressBar;
	progressBar_->hide();
	progressBar_->setRange(0, 100);

	QHBoxLayout *buttonsLayout = new QHBoxLayout;
	buttonsLayout->addWidget(beams_->button(0));
	buttonsLayout->addWidget(beams_->button(1));
	buttonsLayout->addWidget(beams_->button(2));
	buttonsLayout->addWidget(beams_->button(3));

	QVBoxLayout *beamSelectorLayout = new QVBoxLayout;
	beamSelectorLayout->addLayout(buttonsLayout);
	beamSelectorLayout->addWidget(progressBar_);

	setLayout(beamSelectorLayout);
}
开发者ID:acquaman,项目名称:acquaman,代码行数:50,代码来源:VESPERSBeamSelectorView.cpp

示例7: _CreateToolBarPointerType

void CIndicatorEditorMainWindow::_CreateToolBarPointerType()
{
	//
	QToolButton *pToolButtonPointer = NULL;
	QToolButton *pToolButtonLinePointer = NULL;

	m_pToolBarPointer = this->addToolBar(QObject::tr("Pointer type"));

	m_pButtonGroupPointerType = new QButtonGroup(this);
	pToolButtonPointer = new QToolButton();
	pToolButtonLinePointer = new QToolButton();


	pToolButtonPointer->setCheckable(true);
	pToolButtonPointer->setChecked(true);
	pToolButtonPointer->setIcon(QIcon(":/images/pointer.png"));
	pToolButtonPointer->setToolTip(QObject::tr("SelectItem"));

	pToolButtonLinePointer->setCheckable(true);
	pToolButtonLinePointer->setIcon(QIcon(":/images/linepointer.png"));
	pToolButtonLinePointer->setToolTip(QObject::tr("InsertLine"));

	m_pButtonGroupPointerType->addButton(pToolButtonPointer, int(ActionType_MoveItem));
	m_pButtonGroupPointerType->addButton(pToolButtonLinePointer, int(ActionType_Insert_CInformationRectItemEdge));
	//connect(m_pButtonGroupPointerType, SIGNAL(buttonClicked(int)), this, SLOT(slotPointerGroupClicked(int)));//DiagramScene::Mode_MoveItem DiagramScene::Mode_InsertLine


	//connect(m_pComboBoxSceneScale, SIGNAL(currentIndexChanged(QString)), this, SLOT(sceneScaleChanged(QString)));

	QGroupBox* pGroupBoxScale = NULL;
	QVBoxLayout* pGroupLayoutScale = NULL;
	QSize nScaleSliderSize = QSize(400, 40);

	pGroupBoxScale = new QGroupBox(this);
	pGroupBoxScale->setTitle(tr("Scale"));
	m_pSliderScale = new QSlider(Qt::Horizontal, pGroupBoxScale);
	m_pSliderScale->setRange(1, 4000);
	m_pSliderScale->setValue(1000);
	//scaleSlider->setMaximumSize(nScaleSliderSize);
	//scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	pGroupLayoutScale = new QVBoxLayout(pGroupBoxScale);
	pGroupLayoutScale->addWidget(m_pSliderScale);


	m_pToolBarPointer->addWidget(pToolButtonPointer);
	m_pToolBarPointer->addWidget(pToolButtonLinePointer);
	m_pToolBarPointer->addWidget(pGroupBoxScale);

}
开发者ID:shenglonglinapple,项目名称:slin_code,代码行数:49,代码来源:IndicatorEditorMainWindow.cpp

示例8: QHBoxLayout

QWidget *QmlProfilerTraceView::createToolbar()
{
    Utils::StyledBar *bar = new Utils::StyledBar(this);
    bar->setStyleSheet(QLatin1String("background: #9B9B9B"));
    bar->setSingleRow(true);
    bar->setFixedWidth(150);
    bar->setFixedHeight(24);

    QHBoxLayout *toolBarLayout = new QHBoxLayout(bar);
    toolBarLayout->setMargin(0);
    toolBarLayout->setSpacing(0);

    QToolButton *buttonPrev= new QToolButton;
    buttonPrev->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_prev.png")));
    buttonPrev->setToolTip(tr("Jump to previous event"));
    connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev()));
    connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool)));

    QToolButton *buttonNext= new QToolButton;
    buttonNext->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_next.png")));
    buttonNext->setToolTip(tr("Jump to next event"));
    connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext()));
    connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool)));

    QToolButton *buttonZoomControls = new QToolButton;
    buttonZoomControls->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_zoom.png")));
    buttonZoomControls->setToolTip(tr("Show zoom slider"));
    buttonZoomControls->setCheckable(true);
    buttonZoomControls->setChecked(false);
    connect(buttonZoomControls, SIGNAL(toggled(bool)), this, SIGNAL(showZoomSlider(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), buttonZoomControls, SLOT(setEnabled(bool)));

    d->m_buttonRange = new QToolButton;
    d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
    d->m_buttonRange->setToolTip(tr("Select range"));
    d->m_buttonRange->setCheckable(true);
    d->m_buttonRange->setChecked(false);
    connect(d->m_buttonRange, SIGNAL(clicked(bool)), this, SLOT(toggleRangeMode(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonRange, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(rangeModeChanged(bool)), d->m_buttonRange, SLOT(setChecked(bool)));

    d->m_buttonLock = new QToolButton;
    d->m_buttonLock->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_selectionmode.png")));
    d->m_buttonLock->setToolTip(tr("View event information on mouseover"));
    d->m_buttonLock->setCheckable(true);
    d->m_buttonLock->setChecked(false);
    connect(d->m_buttonLock, SIGNAL(clicked(bool)), this, SLOT(toggleLockMode(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonLock, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(lockModeChanged(bool)), d->m_buttonLock, SLOT(setChecked(bool)));

    toolBarLayout->addWidget(buttonPrev);
    toolBarLayout->addWidget(buttonNext);
    toolBarLayout->addWidget(new Utils::StyledSeparator());
    toolBarLayout->addWidget(buttonZoomControls);
    toolBarLayout->addWidget(new Utils::StyledSeparator());
    toolBarLayout->addWidget(d->m_buttonRange);
    toolBarLayout->addWidget(d->m_buttonLock);

    return bar;
}
开发者ID:edwardZhang,项目名称:qt-creator,代码行数:60,代码来源:qmlprofilertraceview.cpp

示例9: QToolButton

	QToolButton *make_button(const QString &toolTip, const QIcon &icon, QWidget *parent) {
		QToolButton *button = new QToolButton(parent);
		button->setIcon(icon);
		button->setToolTip(toolTip);
		button->setCheckable(true);
		return button;
	}
开发者ID:akhilo,项目名称:cmplayer,代码行数:7,代码来源:widgets.cpp

示例10: createStatusBar

    void MainWindow::createStatusBar()
    {
        QColor windowColor = palette().window().color();
        QColor buttonBgColor = windowColor.lighter(105);
        QColor buttonBorderBgColor = windowColor.darker(120);
        QColor buttonPressedColor = windowColor.darker(102);

        QToolButton *log = new QToolButton(this);
        log->setText("Logs");
        log->setCheckable(true);
        log->setDefaultAction(_logDock->toggleViewAction());
        log->setStyleSheet(QString(
            "QToolButton {"
            "   background-color: %1;"
            "   border-style: outset;"
            "   border-width: 1px;"
            "   border-radius: 3px;"
            "   border-color: %2;"
            "   padding: 1px 20px 1px 20px;"
            "} \n"
            ""
            "QToolButton:checked, QToolButton:pressed {"
            "   background-color: %3;"
            "   border-style: inset;"
            "}")
            .arg(buttonBgColor.name())
            .arg(buttonBorderBgColor.name())
            .arg(buttonPressedColor.name()));

        statusBar()->insertWidget(0, log);
        statusBar()->setStyleSheet("QStatusBar::item { border: 0px solid black };");
    }
开发者ID:Dinesh-Ramakrishnan,项目名称:robomongo,代码行数:32,代码来源:MainWindow.cpp

示例11: createButtons

void FileRenamerDlgImpl::createButtons()
{
    QBoxLayout* pLayout (dynamic_cast<QBoxLayout*>(m_pButtonsW->layout()));
    CB_ASSERT (0 != pLayout);
    /*int nPos (pLayout->indexOf(pOldBtn));
    pLayout->insertWidget(nPos, this);*/

    QObjectList l (m_pButtonsW->children());
    //qDebug("cnt: %d", l.size());

    for (int i = 1, n = l.size(); i < n; ++i) // l[0] is m_pButtonsW's layout (note that m_pAlbumTypeL is in m_pBtnPanelW)
    {
        delete l[i];
    }

    for (int i = 0, n = cSize(m_vstrPatterns); i < n; ++i)
    {
        QToolButton* p (new QToolButton(m_pButtonsW));
        p->setText(toNativeSeparators(convStr(m_vstrPatterns[i])));
        p->setCheckable(true);
        m_pButtonGroup->addButton(p, m_nBtnId++);
        //p->setAutoExclusive(true);
        connect(p, SIGNAL(clicked()), this, SLOT(onPatternClicked()));
        pLayout->insertWidget(i, p);
    }
}
开发者ID:miracle2k,项目名称:mp3diags,代码行数:26,代码来源:FileRenamerDlgImpl.cpp

示例12: addChildView

void AMBrowseScansView::addChildView(QAbstractItemView *childView, const QIcon &icon)
{
	if(!childView)
		return;

	childViews_.append(childView);
	childView->setModel(proxyModel_);

	QToolButton* viewButton = new QToolButton();
	viewButton->setIcon(icon);
	viewButton->setCheckable(true);
	if(viewButtonGroup_->buttons().isEmpty())
		viewButton->setChecked(true);

	viewButtonLayout_->addWidget(viewButton);
	viewButtonGroup_->addButton(viewButton);
	childViewDisplayArea_->addWidget(childView);
	viewButtonGroup_->setId(viewButton, viewButtonGroup_->buttons().count()-1);

	childView->setContextMenuPolicy(Qt::CustomContextMenu);
	childView->setDragEnabled(true);
	childView->setDropIndicatorShown(true);
	connect(childView, SIGNAL(doubleClicked(const QModelIndex&)), this, SIGNAL(childViewDoubleClicked(const QModelIndex&)));
	connect(childView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onContextMenuRequested(const QPoint&)));
	connect(childView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onChildViewSelectionChanged()));
}
开发者ID:acquaman,项目名称:acquaman,代码行数:26,代码来源:AMBrowseScansView.cpp

示例13: QFrame

//====================================================================================================
FillSelector::FillSelector(QWidget *parent) :
    QFrame(parent){
    for (int i=0; i<FILL_BUTTONS; i++){
        QToolButton *tb = new QToolButton(this);
        tb->setMaximumSize(FILL_BUTTON_SIZE);
        tb->setObjectName(QString("fillButton").append(QString::number(i)));
        tb->setCheckable(true);
        buttongroup.addButton(tb);
        buttongroup.setId(tb, i);
        buttons.push_back(tb);
    }
    buttongroup.button(0)->setChecked(true);
    layout = new QGridLayout(this);
    layout->setSpacing(3);
    layout->setObjectName(QStringLiteral("fillLayout"));
    layout->setContentsMargins(1, 1, 1, 1);
    int r = 0;
    int c = 0;
    for (QToolButton *tb : buttons){
        layout->addWidget(tb, r, c, 1, 1);
        c++;
        if (c==FILL_COLUMNS){
            c = 0;
            r++;
        }
    }
    createIcons();
    //this->setFixedSize(FILL_FRAME_SIZE);

};
开发者ID:euronomus,项目名称:SimplePainter,代码行数:31,代码来源:selectors.cpp

示例14: addToolBar

void
new_mail_widget::make_toolbars()
{
  QToolBar* toolbar = addToolBar(tr("Message Operations"));
  toolbar->addAction(m_action_send_msg);
  toolbar->addAction(m_action_attach_file);
  toolbar->addAction(m_action_edit_note);
  toolbar->addAction(m_action_add_header);
  toolbar->addAction(m_action_open_notepad);

  m_toolbar_html1 = m_toolbar_html2 = NULL;

  if (m_html_edit) {
    QList<QToolBar*> toolbars = m_html_edit->create_toolbars();
    for (int i=0; i<toolbars.size(); i++) {
      if (i==0) m_toolbar_html1 = toolbars[i];
      if (i==1) {
	addToolBarBreak();
	m_toolbar_html2 = toolbars[i];
      }
      addToolBar(toolbars[i]);
    }
    // Add our own toggle button to the second HTML toolbar
    if (m_toolbar_html2 != NULL) {
      QToolButton* source = new QToolButton();
      source->setIcon(HTML_ICON("stock_view-html-source.png"));
      source->setToolTip(tr("Toggle between HTML source edit and visual edit"));
      source->setCheckable(true);
      connect(source, SIGNAL(toggled(bool)), this, SLOT(toggle_edit_source(bool)));
      m_toolbar_html2->addWidget(source);
    }
  }
开发者ID:albancrommer,项目名称:manitou-mail-ui,代码行数:32,代码来源:newmailwidget.cpp

示例15: createWidget

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


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