문제

Is it possible to deactivate a QSpinBox if a certain value is chosen in a QComboBox. I've tried several things, but either the QSpinbox is deactived all the time or it wont deactivate at all.

도움이 되었습니까?

해결책

If I understand the question correctly, something along these lines should work:

connect( myComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxIndexChanged()) );

...

void comboBoxIndexChanged() {
    if( comboBox->currentText() == MagicalValue )
        mySpinBox->setEnabled( false );
    else
        mySpinbox->setEnabled( true );
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top