Qt UI patterns
Table of Contents
Every ORE Studio Qt entity appears in two places: a shared menu
(registered in setup_menus()) and the MDI window toolbar (built in
setupToolbar() inside the generated MdiWindow). The two are
wired through the controller: the menu action calls
showListWindow(); the toolbar actions call slots on the MdiWindow
itself. The ground truth for both is in the mustache templates
cpp_qt_controller.cpp.mustache and cpp_qt_mdi_window.cpp.mustache.
Return to Knowledge.
Plugin registration (on_login / setup_menus)
A Qt plugin registers its entity in two stages:
on_login: create the controller, passingctx_.main_window,ctx_.mdi_area,ctx_.client_manager, andctx_.username. Connect itsstatusMessageanderrorMessagesignals to the plugin's ownstatusMessagesignal.setup_menus: receive ashared_menus_context; add a separator and thenaddAction(icon, label)to the target menu (typicallysmc.data_management_menu). Connect the action'striggeredsignal toworkspaceController_->showListWindow()(via a guarded lambda that checks the controller is non-null).
Use IconUtils::createRecoloredIcon(Icon::X, IconUtils::DefaultIconColor)
for the menu icon. Icon selection is in icon-guidelines.
The plugin file lives at src/{Component}Plugin.cpp. See
Qt plugin architecture for the PluginBase contract and lifecycle.
MDI window toolbar
The setupToolbar() method in every generated MdiWindow follows a
fixed pattern (encoded in cpp_qt_mdi_window.cpp.mustache):
- Create
QToolBar, callsetMovable(false)andsetToolButtonStyle(Qt::ToolButtonTextUnderIcon). - Add Reload — connects to
EntityListMdiWindow::reload; also drives the stale indicator viainitializeStaleIndicator. - Add a separator.
- Add Add — connects to
addNew(); tooltip "Add new {entity}". - Add Edit — connects to
editSelected(); disabled until a row is selected. - Add Delete — connects to
deleteSelected(); disabled until a row is selected. - Add History — connects to
showHistory(); disabled until a row is selected.
All icons use IconUtils::createRecoloredIcon(Icon::X, IconUtils::DefaultIconColor).
Edit/Delete/History are enabled/disabled from the selection-changed
signal of the QTableView.
Templates
The controller and MdiWindow templates are the authoritative source.
| Template | Covers |
|---|---|
cpp_qt_controller.hpp.mustache |
Controller class declaration |
cpp_qt_controller.cpp.mustache |
on_login wiring + showListWindow |
cpp_qt_mdi_window.hpp.mustache |
MdiWindow class declaration |
cpp_qt_mdi_window.cpp.mustache |
setupToolbar() — the full toolbar pattern |
See also
- Qt plugin architecture —
PluginBasecontract, plugin lifecycle, menu sections. - icon-guidelines — icon selection for menu and toolbar actions.
- Qt entity patterns — ClientModel, list window, dialog shapes.
- qt-entity-creator — skill that orchestrates Qt UI creation.