本文整理汇总了C++中QAbstractButton::isCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::isCheckable方法的具体用法?C++ QAbstractButton::isCheckable怎么用?C++ QAbstractButton::isCheckable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::isCheckable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerClick
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);
}
示例2: state
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;
}
示例3: getCvButton
bool GTUtilsCv::cvBtn::isChecked(HI::GUITestOpStatus &os, ADVSingleSequenceWidget *seqWidget) {
QAbstractButton *cvButton = getCvButton(os, seqWidget, true /* CV button must exist */ );
CHECK_OP_SET_ERR_RESULT(os, "Error getting CV button!", false);
SAFE_POINT(NULL != cvButton, "cvButton is NULL!", false);
CHECK_SET_ERR_RESULT(cvButton->isCheckable(), "CV button is not checkable!", false);
return cvButton->isChecked();
}
示例4: role
QAccessible::Role QAccessibleButton::role() const
{
QAbstractButton *ab = button();
#ifndef QT_NO_MENU
if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
if (pb->menu())
return QAccessible::ButtonMenu;
}
#endif
if (ab->isCheckable())
return ab->autoExclusive() ? QAccessible::RadioButton : QAccessible::CheckBox;
return QAccessible::Button;
}
示例5: fixFocusPolicy
void QAbstractButtonPrivate::fixFocusPolicy()
{
Q_Q(QAbstractButton);
#ifndef QT_NO_BUTTONGROUP
if (!group && !autoExclusive)
#else
if (!autoExclusive)
#endif
return;
QList<QAbstractButton *> buttonList = queryButtonList();
for (int i = 0; i < buttonList.count(); ++i) {
QAbstractButton *b = buttonList.at(i);
if (!b->isCheckable())
continue;
b->setFocusPolicy((Qt::FocusPolicy) ((b == q || !q->isCheckable())
? (b->focusPolicy() | Qt::TabFocus)
: (b->focusPolicy() & ~Qt::TabFocus)));
}
}
示例6: checkCheckedWidgets
void QgsDataDefinedButton::checkCheckedWidgets( bool check )
{
// don't uncheck, only set to checked
if ( !check )
{
return;
}
for ( int i = 0; i < mCheckedWidgets.size(); ++i )
{
QAbstractButton *btn = qobject_cast< QAbstractButton * >( mCheckedWidgets.at( i ) );
if ( btn && btn->isCheckable() )
{
btn->setChecked( true );
continue;
}
QGroupBox *grpbx = qobject_cast< QGroupBox * >( mCheckedWidgets.at( i ) );
if ( grpbx && grpbx->isCheckable() )
{
grpbx->setChecked( true );
}
}
}
示例7: updateSiblingWidgets
void QgsPropertyOverrideButton::updateSiblingWidgets( bool state )
{
Q_FOREACH ( const SiblingWidget &sw, mSiblingWidgets )
{
switch ( sw.mSiblingType )
{
case SiblingCheckState:
{
// don't uncheck, only set to checked
if ( state )
{
QAbstractButton *btn = qobject_cast< QAbstractButton * >( sw.mWidgetPointer.data() );
if ( btn && btn->isCheckable() )
{
btn->setChecked( sw.mNatural ? state : !state );
}
else
{
QGroupBox *grpbx = qobject_cast< QGroupBox * >( sw.mWidgetPointer.data() );
if ( grpbx && grpbx->isCheckable() )
{
grpbx->setChecked( sw.mNatural ? state : !state );
}
}
}
break;
}
case SiblingEnableState:
{
QLineEdit *le = qobject_cast< QLineEdit * >( sw.mWidgetPointer.data() );
if ( le )
le->setReadOnly( sw.mNatural ? !state : state );
else
sw.mWidgetPointer.data()->setEnabled( sw.mNatural ? state : !state );
break;
}
case SiblingVisibility:
{
sw.mWidgetPointer.data()->setVisible( sw.mNatural ? state : !state );
break;
}
case SiblingExpressionText:
{
QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
if ( le )
{
le->setText( mProperty.asExpression() );
}
else
{
QTextEdit *te = qobject_cast<QTextEdit *>( sw.mWidgetPointer.data() );
if ( te )
{
te->setText( mProperty.asExpression() );
}
}
break;
}
default:
break;
}
}
}
示例8: updateSiblingWidgets
void QgsPropertyOverrideButton::updateSiblingWidgets( bool state )
{
Q_FOREACH ( const SiblingWidget &sw, mSiblingWidgets )
{
switch ( sw.mSiblingType )
{
case SiblingCheckState:
{
// don't uncheck, only set to checked
if ( state )
{
QAbstractButton *btn = qobject_cast< QAbstractButton * >( sw.mWidgetPointer.data() );
if ( btn && btn->isCheckable() )
{
btn->setChecked( sw.mNatural ? state : !state );
}
else
{
QGroupBox *grpbx = qobject_cast< QGroupBox * >( sw.mWidgetPointer.data() );
if ( grpbx && grpbx->isCheckable() )
{
grpbx->setChecked( sw.mNatural ? state : !state );
}
}
}
break;
}
case SiblingEnableState:
{
QLineEdit *le = qobject_cast< QLineEdit * >( sw.mWidgetPointer.data() );
if ( le )
le->setReadOnly( sw.mNatural ? !state : state );
else
sw.mWidgetPointer.data()->setEnabled( sw.mNatural ? state : !state );
break;
}
case SiblingVisibility:
{
sw.mWidgetPointer.data()->setVisible( sw.mNatural ? state : !state );
break;
}
case SiblingExpressionText:
{
QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
if ( le )
{
le->setText( mProperty.asExpression() );
}
else
{
QTextEdit *te = qobject_cast<QTextEdit *>( sw.mWidgetPointer.data() );
if ( te )
{
te->setText( mProperty.asExpression() );
}
}
break;
}
case SiblingLinkedWidget:
{
if ( QgsColorButton *cb = qobject_cast< QgsColorButton * >( sw.mWidgetPointer.data() ) )
{
if ( state && mProperty.isProjectColor() )
{
QRegularExpression rx( QStringLiteral( "^project_color\\('(.*)'\\)$" ) );
QRegularExpressionMatch match = rx.match( mExpressionString );
if ( match.hasMatch() )
{
cb->linkToProjectColor( match.captured( 1 ) );
}
}
else
{
cb->linkToProjectColor( QString() );
}
}
break;
}
}
}
}