Jaidyn Ann
1704d392e8
This small example demonstrates defining and binding to your own subclass of a QT widget.
14 lines
658 B
Markdown
14 lines
658 B
Markdown
# “Goodbye” example
|
||
|
||
This is a bare-minimum example egg that shows how one can define their own
|
||
custom QT widgets and bind to their methods in a way compatible with qt-light.
|
||
|
||
It defines an `OurButton` C++ class that is derived from
|
||
[`QPushButton`](https://doc.qt.io/qt-6/qpushbutton.html) with one change:
|
||
It adds a `SayGoodbye()` method that changes the button’s label to “Goodbye”.
|
||
|
||
We write a wrapper C-function `gb_saygoodbye()` and bind this function into
|
||
our `goodbye-widgets` module under the name `gb:saygoodbye`. It is run on the
|
||
button (originally labelled “Quit” in the `goodbye.ui` file), so changing its
|
||
text to “Goodbye”.
|