qt-light/examples/custom-widgets/README.md

14 lines
658 B
Markdown
Raw Permalink Normal View History

# “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 buttons 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”.