The QPainter class is the focus of this recipe. The setFont() and drawText() methods of the QPainter class will be used in this recipe. The setFont() method will be invoked to set the font style and font size chosen by the user and the drawText() method will draw the text written by the user in the Text Edit widget in the specified font style and size. Here is the step-by-step procedure to learn how these methods are used:
- Let's create an application based on the Dialog without Buttons template.
- Add the QLabel, QTextEdit, QListWidget, QComboBox, and QPushButton widgets to the form by dragging and dropping a Label widget, a Text Edit widget, a List Widget box, a Combo Box widget, and a Push Button widget on the form.
- Set ...