Skip to content
  • 1 Votes
    8 Posts
    378 Views
    J
    So i finally found out what the problem was and fixed it... it seems i had given specific size settings to some component via a stylesheet, and some components did not have some/all properties defined in the stylesheet. Providing the correct info via the stylesheet appears to have resolved the situation. Eg. for the radio buttons i now have... QRadioButton::indicator { width: 14px; height: 14px; } in my style sheet, and it seems to properly respect the scaling when i have both types of scaling in use.
  • 0 Votes
    9 Posts
    2k Views
    Christian EhrlicherC
    Name your buttons in designer radioButton_X with X as your id, use a loop in your code to add them to QButtonGroup later on: QButtonGroup *bg = ... for (int i = 1; i <= maxCount; ++i) { auto button = findChild<QRadioButton*>(QString("radioButton_%1").arg(i)); if (button) { bg->addButton(button, id); } else { qWarning() << "Something went wrong"; } } or directly address them const auto buttons = { ui->radioButton_1, ui->radioButton_2, ... }; int id = 1; for (auto button : buttons) bg->addButton(button, id++);
  • QWizard and radio buttons

    Unsolved General and Desktop qwizardpage qradiobutton qwizard
    2
    0 Votes
    2 Posts
    451 Views
    JonBJ
    @voltron I don't read QWizardPage::registerField() as making the widget mandatory to fill out? Only if you choose to make it compulsory.
  • move indicator of QRadioButton to right side

    Solved General and Desktop qradiobutton
    3
    0 Votes
    3 Posts
    483 Views
    Joe JohnsonJ
    @J-Hilk It works,thanks
  • Checking QRadioButton programmatically?

    Solved General and Desktop qradiobutton
    6
    0 Votes
    6 Posts
    3k Views
    L
    @JonB Hi I just tried it again, and indeed it worked without setting any other choices to false. Don't know why it didn't work before... switch (savedFormat) { case MyFormat::ChoiceOne: m_ui.mySavingRadioButton_choiceOne->setChecked(true); break; case MyFormat::ChoiceTwo: m_ui.mySavingRadioButton_choiceTwo->setChecked(true); break; }
  • Clickable QCheckBox how to?

    Unsolved General and Desktop qcheckbox qradiobutton qt5.5.1
    6
    0 Votes
    6 Posts
    4k Views
    D
    QCheckBox inherits from QAbstractButton, which provides a hitButton method that controls which parts of the button are clickable. All you need to do is make a new subclass of QCheckBox and override hitButton so it always returns true: class BigHitCheckBox : public QCheckBox { bool hitButton(const QPoint & pos) const override { Q_UNUSED(pos); return true; } }; This is much simpler than the solutions previously mentioned, and it should play well with the hovering, disabling, and tristate features of the checkbox without any extra effort. By the way, this makes the entire checkbox widget clickable, but it doesn't make other widgets outside the checkbox clickable. I don't think the OP needed that. --David
  • 0 Votes
    5 Posts
    2k Views
    mrjjM
    Hi Checkbox is a QAbstractButton child. I think QButtonGroup is the one doing the real work of "exclusive" so I wonder if its possible to create a child of QButtonGroup and teach it to handle new types. But for QGroupBox, I did not trip over anything that suggest it can use another QButtonGroup. :(
  • 0 Votes
    6 Posts
    5k Views
    p3c0P
    @CodeVisio For checkboxes I think you must have set Qt::ItemIsUserCheckable flag for QListWidgetItem. So there's a way to do so. But for radiobutton theres none and thus have to create the widget explicitly. Edit: Links