|
Krita Source Code Documentation
|
KDE top level main window with predefined action layout More...
#include <kxmlguiwindow.h>
Inheritance diagram for KXmlGuiWindow:Public Types | |
| enum | StandardWindowOption { ToolBar = 1 , Keys = 2 , StatusBar = 4 , Save = 8 , Create = 16 , Default = ToolBar | Keys | StatusBar | Save | Create } |
Public Types inherited from KisKXMLGUIClient | |
| enum | ReverseStateChange { StateNoReverse , StateReverse } |
Public Slots | |
| virtual void | configureToolbars () |
| virtual void | slotStateChanged (const QString &newstate) |
| void | slotStateChanged (const QString &newstate, bool reverse) |
Public Slots inherited from KisKMainWindow | |
| void | appHelpActivated (void) |
| void | setSettingsDirty () |
Public Member Functions | |
| void | applyMainWindowSettings (const KConfigGroup &config) override |
| void | createGUI (const QString &xmlfile=QString()) |
| void | createStandardStatusBarAction () |
| void | finalizeGUI (bool force) |
| void | finalizeGUI (KisKXMLGUIClient *client) override |
| virtual KisKXMLGUIFactory * | guiFactory () |
| bool | isHelpMenuEnabled () const |
| bool | isStandardToolBarMenuEnabled () const |
| KXmlGuiWindow (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags()) | |
| void | setHelpMenuEnabled (bool showHelpMenu=true) |
| void | setStandardToolBarMenuEnabled (bool enable) |
| void | setupGUI (const QSize &defaultSize, StandardWindowOptions options=Default, const QString &xmlfile=QString()) |
| void | setupGUI (StandardWindowOptions options=Default, const QString &xmlfile=QString()) |
| void | setupToolbarMenuActions () |
| QAction * | toolBarMenuAction () |
| ~KXmlGuiWindow () override | |
| Destructor. | |
Public Member Functions inherited from KisKMainWindow | |
| KConfigGroup | autoSaveConfigGroup () const |
| QString | autoSaveGroup () const |
| bool | autoSaveSettings () const |
| QString | dbusName () const |
| bool | hasMenuBar () |
| KisKMainWindow (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags()) | |
| void | resetAutoSaveSettings () |
| bool | restore (int number, bool show=true) |
| void | saveMainWindowSettings (KConfigGroup &config) |
| void | setAutoSaveSettings (const KConfigGroup &group, bool saveWindowSize=true) |
| void | setAutoSaveSettings (const QString &groupName=QLatin1String("MainWindow"), bool saveWindowSize=true) |
| KisToolBar * | toolBar (const QString &name=QString()) |
| QList< KisToolBar * > | toolBars () const |
| ~KisKMainWindow () override | |
| Destructor. | |
Public Member Functions inherited from KisKXMLGUIBuilder | |
| KisKXMLGUIClient * | builderClient () const |
| virtual QStringList | containerTags () const |
| virtual QWidget * | createContainer (QWidget *parent, int index, const QDomElement &element, QAction *&containerAction) |
| virtual QAction * | createCustomElement (QWidget *parent, int index, const QDomElement &element) |
| virtual QStringList | customTags () const |
| KisKXMLGUIBuilder (QWidget *widget) | |
| virtual void | removeContainer (QWidget *container, QWidget *parent, QDomElement &element, QAction *containerAction) |
| virtual void | removeCustomElement (QWidget *parent, QAction *action) |
| void | setBuilderClient (KisKXMLGUIClient *client) |
| QWidget * | widget () |
| virtual | ~KisKXMLGUIBuilder () |
Public Member Functions inherited from KisKXMLGUIClient | |
| QAction * | action (const char *name) const |
| virtual QAction * | action (const QDomElement &element) const |
| virtual KisKActionCollection * | actionCollection () const |
| void | addStateActionDisabled (const QString &state, const QString &action) |
| void | addStateActionEnabled (const QString &state, const QString &action) |
| void | beginXMLPlug (QWidget *) |
| QList< KisKXMLGUIClient * > | childClients () |
| KisKXMLGUIBuilder * | clientBuilder () const |
| virtual QString | componentName () const |
| virtual QDomDocument | domDocument () const |
| void | endXMLPlug () |
| KisKXMLGUIFactory * | factory () const |
| StateChange | getActionsToChangeForState (const QString &state) |
| void | insertChildClient (KisKXMLGUIClient *child) |
| KisKXMLGUIClient () | |
| KisKXMLGUIClient (KisKXMLGUIClient *parent) | |
| virtual QString | localXMLFile () const |
| KisKXMLGUIClient * | parentClient () const |
| void | plugActionList (const QString &name, const QList< QAction * > &actionList) |
| void | prepareXMLUnplug (QWidget *) |
| void | reloadXML () |
| void | removeChildClient (KisKXMLGUIClient *child) |
| void | replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false) |
| void | setClientBuilder (KisKXMLGUIBuilder *builder) |
| void | setFactory (KisKXMLGUIFactory *factory) |
| void | setXMLGUIBuildDocument (const QDomDocument &doc) |
| void | unplugActionList (const QString &name) |
| virtual QString | xmlFile () const |
| QDomDocument | xmlguiBuildDocument () const |
| virtual | ~KisKXMLGUIClient () |
Protected Slots | |
| virtual void | saveNewToolbarConfig () |
Protected Slots inherited from KisKMainWindow | |
| void | saveAutoSaveSettings () |
Protected Member Functions | |
| bool | event (QEvent *event) override |
Protected Member Functions inherited from KisKMainWindow | |
| void | closeEvent (QCloseEvent *) override |
| bool | event (QEvent *event) override |
| KisKMainWindow (KisKMainWindowPrivate &dd, QWidget *parent, Qt::WindowFlags f) | |
| virtual bool | queryClose () |
| virtual void | readGlobalProperties (KConfig *sessionConfig) |
| virtual void | readProperties (const KConfigGroup &) |
| bool | readPropertiesInternal (KConfig *, int) |
| virtual void | saveGlobalProperties (KConfig *sessionConfig) |
| virtual void | saveProperties (KConfigGroup &) |
| void | savePropertiesInternal (KConfig *, int) |
| bool | settingsDirty () const |
| virtual bool | windowsLayoutSavingAllowed () const |
Protected Member Functions inherited from KisKXMLGUIBuilder | |
| virtual void | virtual_hook (int id, void *data) |
Protected Member Functions inherited from KisKXMLGUIClient | |
| void | loadStandardsXmlFile () |
| virtual void | setComponentName (const QString &componentName, const QString &componentDisplayName) |
| void | setDOMDocument (const QDomDocument &document, bool merge=false) |
| void | setLocalXMLFile (const QString &file) |
| void | setXML (const QString &document, bool merge=false) |
| void | setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true) |
| virtual void | stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse) |
| virtual void | virtual_hook (int id, void *data) |
Properties | |
| QString | autoSaveGroup |
| bool | autoSaveSettings |
| bool | hasMenuBar |
| bool | standardToolBarMenuEnabled |
Properties inherited from KisKMainWindow | |
| QString | autoSaveGroup |
| bool | autoSaveSettings |
| bool | hasMenuBar |
Additional Inherited Members | |
Static Public Member Functions inherited from KisKMainWindow | |
| static bool | canBeRestored (int number) |
| static const QString | classNameOfToplevel (int number) |
| static QList< KisKMainWindow * > | memberList () |
Static Public Member Functions inherited from KisKXMLGUIClient | |
| static QString | findMostRecentXMLFile (const QStringList &files, QString &doc) |
Static Protected Member Functions inherited from KisKXMLGUIClient | |
| static QString | standardsXmlFileLocation () |
Protected Attributes inherited from KisKMainWindow | |
| KisKMainWindowPrivate *const | k_ptr |
KDE top level main window with predefined action layout
Instead of creating a KisKMainWindow manually and assigning menus, menu entries, toolbar buttons and actions to it by hand, this class can be used to load an rc file to manage the main window's actions.
See http://techbase.kde.org/Development/Tutorials/Using_KActions#XMLGUI for essential information on the XML file format and usage of this class.
Definition at line 46 of file kxmlguiwindow.h.
| Enumerator | |
|---|---|
| ToolBar | adds action to show/hide the toolbar(s) and adds action to configure the toolbar(s).
|
| Keys | adds action to show the key configure action. |
| StatusBar | adds action to show/hide the statusbar if the statusbar exists.
|
| Save | auto-saves (and loads) the toolbar/menubar/statusbar settings and window size using the default name.
Typically you want to let the default window size be determined by the widgets size hints. Make sure that setupGUI() is called after all the widgets are created ( including setCentralWidget ) so the default size's will be correct.
|
| Create | calls createGUI() once ToolBar, Keys and Statusbar have been taken care of.
NOTE: when using KParts::MainWindow, remove this flag from the setupGUI call, since you'll be using createGUI(part) instead. void setupGUI(StandardWindowOptions options=Default, const QString &xmlfile=QString()) Definition kxmlguiwindow.cpp:173 |
| Default | All the above option (this is the default) |
Definition at line 174 of file kxmlguiwindow.h.
|
explicit |
Construct a main window.
| parent | The widget parent. This is usually 0 but it may also be the window group leader. In that case, the KisKMainWindow becomes sort of a secondary window. |
| f | Specify the widget flags. The default is Qt::Window and Qt::WA_DeleteOnClose. Qt::Window indicates that a main window is a toplevel window, regardless of whether it has a parent or not. Qt::WA_DeleteOnClose indicates that a main window is automatically destroyed when its window is closed. Pass 0 if you do not want this behavior. |
KisKMainWindows must be created on the heap with 'new', like:
IMPORTANT: For session management and window management to work properly, all main windows in the application should have a different name. If you don't do it, KisKMainWindow will create a unique name, but it's recommended to explicitly pass a window name that will also describe the type of the window. If there can be several windows of the same type, append '#' (hash) to the name, and KisKMainWindow will replace it with numbers to make the names unique. For example, for a mail client which has one main window showing the mails and folders, and which can also have one or more windows for composing mails, the name for the folders window should be e.g. "mainwindow" and for the composer windows "composer#".
Definition at line 73 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
|
override |
Destructor.
Will also destroy the toolbars, and menubar if needed.
Definition at line 104 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
|
overridevirtual |
Read settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them.
| config | Config group to read the settings from. KF5 porting note: the unused bool argument was removed, make sure to remove it from your reimplementations too! And add a override for good measure. |
Reimplemented from KisKMainWindow.
Definition at line 365 of file kxmlguiwindow.cpp.
References KisKMainWindow::applyMainWindowSettings(), KisKXMLGUIBuilder::d, and K_D.
|
virtualslot |
Show a standard configure toolbar dialog.
This slot can be connected directly to the action to configure toolbar. This is very simple to do that by adding a single line
Definition at line 149 of file kxmlguiwindow.cpp.
References connect(), KisKXMLGUIBuilder::d, guiFactory(), K_D, KisKMainWindow::saveMainWindowSettings(), and saveNewToolbarConfig().
| void KXmlGuiWindow::createGUI | ( | const QString & | xmlfile = QString() | ) |
Create a GUI given a local XML file. In a regular app you usually want to use setupGUI() instead of this one since it does more things for free like setting up the toolbar/shortcut edit actions, etc.
If xmlfile is 0, then it will try to construct a local XML filename like appnameui.xmlgui where 'appname' is your app's name. If that file does not exist, then the XML UI code will only use the global (standard) XML file for the layout purposes.
| xmlfile | The local xmlfile (relative or absolute) |
Definition at line 216 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::actionCollection(), KisKActionCollection::addAction(), KisKXMLGUIFactory::addClient(), KisKXMLGUIClient::componentName(), KisKXMLGUIBuilder::d, guiFactory(), K_D, KisKXMLGUIClient::loadStandardsXmlFile(), KisKHelpMenu::menuAboutApp, KisKHelpMenu::menuAboutKDE, KisKHelpMenu::menuHelpContents, KisKHelpMenu::menuReportBug, KisKHelpMenu::menuSwitchLanguage, KisKHelpMenu::menuWhatsThis, KisKXMLGUIFactory::removeClient(), KisKXMLGUIFactory::reset(), KisKXMLGUIClient::setXMLFile(), KisKXMLGUIClient::setXMLGUIBuildDocument(), KisKMainWindow::toolBars(), and KisKXMLGUIClient::xmlFile().
| void KXmlGuiWindow::createStandardStatusBarAction | ( | ) |
Sets whether KisKMainWindow should provide a menu that allows showing/hiding of the statusbar ( using KToggleStatusBarAction ).
The menu / menu item is implemented using xmlgui. It will be inserted in your menu structure in the 'Settings' menu.
Note that you should enable this feature before calling createGUI() ( or similar ).
If an application maintains the action on its own (i.e. never calls this function) a connection needs to be made to let KisKMainWindow know when that status (hidden/shown) of the statusbar has changed. For example: connect(action, SIGNAL(activated()), kmainwindow, SLOT(setSettingsDirty())); Otherwise the status (hidden/show) of the statusbar might not be saved by KisKMainWindow.
Definition at line 337 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::actionCollection(), connect(), KisKXMLGUIBuilder::d, K_D, KisKMainWindow::setSettingsDirty(), and KStandardAction::showStatusbar().
|
overrideprotected |
Reimplemented to catch QEvent::Polish in order to adjust the object name if needed, once all constructor code for the main window has run. Also reimplemented to catch when a QDockWidget is added or removed.
Definition at line 110 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::actionCollection(), KisKMainWindow::dbusName(), and KisKMainWindow::event().
| void KXmlGuiWindow::finalizeGUI | ( | bool | force | ) |
Definition at line 354 of file kxmlguiwindow.cpp.
References applyMainWindowSettings(), KisKMainWindow::autoSaveConfigGroup(), and autoSaveSettings.
|
overridevirtual |
Reimplemented from KisKXMLGUIBuilder.
Definition at line 377 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::finalizeGUI().
|
virtual |
Definition at line 138 of file kxmlguiwindow.cpp.
References connect(), KisKXMLGUIBuilder::d, and K_D.
| bool KXmlGuiWindow::isHelpMenuEnabled | ( | ) | const |
Return true when the help menu is enabled
Definition at line 132 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
| bool KXmlGuiWindow::isStandardToolBarMenuEnabled | ( | ) | const |
Definition at line 331 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
|
protectedvirtualslot |
Rebuilds the GUI after KisKEditToolbar changed the toolbar layout.
Definition at line 162 of file kxmlguiwindow.cpp.
References KisKXMLGUIFactory::addClient(), applyMainWindowSettings(), guiFactory(), and KisKXMLGUIFactory::removeClient().
| void KXmlGuiWindow::setHelpMenuEnabled | ( | bool | showHelpMenu = true | ) |
Enables the build of a standard help menu when calling createGUI/setupGUI().
The default behavior is to build one, you must call this function to disable it
Definition at line 126 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
| void KXmlGuiWindow::setStandardToolBarMenuEnabled | ( | bool | enable | ) |
Sets whether KisKMainWindow should provide a menu that allows showing/hiding the available toolbars ( using KToggleToolBarAction ) . In case there is only one toolbar configured a simple 'Show <toolbar name here>' menu item is shown.
The menu / menu item is implemented using xmlgui. It will be inserted in your menu structure in the 'Settings' menu.
If your application uses a non-standard xmlgui resource file then you can specify the exact position of the menu / menu item by adding a <Merge name="StandardToolBarMenuHandler" /> line to the settings menu section of your resource file ( usually appname.xmlgui ).
Note that you should enable this feature before calling createGUI() ( or similar ) .
Definition at line 304 of file kxmlguiwindow.cpp.
References KisKXMLGUIFactory::addClient(), KisKXMLGUIBuilder::d, KisKXMLGUIClient::factory(), K_D, and KisKXMLGUIFactory::removeClient().
| void KXmlGuiWindow::setupGUI | ( | const QSize & | defaultSize, |
| StandardWindowOptions | options = Default, | ||
| const QString & | xmlfile = QString() ) |
Configures the current windows and its actions in the typical KDE fashion. The options are all enabled by default but can be turned off if desired through the params or if the prereqs don't exists.
defaultSize The default size of the window
Typically this function replaces createGUI().
options parameter. Also, call setupGUI always after you call createGUI. Definition at line 178 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::actionCollection(), KisKMainWindow::autoSaveConfigGroup(), configureToolbars(), KStandardAction::configureToolbars(), Create, createGUI(), createStandardStatusBarAction(), KisKXMLGUIBuilder::d, guiFactory(), K_D, KStandardAction::keyBindings(), Keys, Save, KisKMainWindow::setAutoSaveSettings(), setStandardToolBarMenuEnabled(), StatusBar, and ToolBar.
| void KXmlGuiWindow::setupGUI | ( | StandardWindowOptions | options = Default, |
| const QString & | xmlfile = QString() ) |
Configures the current windows and its actions in the typical KDE fashion. The options are all enabled by default but can be turned off if desired through the params or if the prereqs don't exists.
Typically this function replaces createGUI().
options parameter. Definition at line 173 of file kxmlguiwindow.cpp.
References setupGUI().
| void KXmlGuiWindow::setupToolbarMenuActions | ( | ) |
Definition at line 96 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
|
virtualslot |
Apply a state change
Enable and disable actions as defined in the XML rc file
Definition at line 292 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::stateChanged(), and KisKXMLGUIClient::StateNoReverse.
|
slot |
Apply a state change
Enable and disable actions as defined in the XML rc file, can "reverse" the state (disable the actions which should be enabled, and vice-versa) if specified.
Definition at line 297 of file kxmlguiwindow.cpp.
References KisKXMLGUIClient::stateChanged(), KisKXMLGUIClient::StateNoReverse, and KisKXMLGUIClient::StateReverse.
| QAction * KXmlGuiWindow::toolBarMenuAction | ( | ) |
Returns a pointer to the mainwindows action responsible for the toolbars menu
Definition at line 86 of file kxmlguiwindow.cpp.
References KisKXMLGUIBuilder::d, and K_D.
|
read |
Definition at line 52 of file kxmlguiwindow.h.
|
read |
Definition at line 51 of file kxmlguiwindow.h.
|
read |
Definition at line 50 of file kxmlguiwindow.h.
|
readwrite |
Definition at line 53 of file kxmlguiwindow.h.