本文整理汇总了C++中QToolButton::setOn方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setOn方法的具体用法?C++ QToolButton::setOn怎么用?C++ QToolButton::setOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setOn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: group_clicked
void Qt_widget_standard_toolbar::group_clicked(int i)
{
static int id = 0;
// This id is here to keep track of the button from the group that
// is on (if all toolbuttons are down, nolayer is on. At the
// beginning, it is set to 0, because
// button_group.id(nolayerBt)==0.
if( i == id )
{
if( i == 0) return;
// nolayer is on and cannot be set off like that.
QToolButton* tBt =
static_cast<QToolButton*>(button_group->find(i));
if( tBt != 0)
tBt->setOn(false);
nolayerBt->setOn(true);
id = 0;
}
else
id = i;
}
示例2: stepModeGroup_clicked
void stepsequencerWidget::stepModeGroup_clicked(int mode)
{
//we are in step mode (arg is 0 - on./off, 1 - note - 2- length 3 -velocity)
stepMode=mode;
patternStepSong=1;
if (stepMode==0)
{
sequenceGroup->setExclusive(FALSE);
dataDisplay->setText("qTribe");
//now we need to go through our steps and set them on or off depending on our underlying step model.
QToolButton* myButton;
step* myStep;
stepPattern* myPattern=mySequencerThread->getCurrentPattern();
stepSequence* mySequence=myPattern->getActiveSequence();
for (int i=0;i< 16;i++)
{
myButton=(QToolButton*) sequenceGroup->find(i);
//fprintf(stderr,"BUTTON: %s\n",myButton->className());
myStep=mySequence->getStep(i+(selectedMeasure*16));
if (myStep->isOn)
{
myButton->setOn(TRUE);
pal.setColor( QPalette::Active, QColorGroup::Button, buttonOnColor);
myButton ->setPalette( pal );
}
else
{
myButton->setOn(FALSE);
pal.setColor( QPalette::Active, QColorGroup::Button, buttonOffColor);
myButton ->setPalette( pal );
}
}
}
else if (stepMode==1 || stepMode==2 || stepMode==3 || stepMode==4)
{
sequenceGroup->setExclusive(TRUE);
dataDisplay->setText("---");
step* myStep;
stepPattern* myPattern=mySequencerThread->getCurrentPattern();
stepSequence* mySequence=myPattern->getActiveSequence();
for (int i=0;i< 16;i++)
{
QToolButton* myButton=(QToolButton*) sequenceGroup->find(i);
myButton->setOn(FALSE);
}
if (selectedStep)
{
int step_array_index=selectedStep-1;
sequenceGroup->setButton(step_array_index);
myStep=mySequence->getStep(step_array_index+(selectedMeasure*16));
if (stepMode==1)
{
dataDisplay->setText(QString("%1").arg(noteNames[myStep->noteNumber]));
}
if (stepMode==2)
{
dataDisplay->setText(QString("%1").arg(myStep->noteLength));
}
if (stepMode==3)
{
dataDisplay->setText(QString("%1").arg(myStep->noteVelocity));
}
if (stepMode==4)
{
dataDisplay->setText(QString("%1").arg(myStep->noteTonality));
}
}
if (mySequence->drumSequence==1)
{
//drum part
if (stepMode==1)
{
dataDisplay->setText(QString("%1").arg(noteNames[mySequence->drumNote]));
}
}
}
else
{
sequenceGroup->setExclusive(TRUE);
}
}
示例3: QMainWindow
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
d_plot = new Plot(this);
setCentralWidget(d_plot);
QToolBar *toolBar = new QToolBar(this);
QToolButton *btnSpectrogram = new QToolButton(toolBar);
QToolButton *btnContour = new QToolButton(toolBar);
QToolButton *btnPrint = new QToolButton(toolBar);
#if QT_VERSION >= 0x040000
btnSpectrogram->setText("Spectrogram");
//btnSpectrogram->setIcon(QIcon());
btnSpectrogram->setCheckable(true);
btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
toolBar->addWidget(btnSpectrogram);
btnContour->setText("Contour");
//btnContour->setIcon(QIcon());
btnContour->setCheckable(true);
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
toolBar->addWidget(btnContour);
btnPrint->setText("Print");
btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
toolBar->addWidget(btnPrint);
#else
btnSpectrogram->setTextLabel("Spectrogram");
//btnSpectrogram->setPixmap(zoom_xpm);
btnSpectrogram->setToggleButton(true);
btnSpectrogram->setUsesTextLabel(true);
btnContour->setTextLabel("Contour");
//btnContour->setPixmap(zoom_xpm);
btnContour->setToggleButton(true);
btnContour->setUsesTextLabel(true);
btnPrint->setTextLabel("Print");
btnPrint->setUsesTextLabel(true);
#endif
addToolBar(toolBar);
connect(btnSpectrogram, SIGNAL(toggled(bool)),
d_plot, SLOT(showSpectrogram(bool)));
connect(btnContour, SIGNAL(toggled(bool)),
d_plot, SLOT(showContour(bool)));
connect(btnPrint, SIGNAL(clicked()),
d_plot, SLOT(printPlot()) );
#if QT_VERSION >= 0x040000
btnSpectrogram->setChecked(true);
btnContour->setChecked(false);
#else
btnSpectrogram->setOn(true);
btnContour->setOn(false);
#endif
}