In this recipe, we will learn to use a font dialog to apply different fonts and styles to the selected text.
We will make use of a Text Edit widget and a Push Button widget in this application. The push button, when clicked, will open the font dialog. The font and style selected from the font dialog will be applied to the text written in the Text Edit widget.
In this recipe, we will be making use of the QFontDialog class, which displays a Dialog widget meant for selecting a font.