KXMLGUI Session Macros and Functions


#define RESTORE(type)


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

Detailed Description

Macro Definition Documentation


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

Definition at line 681 of file kmainwindow.h.

#define RESTORE (   type)
{ \
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.

since 5.0, use kRestoreMainWindows() instead

Definition at line 666 of file kmainwindow.h.

Function Documentation

template<typename T >
void kRestoreMainWindows ( )

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

Definition at line 721 of file kmainwindow.h.

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

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 740 of file kmainwindow.h.

This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Sep 26 2021 22:51:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.