int main() { //! [1] Counter a, b; //! [1] //! [2] QObject::connect(&a, SIGNAL(valueChanged(int)), &b, SLOT(setValue(int))); //! [2] //! [3] a.setValue(12); // a.value() == 12, b.value() == 12 //! [3] //! [4] b.setValue(48); // a.value() == 12, b.value() == 48 //! [4] QWidget *widget = reinterpret_cast<QWidget *>(new QObject(0)); //! [5] if (widget->inherits("QAbstractButton")) { QAbstractButton *button = static_cast<QAbstractButton *>(widget); button->toggle(); //! [5] //! [6] } //! [6] //! [7] if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) button->toggle(); //! [7] }
virtual dyn_t getGuiValue(void){ QAbstractButton *button = dynamic_cast<QAbstractButton*>(_widget); if (button!=NULL) return DYN_create_bool(button->isChecked()); QAbstractSlider *slider = dynamic_cast<QAbstractSlider*>(_widget); if (slider!=NULL) return DYN_create_int(slider->value()); QLabel *label = dynamic_cast<QLabel*>(_widget); if (label!=NULL) return DYN_create_string(label->text()); QLineEdit *line_edit = dynamic_cast<QLineEdit*>(_widget); if (line_edit!=NULL) return DYN_create_string(line_edit->text()); QTextEdit *text_edit = dynamic_cast<QTextEdit*>(_widget); if (text_edit!=NULL) return DYN_create_string(text_edit->toPlainText()); QSpinBox *spinbox = dynamic_cast<QSpinBox*>(_widget); if (spinbox!=NULL) return DYN_create_int(spinbox->value()); QDoubleSpinBox *doublespinbox = dynamic_cast<QDoubleSpinBox*>(_widget); if (doublespinbox!=NULL) return DYN_create_float(doublespinbox->value()); handleError("Gui #%d does not have a getValue method", _gui_num); return DYN_create_bool(false); }
void QDockWidgetPrivate::init() { Q_Q(QDockWidget); QDockWidgetLayout *layout = new QDockWidgetLayout(q); layout->setSizeConstraint(QLayout::SetMinAndMaxSize); QAbstractButton *button = new QDockWidgetTitleButton(q); button->setObjectName(QLatin1String("qt_dockwidget_floatbutton")); QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_toggleTopLevel())); layout->setWidgetForRole(QDockWidgetLayout::FloatButton, button); button = new QDockWidgetTitleButton(q); button->setObjectName(QLatin1String("qt_dockwidget_closebutton")); QObject::connect(button, SIGNAL(clicked()), q, SLOT(close())); layout->setWidgetForRole(QDockWidgetLayout::CloseButton, button); resizer = new QWidgetResizeHandler(q); resizer->setMovingEnabled(false); resizer->setActive(false); #ifndef QT_NO_ACTION toggleViewAction = new QAction(q); toggleViewAction->setCheckable(true); fixedWindowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q); toggleViewAction->setText(fixedWindowTitle); QObject::connect(toggleViewAction, SIGNAL(triggered(bool)), q, SLOT(_q_toggleView(bool))); #endif updateButtons(); }
// constructor LineObjectDialog::LineObjectDialog (QWidget * parent): QDialog (parent), ui (new Ui::LineObjectDialog) { QAbstractButton *button; ui->setupUi (this); this->setWindowFlags(Qt::CustomizeWindowHint); color = Qt::white; pixmap = new QPixmap (16, 16); icon = new QIcon; pixmap->fill (color); icon->addPixmap (*pixmap, QIcon::Normal, QIcon::On); ui->colorButton->setIcon (*icon); #ifdef Q_OS_WIN colorDialog = new QColorDialog (this); #else colorDialog = new QColorDialog; // (this); #endif colorDialog->setModal (true); foreach (button, ui->buttonBox->buttons ()) button->setFocusPolicy (Qt::NoFocus); connect(ui->colorButton, SIGNAL(clicked (bool)), this, SLOT(color_clicked(void))); connect (colorDialog, SIGNAL (accepted ()), this, SLOT (colorDialog_accepted ())); connect(ui->buttonBox, SIGNAL(accepted ()), this, SLOT(ok_clicked ())); connect(ui->buttonBox, SIGNAL(rejected ()), this, SLOT(cancel_clicked ())); correctWidgetFonts (this); }
void StatsWatcher::registerClick(bool checked) { QString statMessage; QAbstractButton *button = qobject_cast<QAbstractButton*>(sender()); if (button) { if (button->isCheckable()) { if (checked) { statMessage = "S'ha activat amb un click el botó"; } else { statMessage = "S'ha desactivat amb un click el botó"; } } else { statMessage = "Sha fet un click sobre el botó"; } } // És un altre tipus d'objecte else { statMessage = "S'ha fet un click sobre l'objecte"; } statMessage = QString("[%1] %2 %3").arg(m_context).arg(statMessage).arg(sender()->objectName()); log(statMessage); }
void PatVerticalTabWidget::refreshIcons() { for(int i = 0; i < m_buttonGroup->buttons().size(); i++) { // TODO "done" not handled //imagePath = m_donePixmaps[i]; QAbstractButton * button = m_buttonGroup->button(i); QString imagePath; if(button->isEnabled() && button->isChecked()){ imagePath = m_selectedPixmaps[i]; } else if(button->isEnabled() && !button->isChecked()){ imagePath = m_unSelectedPixmaps[i]; } else if(!button->isEnabled() && button->isChecked()){ imagePath = m_selectedPixmaps[i]; } else if(!button->isEnabled() && !button->isChecked()){ imagePath = m_disabledPixmaps[i]; } else{ // you should not be here OS_ASSERT(false); } QString style; style.append("QPushButton { background-color: blue; background-image: url(\""); style.append(imagePath); style.append("\"); border: none; background-repeat: 0; }"); button->setStyleSheet(style); } }
void HoveringButtonsController::ForwardMouseClickEvent(float x, float y) { // To widgetspace float x_widgetspace = x*(float)this->width(); float y_widgetspace = y*(float)this->height(); QPoint pos(x_widgetspace,y_widgetspace); QMouseEvent e(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QApplication::sendEvent(this, &e); // Iterate through buttons and check if they are pressed for(int i = 0; i< layout()->count();i++) { QLayoutItem* item = layout()->itemAt(i); QAbstractButton *button = dynamic_cast<QAbstractButton*>(item->widget()); if(button) { if(button->rect().contains(button->mapFromParent(pos))) { QMouseEvent e(QEvent::MouseButtonPress, pos - button->pos(),pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QApplication::sendEvent(button, &e); } } } }
void EditMetadataDialog::showSaveMenu() { popup = new MythPopupBox(GetMythMainWindow(), "Menu"); QLabel *label = popup->addLabel(tr("Save Changes?"), MythPopupBox::Large, false); label->setAlignment(Qt::AlignCenter | Qt::WordBreak); QAbstractButton *topButton; if (metadataOnly) { topButton = popup->addButton(tr("Save Changes"), this, SLOT(saveToMetadata())); } else { topButton = popup->addButton(tr("Save Changes"), this, SLOT(saveAll())); } popup->addButton(tr("Exit/Do Not Save"), this, SLOT(closeDialog())); popup->addButton(tr("Cancel"), this, SLOT(cancelPopup())); popup->ShowPopup(this, SLOT(cancelPopup())); topButton->setFocus(); }
QString KSaneDeviceDialog::getSelectedName() { QAbstractButton *selectedButton = m_btnGroup->checkedButton(); if(selectedButton) { return selectedButton->objectName(); } return QString(); }
XMLInfoDialog::XMLInfoDialog(QWidget *parent) : QDialog(parent), ui(new Ui::XMLInfoDialog) { ui->setupUi(this); setWindowTitle(tr("选择订阅")); setMinimumWidth(400); setMinimumHeight(450); setMaximumWidth(400); setMaximumHeight(450); QAbstractButton *okBtn = ui->buttonBox->button(QDialogButtonBox::Ok); QAbstractButton *cancelBtn = ui->buttonBox->button(QDialogButtonBox::Cancel); okBtn->setText(tr("确定")); cancelBtn->setText(tr("取消")); connect(cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close())); connect(okBtn, SIGNAL(clicked(bool)), this, SLOT(subscriptionSelectedFinished())); QHeaderView *header = new QHeaderView(Qt::Horizontal, ui->treeWidget); header->setSectionResizeMode(QHeaderView::Stretch); header->setDefaultAlignment(Qt::AlignCenter); ui->treeWidget->setHeader(header); connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(treeItemChanged(QTreeWidgetItem*,int))); }
static void InitializeDataNodeFromQButtonGroup(QButtonGroup *co, DataNode *node) { std::string objectName(co->objectName().toStdString()); DataNode *currentNode = node->GetNode(objectName); QAbstractButton *sb = co->checkedButton(); if(currentNode != 0) { // Use int or string, depending on what the node was initially. NodeTypeEnum t = currentNode->GetNodeType(); node->RemoveNode(objectName); if(t == STRING_NODE) { if(sb != 0) node->AddNode(new DataNode(objectName, sb->text().toStdString())); else node->AddNode(new DataNode(objectName, int(0))); } else { int index = sb ? co->id(sb) : 0; node->AddNode(new DataNode(objectName, index)); } } else { // There's no preference on which type to use so use int int index = sb ? co->id(sb) : 0; node->AddNode(new DataNode(objectName, index)); } }
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(); }
ColorFormatDlg::ColorFormatDlg( JuffPlugin* plugin, const QColor& color, QWidget* parent) : QDialog(parent) { _ui.setupUi( this ); _plugin = plugin; connect( _ui.buttonBox, SIGNAL(accepted()), SLOT(accept()) ); connect( _ui.buttonBox, SIGNAL(rejected()), SLOT(reject()) ); int r, g, b; color.getRgb( &r, &g, &b ); _ui.btnHtml->setText( color.name() ); _ui.btnHex->setText( color.name().replace("#", "0x") ); _ui.btnHexSplitted->setText( QString().sprintf("0x%02hX, 0x%02hX, 0x%02hX", r, g, b) ); _ui.btnSplitted->setText( QString().sprintf("%i, %i, %i", r, g, b) ); _ui.buttonGroup->setId( _ui.btnHtml, 0 ); _ui.buttonGroup->setId( _ui.btnHex, 1 ); _ui.buttonGroup->setId( _ui.btnHexSplitted, 2 ); _ui.buttonGroup->setId( _ui.btnSplitted, 3 ); // _ui.btnHtml->setChecked( true ); int id = PluginSettings::getInt( plugin, "format", 0 ); QAbstractButton* btn = _ui.buttonGroup->button( id ); if ( btn != 0 ) { btn->setChecked( true ); } else { _ui.btnHtml->setChecked( true ); } }
void setcolormark(QRgb colorval) { int i; if (colorval != DEFAULTCOLOR) { i = 3 + colorlist.indexOf(colorval); if (i<3) return; // no such color :( } else { i = 2; // index of the "Inherit Color" action } // 1. mark the color in the menu toggleexcl(menuAction("Elements_Color")->menu()->actions()[i]); // 2. mark the color on the toolbar QAbstractButton *button = toolbar->findChild<QAbstractButton*>("Colors"); int toolIndex = button->property("index").toInt(); QImage img(ToolBar[toolIndex].icon_data); QPixmap pix(img.size()); QPainter p(&pix); if (i==2) { // inherit color -- default pixmap p.drawImage(0, 0, img); } else { // color pixmap p.fillRect(img.rect(), QColor(colorval)); } button->actions().first()->setIcon(QIcon(pix)); }
FirstRunWizard::FirstRunWizard(QWidget* parent, Qt::WindowFlags flags) : QWizard(parent, flags) { setWindowTitle(tr("Shaman first run")); addPage(new IntroPage); addPage(new SecurityPage); addPage(new ConfigurationPage); #ifdef KDE4_INTEGRATION addPage(new KDEPage); #endif addPage(new FinishPage); #ifdef KDE4_INTEGRATION QAbstractButton *bt = button(CancelButton); bt->setIcon(KIcon("dialog-close")); setButton(CancelButton, bt); bt = button(BackButton); bt->setIcon(KIcon("go-previous")); setButton(BackButton, bt); bt = button(NextButton); bt->setIcon(KIcon("go-next")); bt->setLayoutDirection(Qt::RightToLeft); setButton(NextButton, bt); #endif setButtonText(CancelButton, tr("Skip wizard")); setButtonText(NextButton, tr("Next")); setButtonText(BackButton, tr("Back")); }
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 }
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); } }
void TaskView::keyPressEvent(QKeyEvent* ke) { if (ActiveCtrl && ActiveDialog) { if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) { // get all buttons of the complete task dialog QList<QPushButton*> list = this->findChildren<QPushButton*>(); for (int i=0; i<list.size(); ++i) { QPushButton *pb = list.at(i); if (pb->isDefault() && pb->isVisible()) { if (pb->isEnabled()) pb->click(); return; } } } else if (ke->key() == Qt::Key_Escape) { // get only the buttons of the button box QDialogButtonBox* box = ActiveCtrl->standardButtons(); QList<QAbstractButton*> list = box->buttons(); for (int i=0; i<list.size(); ++i) { QAbstractButton *pb = list.at(i); if (box->buttonRole(pb) == QDialogButtonBox::RejectRole) { if (pb->isEnabled()) pb->click(); return; } } } } else { QScrollArea::keyPressEvent(ke); } }
void login::set_ui() { ui.setupUi(this); // lock button Ok QList <QAbstractButton *> login_buttons = ui.buttonBox->buttons(); QAbstractButton * button; // perebiraem knopki: ischem ok int count = login_buttons.count(); for(int i = 0; i < count; ++i ) { button = login_buttons[i]; if(ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { ui_ok = button; break; } } button->setDisabled(1); // load & save lineedit palletes line_edit_norm = line_edit_wrong = ui.login_user->palette(); line_edit_wrong.setColor( QPalette::Base, QColor(255, 230, 230) ); // set pre username set_uname(pre_user); return; }
void MigrateDialog::ask() { QAbstractButton *btn = button( QWizard::CancelButton ); QPoint p = btn->mapToGlobal(QPoint(0, 0)); QRect rc(p.x(), p.y(), btn->width(), btn->height()); BalloonMsg::ask(NULL, i18n("Cancel convert?"), this, SLOT(cancel(void*)), NULL, &rc); }
void TabBar::updatePinnedTabCloseButton(int index) { if (!validIndex(index)) { return; } WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index)); QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, closeButtonPosition())); bool pinned = webTab && webTab->isPinned(); if (pinned) { if (button) { button->hide(); } } else { if (button) { button->show(); } else { showCloseButton(index); } } }
/*!\reimp */ bool QLabel::event(QEvent *e) { Q_D(QLabel); QEvent::Type type = e->type(); #ifndef QT_NO_SHORTCUT if (type == QEvent::Shortcut) { QShortcutEvent *se = static_cast<QShortcutEvent *>(e); if (se->shortcutId() == d->shortcutId) { QWidget * w = d->buddy; QAbstractButton *button = qobject_cast<QAbstractButton *>(w); if (w->focusPolicy() != Qt::NoFocus) w->setFocus(Qt::ShortcutFocusReason); if (button && !se->isAmbiguous()) button->animateClick(); else window()->setAttribute(Qt::WA_KeyboardFocusChange); return true; } } else #endif if (type == QEvent::Resize) { if (d->control) d->textLayoutDirty = true; } else if (e->type() == QEvent::StyleChange #ifdef Q_WS_MAC || e->type() == QEvent::MacSizeChange #endif ) { d->setLayoutItemMargins(QStyle::SE_LabelLayoutItem); d->updateLabel(); } return QFrame::event(e); }
void vrpn_Qt::AddWidget(QWidget* widget) { // Ignore widgets called vrpn_Qt_ignore if (widget->objectName() == "vrpn_Qt_ignore") { return; } // Check if widget is derived from abstract button if (qobject_cast<QAbstractButton*>(widget)) { QAbstractButton* button = qobject_cast<QAbstractButton*>(widget); connect(button, SIGNAL(pressed()), this, SLOT(ButtonChanged())); connect(button, SIGNAL(released()), this, SLOT(ButtonChanged())); buttonWidgets.append(button); buttons[num_buttons] = button->isChecked(); num_buttons++; } // Check if widget is derived from abstract slider else if (qobject_cast<QAbstractSlider*>(widget)) { QAbstractSlider* slider = qobject_cast<QAbstractSlider*>(widget); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(AnalogChanged())); analogWidgets.append(slider); channel[num_channel] = slider->value(); num_channel++; } // Check for double spin box else if (qobject_cast<QDoubleSpinBox*>(widget)) {
bool wxRadioBox::IsItemShown(unsigned int n) const { QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); CHECK_BUTTON( qtButton, false ); return qtButton->isVisible(); }
void PTabWidget::tabChanged(int index) { // Hide the close button on the old tab if (m_lastTabIndex >= 0) { QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide)); if (!tabButton) { tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide)); } if (tabButton) { tabButton->hide(); } } m_lastTabIndex = index; // Show the close button on the new tab if (m_lastTabIndex >= 0) { QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide)); if (!tabButton) { tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide)); } if (tabButton) { tabButton->show(); } } }
wxString wxRadioBox::GetString(unsigned int n) const { QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); CHECK_BUTTON( qtButton, wxEmptyString ); return wxQtConvertString( qtButton->text() ); }
QAbstractButton* FirstRunWizard::setButton( Button button, const QString& text ) { QAbstractButton* returnButton; switch ( button ) { case CustomButton: returnButton = ui->custom; break; case BackButton: returnButton = ui->back; break; case SkipButton: returnButton = ui->skip; break; case NextButton: returnButton = ui->next; break; case FinishButton: returnButton = ui->finish; break; } returnButton->setText( text ); returnButton->show(); return returnButton; }
void wxRadioBox::SetString(unsigned int n, const wxString& s) { QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); wxCHECK_RET( qtButton != NULL, INVALID_INDEX_MESSAGE ); qtButton->setText( wxQtConvertString( s )); }
void QDockWidgetPrivate::updateButtons() { Q_Q(QDockWidget); QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout); QStyleOptionDockWidget opt; q->initStyleOption(&opt); bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0; bool nativeDeco = dwLayout->nativeWindowDeco(); bool hideButtons = nativeDeco || customTitleBar; bool canClose = hasFeature(this, QDockWidget::DockWidgetClosable); bool canFloat = hasFeature(this, QDockWidget::DockWidgetFloatable); QAbstractButton *button = qobject_cast<QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::FloatButton)); button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q)); button->setVisible(canFloat && !hideButtons); button = qobject_cast <QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::CloseButton)); button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q)); button->setVisible(canClose && !hideButtons); q->setAttribute(Qt::WA_ContentsPropagated, (canFloat || canClose) && !hideButtons); layout->invalidate(); }
QAccessible::State QAccessibleButton::state() const { QAccessible::State state = QAccessibleWidget::state(); QAbstractButton *b = button(); QCheckBox *cb = qobject_cast<QCheckBox *>(b); if (b->isCheckable()) state.checkable = true; if (b->isChecked()) state.checked = true; else if (cb && cb->checkState() == Qt::PartiallyChecked) state.checkStateMixed = true; if (b->isDown()) state.pressed = true; QPushButton *pb = qobject_cast<QPushButton*>(b); if (pb) { if (pb->isDefault()) state.defaultButton = true; #ifndef QT_NO_MENU if (pb->menu()) state.hasPopup = true; #endif } return state; }