本文整理汇总了C++中QAbstractButton::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::isEnabled方法的具体用法?C++ QAbstractButton::isEnabled怎么用?C++ QAbstractButton::isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::isEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refreshIcons
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);
}
}
示例2: IsItemEnabled
bool wxRadioBox::IsItemEnabled(unsigned int n) const
{
QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
CHECK_BUTTON( qtButton, false );
return qtButton->isEnabled();
}
示例3: keyPressEvent
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);
}
}
示例4: commonScenario
void PrimerLibrarySelectorFiller::commonScenario() {
QWidget *dialog = QApplication::activeModalWidget();
GT_CHECK(dialog, "activeModalWidget is NULL");
QAbstractButton *okButton = GTUtilsDialog::buttonBox(os, dialog)->button(QDialogButtonBox::Ok);
CHECK_SET_ERR(!okButton->isEnabled(), "the OK button is enabled");
const int primerNumber = (-1 == number ? GTUtilsPrimerLibrary::librarySize(os) - 1 : number);
GTMouseDriver::moveTo(GTUtilsPrimerLibrary::getPrimerPoint(os, primerNumber));
GTMouseDriver::click();
CHECK_SET_ERR(okButton->isEnabled(), "the OK button is disabled");
if (doubleClick) {
GTMouseDriver::doubleClick();
} else {
GTWidget::click(os, okButton);
}
}
示例5: keyPressEvent
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()) {
#if defined(FC_OS_MACOSX)
// #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
QPoint pos = QCursor::pos();
QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
pb->click();
#if defined(FC_OS_MACOSX)
QCursor::setPos(pos);
#endif
}
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()) {
#if defined(FC_OS_MACOSX)
// #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
QPoint pos = QCursor::pos();
QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
pb->click();
#if defined(FC_OS_MACOSX)
QCursor::setPos(pos);
#endif
}
return;
}
}
}
}
else {
QScrollArea::keyPressEvent(ke);
}
}
示例6: full
bool TicTacToe::full()
{
QListIterator<QAbstractButton *> i(gameField->buttons());
while(i.hasNext())
{
QAbstractButton *qab = i.next();
if(qab->isEnabled())
{
return false;
}
}
printInfo("Tie, play a new game!");
return true;
}
示例7: statsAdjustAll
void MainWindow::statsAdjustAll()
{
if (stats_tw == NULL)
return;
QAbstractButton *btn;
for (int i = 0; i < stats_tw->rowCount(); ++i) {
btn = (QAbstractButton *)stats_tw->cellWidget(i, 5);
if (btn == NULL)
continue;
if (!btn->isEnabled())
continue;
statsAdjust(btn);
}
if (stats_btn_adjustall == NULL)
return;
stats_btn_adjustall->setEnabled(false);
}
示例8: setCurrentIndex
void PatVerticalTabWidget::setCurrentIndex(int index)
{
int yPos = 25;
for(int i = 0; i < m_buttonGroup->buttons().size(); i++)
{
QAbstractButton * button = m_buttonGroup->button(i);
button->move(0,yPos);
yPos += button->height();
// Ignore clicks to the already active tab
if(button->isEnabled() && button->isChecked() && currentIndex != index){
currentIndex = index;
emit tabSelected(i);
}
}
QTimer::singleShot(0, this, SLOT(refreshIcons()));
}
示例9: isButtonEnabled
bool Dialog::isButtonEnabled(ButtonCode button) {
QAbstractButton *b = getButton(button);
return b ? b->isEnabled() : false;
}
示例10: moveFocus
void QAbstractButtonPrivate::moveFocus(int key)
{
QList<QAbstractButton *> buttonList = queryButtonList();;
#ifndef QT_NO_BUTTONGROUP
bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
#else
bool exclusive = autoExclusive;
#endif
QWidget *f = QApplication::focusWidget();
QAbstractButton *fb = qobject_cast<QAbstractButton *>(f);
if (!fb || !buttonList.contains(fb))
return;
QAbstractButton *candidate = 0;
int bestScore = -1;
QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0)));
QPoint goal = target.center();
uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus;
for (int i = 0; i < buttonList.count(); ++i) {
QAbstractButton *button = buttonList.at(i);
if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() &&
(autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) {
QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0)));
QPoint p = buttonRect.center();
//Priority to widgets that overlap on the same coordinate.
//In that case, the distance in the direction will be used as significant score,
//take also in account orthogonal distance in case two widget are in the same distance.
int score;
if ((buttonRect.x() < target.right() && target.x() < buttonRect.right())
&& (key == Qt::Key_Up || key == Qt::Key_Down)) {
//one item's is at the vertical of the other
score = (qAbs(p.y() - goal.y()) << 16) + qAbs(p.x() - goal.x());
} else if ((buttonRect.y() < target.bottom() && target.y() < buttonRect.bottom())
&& (key == Qt::Key_Left || key == Qt::Key_Right) ) {
//one item's is at the horizontal of the other
score = (qAbs(p.x() - goal.x()) << 16) + qAbs(p.y() - goal.y());
} else {
score = (1 << 30) + (p.y() - goal.y()) * (p.y() - goal.y()) + (p.x() - goal.x()) * (p.x() - goal.x());
}
if (score > bestScore && candidate)
continue;
switch(key) {
case Qt::Key_Up:
if (p.y() < goal.y()) {
candidate = button;
bestScore = score;
}
break;
case Qt::Key_Down:
if (p.y() > goal.y()) {
candidate = button;
bestScore = score;
}
break;
case Qt::Key_Left:
if (p.x() < goal.x()) {
candidate = button;
bestScore = score;
}
break;
case Qt::Key_Right:
if (p.x() > goal.x()) {
candidate = button;
bestScore = score;
}
break;
}
}
}
if (exclusive
#ifdef QT_KEYPAD_NAVIGATION
&& !QApplication::keypadNavigationEnabled()
#endif
&& candidate
&& fb->d_func()->checked
&& candidate->d_func()->checkable)
candidate->click();
if (candidate) {
if (key == Qt::Key_Up || key == Qt::Key_Left)
candidate->setFocus(Qt::BacktabFocusReason);
else
candidate->setFocus(Qt::TabFocusReason);
}
}