MainWindow 类 ¶
MainWindow继承QWidget, and is the application’s main window defined inmainwindow.ui. The style ofMainWindowcan be modified withStyleSheetEditor.
样式表范例展示如何使用样式表。
![]()
The Style Sheet example shows how widgets can be styled using Qt Style Sheets. You can open the style editor by selecting File > Edit Style Sheet, to select an existing style sheet or design your own style and load it.
The Style Sheet example consists of 2 classes:
MainWindow
StyleSheetEditor
MainWindow继承QWidget, and is the application’s main window defined inmainwindow.ui. The style ofMainWindowcan be modified withStyleSheetEditor.
StyleSheetEditorenables you to open an editor where you can load an existing style sheet. It is also possible to define a new stylesheet and load it. Its layout is defined instylesheeteditor.ui.设置指定
styleNameand grays theapplyButton.Loads the stylesheet from
styleSheetName.Enables the
applyButtonwhen the text in the buffer has changed.Sets the stylesheet properties in
qAppand disables theapplyButton.加载指定
sheetName, and sets its properties inqApp.