Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QDialogButtonBox does not react when it gets styled



  • now i have a proxy style called
    class ButtonProxyStyle : public QProxyStyle {}

    when i give that style to the buttons, they gets styled but does not react on clicks.

      QPushButton* buttonApply = this->ui->buttonBox->button(QDialogButtonBox::Apply);
      buttonApply->setDefault(true);
      buttonApply->setStyle(&this->buttonProxyStyle);
      QPushButton* buttonReset = this->ui->buttonBox->button(QDialogButtonBox::Reset);
      buttonReset->setStyle(&this->buttonProxyStyle);
    
      QObject::connect(buttonApply, &QPushButton::clicked, this, &MyWidget::accept);
      QObject::connect(buttonReset, &QPushButton::clicked, this, &MyWidget::reject);
    

    i do not have any idea why. can someone help?


  • Lifetime Qt Champion

    Hi,

    What if you set the style on the QApplication object ?



  • i read this post:
    How to correctly use QProxyStyles?

    for me the important step is:

    this->buttonProxyStyle->setBaseStyle(buttonApply->style());
    

Log in to reply