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


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

本文整理汇总了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 );
    }
开发者ID:Au-Zone,项目名称:qwt,代码行数:57,代码来源:main.cpp

示例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;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:18,代码来源:LeftToolBox.cpp

示例3: addToggleButton

ToolButton* ToolBar::addToggleButton(const char* const* xpm, const QString& tooltip)
{
    ToolButton* button = addButton(xpm, tooltip);
    button->setCheckable(true);
    return button;
}
开发者ID:arntanguy,项目名称:choreonoid,代码行数:6,代码来源:ToolBar.cpp


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