akseart
akseart

Reputation: 60

PyQt6 Connecting a slot to a button in QDialogButtonBox

How to connect slots on QDialogButtonBox in PyQt6? I can connect reject and accept signal, but i can't connected another buttons (e.g. Reset).

class Test(QtWidgets.QDialog):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi("test.ui", self)
        self.buttonBox.accepted.connect(lambda: print(1))
        self.buttonBox.rejected.connect(lambda: print(2))


        # AttributeError: clicked
        self.buttonBox.StandardButton.Reset.clicked.connect(lambda: print(3))

Upvotes: 0

Views: 745

Answers (1)

SimoN SavioR
SimoN SavioR

Reputation: 604

you can use this code

self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.close)

Upvotes: 1

Related Questions