本文整理汇总了C++中QAbstractButton::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setEnabled方法的具体用法?C++ QAbstractButton::setEnabled怎么用?C++ QAbstractButton::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkValidity
void JumpToDialog::checkValidity(void)
{
QValidator::State state = QValidator::Acceptable;
int i;
const QValidator *vldr = cbFunctions->validator();
QString s = cbFunctions->currentText();
int pos = 0;
if (vldr->validate(s, pos) != QValidator::Acceptable) {
state = QValidator::Invalid;
}
/* Find OK button */
QAbstractButton *okButton = NULL;
QList<QAbstractButton*> buttonList;
buttonList = buttonBox->buttons();
for (i = 0; i < buttonList.size(); i++) {
if (buttonBox->buttonRole(buttonList[i])
== QDialogButtonBox::AcceptRole) {
okButton = buttonList[i];
}
}
if (!okButton) {
return;
}
if (state == QValidator::Acceptable) {
okButton->setEnabled(true);
} else {
okButton->setEnabled(false);
}
}
示例2: setTitle
void
PluginsInstallPage::initializePage()
{
setTitle( tr( "Your plugins are now being installed" ) );
wizard()->setCommitPage( true );
QAbstractButton* continueButton = wizard()->setButton( FirstRunWizard::NextButton, tr( "Continue" ) );
if ( wizard()->canGoBack() )
wizard()->setButton( FirstRunWizard::BackButton, tr( "<< Back" ) );
#ifdef Q_OS_WIN32
if ( wizard()->pluginList()->installList().count() > 0 )
{
// get the install to happen a bit later so that
// we actually show this page of the wizard
// and the user has time to read what's happening
QTimer::singleShot( 1000, this, SLOT(install()) );
continueButton->setEnabled( false );
}
else
{
continueButton->click();
}
#endif
}
示例3: updateRefButton
void TaskDatumParameters::updateRefButton(int idx)
{
QAbstractButton* b;
switch(idx){
case 0: b = ui->buttonRef1; break;
case 1: b = ui->buttonRef2; break;
case 2: b = ui->buttonRef3; break;
case 3: b = ui->buttonRef4; break;
default: throw Base::Exception("button index out of range");
}
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();
int numrefs = refs.size();
bool enable = true;
if (idx > numrefs)
enable = false;
if (idx == numrefs && this->lastSuggestResult.nextRefTypeHint.size() == 0)
enable = false;
b->setEnabled(enable);
b->setChecked(iActiveRef == idx);
if (iActiveRef == idx) {
b->setText(tr("Selecting..."));
} else if (idx < static_cast<int>(this->lastSuggestResult.references_Types.size())){
b->setText(AttacherGui::getShapeTypeText(this->lastSuggestResult.references_Types[idx]));
} else {
b->setText(tr("Reference%1").arg(idx+1));
}
}
示例4: ui
PreferencesDialog::PreferencesDialog( QMenuBar* menuBar, QWidget* parent )
:unicorn::MainWindow( menuBar, parent ),
ui( new Ui::PreferencesDialog )
{
// Disable the minimize and maximize buttons.
Qt::WindowFlags flags = this->windowFlags();
flags &= ~Qt::WindowMinMaxButtonsHint;
setWindowFlags(flags);
ui->setupUi( this );
setAttribute( Qt::WA_DeleteOnClose, true );
static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionGeneral ) )->setAutoExclusive( true );
static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionScrobbling ) )->setAutoExclusive( true );
static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionDevices ) )->setAutoExclusive( true );
static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAccounts ) )->setAutoExclusive( true );
static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAdvanced ) )->setAutoExclusive( true );
connect( ui->toolBar->widgetForAction( ui->actionGeneral ), SIGNAL(toggled(bool)), ui->actionGeneral, SLOT(setChecked(bool)) );
connect( ui->toolBar->widgetForAction( ui->actionScrobbling ), SIGNAL(toggled(bool)), ui->actionScrobbling, SLOT(setChecked(bool)) );
connect( ui->toolBar->widgetForAction( ui->actionDevices ), SIGNAL(toggled(bool)), ui->actionDevices, SLOT(setChecked(bool)) );
connect( ui->toolBar->widgetForAction( ui->actionAccounts ), SIGNAL(toggled(bool)), ui->actionAccounts, SLOT(setChecked(bool)) );
connect( ui->toolBar->widgetForAction( ui->actionAdvanced ), SIGNAL(toggled(bool)), ui->actionAdvanced, SLOT(setChecked(bool)) );
connect( this, SIGNAL( saveNeeded() ), ui->general, SLOT( saveSettings() ) );
connect( this, SIGNAL( saveNeeded() ), ui->scrobbling, SLOT( saveSettings() ) );
connect( this, SIGNAL( saveNeeded() ), ui->ipod, SLOT( saveSettings() ) );
connect( this, SIGNAL( saveNeeded() ), ui->accounts, SLOT( saveSettings() ) );
connect( this, SIGNAL( saveNeeded() ), ui->advanced, SLOT( saveSettings() ) );
connect( ui->general, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
connect( ui->scrobbling, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
connect( ui->ipod, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
connect( ui->accounts, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
connect( ui->advanced, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
connect( ui->actionGeneral, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
connect( ui->actionScrobbling, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
connect( ui->actionDevices, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
connect( ui->actionAccounts, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
connect( ui->actionAdvanced, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
connect( ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(onStackCurrentChanged(int)), Qt::QueuedConnection );
#ifdef Q_OS_MAC
ui->buttonBox->hide();
#endif
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( onAccepted() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( onRejected() ) );
QAbstractButton* applyButton = ui->buttonBox->button( QDialogButtonBox::Apply );
applyButton->setEnabled( false );
connect( applyButton, SIGNAL( clicked() ), SLOT( onApplyButtonClicked() ) );
setFixedWidth( 550 );
ui->stackedWidget->setCurrentWidget( ui->accounts );
ui->actionGeneral->trigger();
}
示例5: Enable
bool wxRadioBox::Enable(unsigned int n, bool enable)
{
QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
CHECK_BUTTON( qtButton, false );
qtButton->setEnabled( enable );
return true;
}
示例6: xmlWorkFinish
void ExportWizard::xmlWorkFinish()
{
QAbstractButton *finishButton = button(QWizard::FinishButton);
finishButton->setEnabled(true);
setButtonText(QWizard::FinishButton, tr("Finish"));
setOption(QWizard::DisabledBackButtonOnLastPage, false);
delete xmlWorkThread;
}
示例7: checkValidity
void EditCallDialog::checkValidity(void)
{
QValidator::State state = QValidator::Acceptable;
int i;
for (i=0; i<m_qObjects.size(); i++) {
const FunctionCall::Argument *arg = m_pChangedCall->getArgument(i);
switch (arg->iType) {
case DBG_TYPE_ENUM:
{
QComboBox *cb = (QComboBox*)m_qObjects[i];
const QValidator *vldr = cb->validator();
QString s = cb->currentText();
int pos = 0;
if (vldr->validate(s, pos) != QValidator::Acceptable) {
state = QValidator::Invalid;
}
break;
}
default:
break;
}
}
/* Find OK button */
QAbstractButton *okButton = NULL;
QList<QAbstractButton*> buttonList;
buttonList = buttonBox->buttons();
for(i=0; i<buttonList.size(); i++) {
if (buttonBox->buttonRole(buttonList[i]) ==
QDialogButtonBox::AcceptRole) {
okButton = buttonList[i];
}
}
if (!okButton) {
return;
}
if (state == QValidator::Acceptable) {
okButton->setEnabled(true);
} else {
okButton->setEnabled(false);
}
}
示例8: excelWorkFinish
void ExportWizard::excelWorkFinish()
{
QAbstractButton *finishButton = button(QWizard::FinishButton);
finishButton->setEnabled(true);
setButtonText(QWizard::FinishButton, tr("Finish"));
setOption(QWizard::DisabledBackButtonOnLastPage, false);
QSqlDatabase::removeDatabase("ExportExcel");
delete excelWorkThread;
}
示例9: validatePage
bool LoadObjectsProgressPage::validatePage()
{
// Re-Enable cancel button for the next step
QAbstractButton* cancel = wizard()->button(QWizard::CancelButton);
if(cancel)
{
cancel->setEnabled(true);
}
return true;
}
示例10: workFinish
void ExportWizard::workFinish()
{
QAbstractButton *finishButton = button(QWizard::FinishButton);
finishButton->setEnabled(true);
setButtonText(QWizard::FinishButton, tr("Finish"));
setOption(QWizard::DisabledBackButtonOnLastPage, false);
// progressPage->progressBar->setMaximum(1);
delete workThread;
QSqlDatabase::removeDatabase("QODBCTempConnect");
}
示例11: handle_selectionChanged
void StartPage::handle_selectionChanged()
{
QItemSelectionModel * sel_model = qobject_cast<QItemSelectionModel *>(sender());
Q_ASSERT(sel_model);
QAbstractItemView * area = area_of(sel_model->model());
Q_ASSERT(area);
QString button_name = area->property("open_button_name").toString();
QAbstractButton * button = findChild<QAbstractButton *>(button_name);
Q_ASSERT(button);
button->setEnabled( area->currentIndex().isValid() );
}
示例12: tabChanged
/**
* @brief the current tab changed
*/
void OpenNIC::tabChanged(int tab)
{
QDialogButtonBox* buttonBox = ui->buttonBox;
QList<QAbstractButton *> buttons = buttonBox->buttons();
for(int n=0; n < buttons.count(); n++)
{
QAbstractButton* button = buttons.at(n);
if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole || buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
{
if ( tab == 1 || tab == 5 )
{
button->setEnabled(true);
}
else
{
button->setEnabled(false);
}
}
}
}
示例13: foreach
void
PluginsInstallPage::install()
{
#ifdef Q_OS_WIN32
foreach( IPluginInfo* plugin, wizard()->pluginList()->installList() )
plugin->doInstall();
#endif
QAbstractButton* continueButton = wizard()->setButton( FirstRunWizard::NextButton, tr( "Continue" ) );
continueButton->setEnabled( true );
QTimer::singleShot( 1000, continueButton, SLOT(click()) );
}
示例14: on_buttonNewGame_clicked
void TicTacToe::on_buttonNewGame_clicked()
{
QListIterator<QAbstractButton *> i(gameField->buttons());
while (i.hasNext())
{
QAbstractButton *qab = i.next();
qab->setEnabled(true);
qab->setIcon(QIcon());
qab->setWhatsThis("");
}
buttonNewGame->setEnabled(false);
switchPlayer();
}
示例15: onModeChanged
void PsdSettingsPopup::onModeChanged(const QString &mode) {
if (mode == "Single Image") {
m_mode = FLAT;
m_modeDescription->setText(modesDescription[0]);
m_createSubXSheet->setEnabled(false);
m_levelNameType->setEnabled(false);
QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
while (!buttons.isEmpty()) {
QAbstractButton *btn = buttons.takeFirst();
btn->setEnabled(false);
}
} else if (mode == "Frames") {
m_mode = FRAMES;
m_modeDescription->setText(modesDescription[1]);
m_createSubXSheet->setEnabled(false);
m_levelNameType->setEnabled(false);
QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
while (!buttons.isEmpty()) {
QAbstractButton *btn = buttons.takeFirst();
btn->setEnabled(false);
}
} else if (mode == "Columns") {
if (m_psdFolderOptions->checkedId() == 2 ||
m_psdFolderOptions->checkedId() == 1)
m_mode = FOLDER;
else
m_mode = COLUMNS;
m_modeDescription->setText(modesDescription[2]);
m_createSubXSheet->setEnabled(true);
m_levelNameType->setEnabled(true);
QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
while (!buttons.isEmpty()) {
QAbstractButton *btn = buttons.takeFirst();
btn->setEnabled(true);
}
} else {
assert(false);
}
}