KXmlGui

KXMLGUI Session Macros and Functions

Macros

#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS   3
 
#define RESTORE(type)
 

Functions

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

Detailed Description

Macro Definition Documentation

#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS   3

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

Definition at line 673 of file kmainwindow.h.

#define RESTORE (   type)
Value:
{ int n = 1;\
(new type)->restore(n);\
n++;}}
Type type(const QSqlDatabase &db)
static bool canBeRestored(int number)
If the session did contain so high a number, true is returned, else false.

Restores the last session.

Deprecated:
since 5.0, use kRestoreMainWindows() instead

Definition at line 662 of file kmainwindow.h.

Function Documentation

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 toplevel widget (each derived from KMainWindow, of course).

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

1 int main(int argc, char *argv[])
2 {
3  // [...]
4  if (qApp->isSessionRestored())
5  kRestoreMainWindows<childMW1, childMW2, childMW3>();
6  else {
7  // create default application as usual
8  }
9  // [...]
10 }

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.

Template Parameters
Ttoplevel widget class
See also
KMainWindow::restore()
KMainWindow::classNameOfToplevel()

Definition at line 713 of file kmainwindow.h.

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

Restores the last session.

Overloaded method for usage with multiple different toplevel widget classes.

Template Parameters
T0one toplevel widget class
T1explicit other toplevel widget class for disambiguation from base template
TnParameter pack to take 0..n further KMainWindows

Definition at line 732 of file kmainwindow.h.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:49:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.