Main Window¶
An enhanced QMainWindow with built-in theme support, status bar, and DCC integration.
Preview
FXMainWindow
¶
Bases: ,
Customized QMainWindow class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
Parent widget. Defaults to |
None
|
|
|
Path to the window icon image. Defaults to |
None
|
|
|
Title of the window. Defaults to |
None
|
|
|
Window size as width and height.
Defaults to |
None
|
|
|
URL to the tool's documentation.
Defaults to |
None
|
|
|
Version label for the window.
Defaults to |
None
|
|
|
Company name for the window.
Defaults to |
None
|
|
|
Path to the UI file for loading.
Defaults to |
None
|
|
|
Whether to set the default stylesheet.
Defaults to |
True
|
Methods:
| Name | Description |
|---|---|
|
Handle the window close event. |
|
Get a list of all available theme names. |
|
Hides the banner. |
|
Hides the status line. |
|
Override the QMainWindow's setCentralWidget method. |
|
Override the setWindowTitle method. |
|
Sets the icon of the banner. |
|
Sets the text of the banner. |
|
Sets the company label in the status bar. |
|
Sets the project label in the status bar. |
|
Set the colors of the status line. |
|
Set the theme of the window. |
|
Sets the UI file and loads the UI. |
|
Sets the version label in the status bar. |
|
Shows the banner. |
|
Shows the status line. |
|
Returns the FXStatusBar instance associated with this window. |
|
Toggle the theme of the window to the next available theme. |
closeEvent
¶
Handle the window close event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The close event. |
required |
get_available_themes
¶
setCentralWidget
¶
Override the QMainWindow's setCentralWidget method.
Ensures that the status line is always at the bottom of the window and the banner is always at the top.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The widget to set as the central widget. |
required |
Note
Overrides the base class method.
setWindowTitle
¶
Override the setWindowTitle method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The new window title. |
required |
set_banner_icon
¶
set_banner_text
¶
Sets the text of the banner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The text to set in the banner. |
required |
set_company_label
¶
Sets the company label in the status bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The company name. |
required |
set_project_label
¶
Sets the project label in the status bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The project name. |
required |
set_status_line_colors
¶
set_theme
¶
Set the theme of the window.
This method can be called from external code to apply a specific theme, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The theme name to apply (e.g., "dark", "light", or custom). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
|
The theme that was applied. |
Examples:
set_ui_file
¶
Sets the UI file and loads the UI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
Path to the UI file to load. |
required |
set_version_label
¶
Sets the version label in the status bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The version string. |
required |
statusBar
¶
Returns the FXStatusBar instance associated with this window.
Returns:
| Name | Type | Description |
|---|---|---|
FXStatusBar |
|
The FXStatusBar instance associated with this window. |
Note
Overrides the base class method.
toggle_theme
¶
Toggle the theme of the window to the next available theme.
This method can be called from external code to cycle through themes, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Returns:
| Name | Type | Description |
|---|---|---|
str |
|
The new theme that was applied. |
Examples: