Common Qt widgets

In the previous section, we introduced the QPushButton class and stated that it indirectly inherits the QWidget class. To create a window, we used the QWidget class. As it turns out, QWidget represents the capability to render to the screen, and it's the basic class that all widgets inherit from. It has a lot of properties and functions, such as enabled, a boolean property that's true if the widget is enabled. To access it, we use the isEnabled() and setEnabled() functions. To control the size of the widget, we use its height and width, which represent the height and width of the widget. To get their values, we call height() and width(), respectively. To set a new height and width, we should use the resize() function, which ...

Get Expert C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.