本文整理汇总了C++中ToolButton::setCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton::setCheckable方法的具体用法?C++ ToolButton::setCheckable怎么用?C++ ToolButton::setCheckable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolButton
的用法示例。
在下文中一共展示了ToolButton::setCheckable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotTab
PlotTab( bool parametric, QWidget *parent ):
QMainWindow( parent )
{
Plot *plot = new Plot( parametric, this );
setCentralWidget( plot );
QToolBar *toolBar = new QToolBar( this );
#ifndef QT_NO_PRINTER
ToolButton *btnPrint = new ToolButton( "Print", toolBar );
toolBar->addWidget( btnPrint );
QObject::connect( btnPrint, SIGNAL( clicked() ),
plot, SLOT( printPlot() ) );
#endif
ToolButton *btnOverlay = new ToolButton( "Overlay", toolBar );
btnOverlay->setCheckable( true );
toolBar->addWidget( btnOverlay );
QObject::connect( btnOverlay, SIGNAL( toggled( bool ) ),
plot, SLOT( setOverlaying( bool ) ) );
if ( parametric )
{
QComboBox *parameterBox = new QComboBox( toolBar );
parameterBox->addItem( "Uniform" );
parameterBox->addItem( "Centripetral" );
parameterBox->addItem( "Chordal" );
parameterBox->addItem( "Manhattan" );
toolBar->addWidget( parameterBox );
connect( parameterBox, SIGNAL( activated( const QString & ) ),
plot, SLOT( setParametric( const QString & ) ) );
parameterBox->setCurrentIndex( 2 ); // chordal
plot->setParametric( parameterBox->currentText() );
ToolButton *btnClosed = new ToolButton( "Closed", toolBar );
btnClosed->setCheckable( true );
toolBar->addWidget( btnClosed );
QObject::connect( btnClosed, SIGNAL( toggled( bool ) ),
plot, SLOT( setClosed( bool ) ) );
}
QComboBox *boundaryBox = new QComboBox( toolBar );
boundaryBox->addItem( "Natural" );
boundaryBox->addItem( "Linear Runout" );
boundaryBox->addItem( "Parabolic Runout" );
boundaryBox->addItem( "Cubic Runout" );
boundaryBox->addItem( "Not a Knot" );
toolBar->addWidget( boundaryBox );
connect( boundaryBox, SIGNAL( activated( const QString & ) ),
plot, SLOT( setBoundaryCondition( const QString & ) ) );
addToolBar( toolBar );
}
示例2:
QWidget *LeftToolBox::createButton(const QString &name,QButtonGroup *group,const int id) {
ToolButton *carButton = new ToolButton;
carButton->setCheckable(true);
carButton->setIcon(QIcon(QPixmap(name).scaled(30,30,Qt::KeepAspectRatio)));
carButton->setIconSize(QSize(50,50));
if (group != 0){
group->addButton(carButton, id);
}
QGridLayout *layout = new QGridLayout;
layout->addWidget(carButton,0,0,Qt::AlignHCenter);
QWidget *widget = new QWidget;
widget->setLayout(layout);
return widget;
}
示例3: addToggleButton
ToolButton* ToolBar::addToggleButton(const char* const* xpm, const QString& tooltip)
{
ToolButton* button = addButton(xpm, tooltip);
button->setCheckable(true);
return button;
}