KXmlGui

KXMLGUI Session Macros and Functions

Macros

#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS   3
 

Functions

template<typename T >
void kRestoreMainWindows ()
 
template<typename T0 , typename T1 , typename... Tn>
void kRestoreMainWindows ()
 

Detailed Description

Macro Definition Documentation

◆ KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS

#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS   3

Returns the maximal number of arguments that are actually supported by kRestoreMainWindows().

Definition at line 650 of file kmainwindow.h.

Function Documentation

◆ kRestoreMainWindows() [1/2]

template<typename T >
void kRestoreMainWindows ( )
inline

Restores the last session.

(To be used in your main function).

These functions work also if you have more than one kind of top-level widget (each derived from KMainWindow, of course).

Imagine you have three kinds of top-level widgets: the classes childMW1, childMW2 and childMW3. Then you can just do:

int main(int argc, char *argv[])
{
// [...]
if (qApp->isSessionRestored())
kRestoreMainWindows<childMW1, childMW2, childMW3>();
else {
// create default application as usual
}
// [...]
}

kRestoreMainWindows<>() will create (on the heap) as many instances of your main windows as have existed in the last session and call KMainWindow::restore() with the correct arguments. Note that also QWidget::show() is called implicitly.

Currently, these functions are provided for up to three template arguments. If you need more, tell us. To help you in deciding whether or not you can use kRestoreMainWindows, a define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided.

Note
Prefer this function over directly calling KMainWindow::restore().
Template Parameters
TTop-level widget class
See also
KMainWindow::restore()
KMainWindow::classNameOfToplevel()

Definition at line 692 of file kmainwindow.h.

◆ kRestoreMainWindows() [2/2]

template<typename T0 , typename T1 , typename... Tn>
void kRestoreMainWindows ( )
inline

Restores the last session.

This is an overloaded function.

Use this with multiple different top-level widget classes.

Template Parameters
T0One top-level widget class
T1Explicit other top-level widget class for disambiguation from base template
TnParameter pack to take 0..n further KMainWindows
See also
kRestoreMainWindows()

Definition at line 714 of file kmainwindow.h.

This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.