What We Know About QPushButtons - russ-hensel/qt5_by_example GitHub Wiki
Table of Contents
Content here... A pushbutton or QPushButton is a more or less rectangular area on a GUI that typically:
- has a label like "Push Me"
- causes something to happen when pushed -- like the application get smaller on the screen
- visually seems to push down when clicked and pop back up again when released.
It is a lot like a QLineEdit, but that widget is normally for single line text edit, or QLable which is normally for single line text display. If you want to be clever you can sometimes substitute one for the other, but this is usually a bad idea.
Now we will look deeper into the topic of buttons, and talk a bit about how buttons share many features with many other widgets.
After a widget is created we can change may of its characteristics ( and some of these can also be set up in its init, but changing at runtime is more general )
These characteristics are part of the widgets state. Some related to appearance. For example:
- size
- font
- colors
Others are related to user actions the widget can detect and act on
- button press
- get focus
Different widget may have different appearance and action states, depending on their intended use.
The code for the tab is: qt5_by_example/tabs/basic_widgets/tab_q_push_button.py at main · russ-hensel/qt5_by_example https://github.com/russ-hensel/qt5_by_example/blob/main/tabs/basic_widgets/tab_q_push_button.py but is better viewed in your own IDE. Also NOTE: this code is our reference for how a tab should be written and is documented by comments in the code, both the framework and the code relavant to the widges of interest. The framework code is not documented as well in other tabs. See Tab Framework Code
Interaction to try on this tab:
- button press
- hover look for tool tips
- poke around -- do not forget to look
To see and change the state use the mutate/examine button and read the code in the mutate_x methods.
the documentation is in the code. Coverage is not complete, work continues.
You can use the wat-inspect to find out more or dive into the documentation which is all over the web.
)