KXmlGui
kmainwindow.h
35 * It extends QMainWindow with session management capabilities. For ready-made window functionality and simpler UI management, use KXmlGuiWindow instead.
37 * Define the minimum/maximum height/width of your central widget and KMainWindow will take this into account.
38 * For fixed size windows set your main widget to a fixed size. Fixed aspect ratios (QWidget::heightForWidth()) and fixed width widgets are not supported.
43 * Use setAutoSaveSettings() to automatically save and restore the window geometry and toolbar/menubar/statusbar state when the application is restarted.
45 * Use kRestoreMainWindows() in your main function to restore your windows when the session is restored.
50 * Reimplement saveProperties() / readProperties() or saveGlobalProperties() / readGlobalProperties()
56 * See https://develop.kde.org/docs/use/session-managment for more information on session management.
122 * @returns @c true if the number of KMainWindow instances of the previous session did contain the requested @p numberOfInstances, @c false otherwise.
230 * saveMainWindowSettings( KConfigGroup(KSharedConfig::openConfig(), groupName) ) will be called.
258 void setAutoSaveSettings(const QString &groupName = QStringLiteral("MainWindow"), bool saveWindowSize = true);
virtual void applyMainWindowSettings(const KConfigGroup &config)
Read settings for statusbar, menubar and toolbar from their respective groups in the config file and ...
Definition kmainwindow.cpp:677
bool restore(int numberOfInstances, bool show=true)
Attempt to restore the top-level widget as defined by numberOfInstances (1..X).
Definition kmainwindow.cpp:466
KToolBar * toolBar(const QString &name=QString())
This is useful to both call specific toolbars that have been created or to generate a default one upo...
Definition kmainwindow.cpp:960
bool hasMenuBar()
bool event(QEvent *event) override
Reimplemented to catch QEvent::Polish in order to adjust the object name if needed,...
Definition kmainwindow.cpp:853
void setAutoSaveSettings(const QString &groupName=QStringLiteral("MainWindow"), bool saveWindowSize=true)
This enables autosave of toolbar/menubar/statusbar settings (and optionally window size).
Definition kmainwindow.cpp:779
virtual void saveProperties(KConfigGroup &)
Saves your instance-specific properties.
Definition kmainwindow.h:540
void setSettingsDirty()
Tell the main window that it should save its settings when being closed.
Definition kmainwindow.cpp:767
KConfigGroup autoSaveConfigGroup() const
Definition kmainwindow.cpp:824
void saveMainWindowSettings(KConfigGroup &config)
Manually save the settings for statusbar, menubar and toolbar to their respective groups in the KConf...
Definition kmainwindow.cpp:589
static const QString classNameOfToplevel(int instanceNumber)
Useful if your application uses different kinds of top-level windows.
Definition kmainwindow.cpp:451
virtual void setCaption(const QString &caption)
Assigns a KDE compliant caption (window title).
Definition kmainwindow.cpp:481
virtual void setPlainCaption(const QString &caption)
Make a plain caption without any modifications.
Definition kmainwindow.cpp:496
void setStateConfigGroup(const QString &configGroup)
Assigns the config group name for the KConfigGroup returned by stateConfigGroup.
Definition kmainwindow.cpp:830
KMainWindow(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructs a main window.
Definition kmainwindow.cpp:210
virtual void readProperties(const KConfigGroup &)
Reads your instance-specific properties.
Definition kmainwindow.h:560
static bool canBeRestored(int numberOfInstances)
Definition kmainwindow.cpp:437
virtual bool queryClose()
This function is called before the window is closed, either by the user or indirectly by the session ...
Definition kmainwindow.cpp:555
QMainWindow(QWidget *parent, Qt::WindowFlags flags)
virtual bool event(QEvent *event) override
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
QObject * parent() const const
typedef WindowFlags
QWidget(QWidget *parent, Qt::WindowFlags f)
virtual void closeEvent(QCloseEvent *event)
virtual void keyPressEvent(QKeyEvent *event)
void show()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:48:21 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:48:21 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.