\section{KMain\-Window Class Reference}
\label{classKMainWindow}\index{KMainWindow@{KMainWindow}}
KDE top level main window  


{\tt \#include $<$kmainwindow.h$>$}

Inheritance diagram for KMain\-Window:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=165pt]{classKMainWindow__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KMain\-Window:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=170pt]{classKMainWindow__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Creation\-Flags} \{ {\bf No\-DCOPObject} =  1
 \}
\item 
enum {\bf Standard\-Window\-Options} \{ \par
{\bf Tool\-Bar} =  1, 
{\bf Keys} =  2, 
{\bf Status\-Bar} =  4, 
{\bf Save} =  8, 
\par
{\bf Create} =  16
 \}
\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
int {\bf configure\-Toolbars} ()
\item 
virtual void {\bf set\-Caption} (const {\bf QString} \&caption)
\item 
virtual void {\bf set\-Caption} (const {\bf QString} \&caption, bool modified)
\item 
virtual void {\bf set\-Plain\-Caption} (const {\bf QString} \&caption)
\item 
void {\bf app\-Help\-Activated} (void)
\item 
virtual void {\bf slot\-State\-Changed} (const {\bf QString} \&newstate)
\item 
void {\bf slot\-State\-Changed} (const {\bf QString} \&newstate, KXMLGUIClient::Reverse\-State\-Change)
\item 
void {\bf set\-Settings\-Dirty} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KMain\-Window} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0, WFlags f=WType\_\-Top\-Level$|$WDestructive\-Close)
\item 
{\bf KMain\-Window} (int cflags, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0, WFlags f=WType\_\-Top\-Level$|$WDestructive\-Close)
\item 
virtual {\bf $\sim$KMain\-Window} ()
\item 
{\bf KPopup\-Menu} $\ast$ {\bf help\-Menu} (const {\bf QString} \&about\-App\-Text=QString::null, bool show\-Whats\-This=true)
\item 
{\bf KPopup\-Menu} $\ast$ {\bf custom\-Help\-Menu} (bool show\-Whats\-This=true)
\item 
virtual void {\bf show} ()
\item 
virtual void {\bf hide} ()
\item 
bool {\bf restore} (int number, bool show=true)
\item 
virtual {\bf KXMLGUIFactory} $\ast$ {\bf gui\-Factory} ()\label{classKMainWindow_a8}

\item 
void {\bf create\-GUI} (const {\bf QString} \&xmlfile=QString::null, bool \_\-conserve\-Memory=true)
\item 
void {\bf set\-Help\-Menu\-Enabled} (bool show\-Help\-Menu=true)
\item 
bool {\bf is\-Help\-Menu\-Enabled} ()
\item 
bool {\bf has\-Menu\-Bar} ()
\item 
{\bf KMenu\-Bar} $\ast$ {\bf menu\-Bar} ()
\item 
{\bf KStatus\-Bar} $\ast$ {\bf status\-Bar} ()
\item 
{\bf KTool\-Bar} $\ast$ {\bf tool\-Bar} (const char $\ast$name=0)
\item 
{\bf QPtr\-List\-Iterator}$<$ {\bf KTool\-Bar} $>$ {\bf tool\-Bar\-Iterator} ()
\item 
{\bf KAccel} $\ast$ {\bf accel} ()
\item 
void {\bf set\-Frame\-Border\-Width} (int)\label{classKMainWindow_a18}

\item 
void {\bf set\-Auto\-Save\-Settings} (const {\bf QString} \&group\-Name={\bf QString::from\-Latin1}(\char`\"{}Main\-Window\char`\"{}), bool save\-Window\-Size=true)
\item 
void {\bf reset\-Auto\-Save\-Settings} ()
\item 
bool {\bf auto\-Save\-Settings} () const 
\item 
{\bf QString} {\bf auto\-Save\-Group} () const 
\item 
void {\bf apply\-Main\-Window\-Settings} ({\bf KConfig} $\ast$config, const {\bf QString} \&group\-Name, bool force)
\item 
void {\bf apply\-Main\-Window\-Settings} ({\bf KConfig} $\ast$config, const {\bf QString} \&group\-Name=QString::null)\label{classKMainWindow_a24}

\item 
void {\bf save\-Main\-Window\-Settings} ({\bf KConfig} $\ast$config, const {\bf QString} \&group\-Name=QString::null)
\item 
void {\bf set\-Standard\-Tool\-Bar\-Menu\-Enabled} (bool enable)
\item 
bool {\bf is\-Standard\-Tool\-Bar\-Menu\-Enabled} () const 
\item 
void {\bf create\-Standard\-Status\-Bar\-Action} ()
\item 
void {\bf setup\-GUI} (int options=Tool\-Bar$|$Keys$|$Status\-Bar$|$Save$|$Create, const {\bf QString} \&xmlfile=QString::null)
\item 
{\bf KAction} $\ast$ {\bf tool\-Bar\-Menu\-Action} ()
\item 
void {\bf setup\-Toolbar\-Menu\-Actions} ()\label{classKMainWindow_a31}

\item 
virtual void {\bf finalize\-GUI} ({\bf KXMLGUIClient} $\ast$client)
\item 
void {\bf finalize\-GUI} (bool force)\label{classKMainWindow_a33}

\item 
bool {\bf initial\-Geometry\-Set} () const 
\item 
void {\bf ignore\-Initial\-Geometry} ()\label{classKMainWindow_a35}

\item 
{\bf QSize} {\bf size\-For\-Central\-Widget\-Size} ({\bf QSize} size) KDE\_\-DEPRECATED
\item 
virtual void {\bf set\-Icon} (const {\bf QPixmap} \&)\label{classKMainWindow_a37}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static bool {\bf can\-Be\-Restored} (int number)
\item 
static const {\bf QString} {\bf class\-Name\-Of\-Toplevel} (int number)
\item 
static {\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ {\bf get\-Member\-List} ()
\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
static {\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ {\bf member\-List} = 0L
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf save\-New\-Toolbar\-Config} ()
\item 
virtual void {\bf show\-About\-Application} ()
\item 
void {\bf save\-Auto\-Save\-Settings} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf paint\-Event} ({\bf QPaint\-Event} $\ast$e)\label{classKMainWindow_b0}

\item 
void {\bf child\-Event} ({\bf QChild\-Event} $\ast$e)\label{classKMainWindow_b1}

\item 
void {\bf resize\-Event} ({\bf QResize\-Event} $\ast$e)\label{classKMainWindow_b2}

\item 
virtual void {\bf close\-Event} ({\bf QClose\-Event} $\ast$)
\item 
virtual bool {\bf query\-Exit} ()
\item 
virtual bool {\bf query\-Close} ()
\item 
virtual void {\bf save\-Properties} ({\bf KConfig} $\ast$)
\item 
virtual void {\bf read\-Properties} ({\bf KConfig} $\ast$)
\item 
virtual void {\bf save\-Global\-Properties} ({\bf KConfig} $\ast$session\-Config)
\item 
virtual void {\bf read\-Global\-Properties} ({\bf KConfig} $\ast$session\-Config)
\item 
void {\bf save\-Properties\-Internal} ({\bf KConfig} $\ast$, int)\label{classKMainWindow_b10}

\item 
bool {\bf read\-Properties\-Internal} ({\bf KConfig} $\ast$, int)\label{classKMainWindow_b11}

\item 
bool {\bf settings\-Dirty} () const 
\item 
{\bf QString} {\bf settings\-Group} () const 
\item 
void {\bf save\-Window\-Size} ({\bf KConfig} $\ast$config) const 
\item 
void {\bf restore\-Window\-Size} ({\bf KConfig} $\ast$config)
\item 
void {\bf parse\-Geometry} (bool parsewidth)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKMainWindow_b17}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KMWSession\-Managed}\label{classKMainWindow_n0}

\end{CompactItemize}


\subsection{Detailed Description}
KDE top level main window 

Top level widget that provides toolbars, a status line and a frame.

It should be used as a top level (parent-less) widget. It manages the geometry for all its children, including your main widget.

Normally, you will inherit from KMain\-Window, then construct (or use some existing) widget as your main view. You can set only one main view.

You can add as many toolbars as you like. There can be only one menubar and only one statusbar.

The toolbars, menubar, and statusbar can be created by the KMain\-Window and - unlike the old KMain\-Window - may, but do not have to, be deleted by you. KMain\-Window will handle that internally.

Height and width can be operated independently from each other. Simply define the minimum/maximum height/width of your main widget and KMain\-Window will take this into account. For fixed size windows set your main widget to a fixed size.

Fixed aspect ratios (height\-For\-Width()) and fixed width widgets are not supported.

KMain\-Window will set icon, mini icon and caption, which it gets from {\bf KApplication}. It provides full session management, and will save its position, geometry and positions of toolbars and menubar on logout. If you want to save additional data, reimplement {\bf save\-Properties()}{\rm (p.\,\pageref{classKMainWindow_b6})} and (to read them again on next login) {\bf read\-Properties()}{\rm (p.\,\pageref{classKMainWindow_b7})}. To save special data about your data, reimplement {\bf save\-Global\-Properties()}{\rm (p.\,\pageref{classKMainWindow_b8})}. To warn user that application or windows have unsaved data on close or logout, reimplement {\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} and/or {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})}.

There are also k\-Restore\-Main\-Windows convenience functions which can restore all your windows on next login.

Note that a KMain\-Window per-default is created with the WDestructive\-Close flag, i.e. it is automatically destroyed when the window is closed. If you do not want this behavior, specify 0 as widget flag in the constructor.

\begin{Desc}
\item[See also:]{\bf KApplication} \end{Desc}
\begin{Desc}
\item[Author:]Reginald Stadlbauer ({\tt reggie@kde.org}) Stephan Kulow ({\tt coolo@kde.org}), Matthias Ettrich ({\tt ettrich@kde.org}), Chris Schlaeger ({\tt cs@kde.org}), Sven Radej ({\tt radej@kde.org}). Maintained by Sven Radej ({\tt radej@kde.org}) \end{Desc}




Definition at line 98 of file kmainwindow.h.

\subsection{Member Enumeration Documentation}
\index{KMainWindow@{KMain\-Window}!CreationFlags@{CreationFlags}}
\index{CreationFlags@{CreationFlags}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KMain\-Window::Creation\-Flags}}\label{classKMainWindow_w6}


Flags that can be passed in an argument to the constructor to change the behavior. 

No\-DCOPObject tells KMain\-Window not to create a {\bf KMain\-Window\-Interface}{\rm (p.\,\pageref{classKMainWindowInterface})}. This can be useful in particular for inherited classes, which might want to create more specific dcop interfaces. It's a good idea to use {\bf KMain\-Window\-Interface}{\rm (p.\,\pageref{classKMainWindowInterface})} as the base class for such interfaces though (to provide the standard mainwindow functionality via {\bf DCOP}). 

Definition at line 148 of file kmainwindow.h.\index{KMainWindow@{KMain\-Window}!StandardWindowOptions@{StandardWindowOptions}}
\index{StandardWindowOptions@{StandardWindowOptions}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KMain\-Window::Standard\-Window\-Options}}\label{classKMainWindow_w7}


\begin{Desc}
\item[See also:]{\bf setup\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a29})} \end{Desc}
\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{ToolBar@{ToolBar}!KMainWindow@{KMainWindow}}\index{KMainWindow@{KMainWindow}!ToolBar@{ToolBar}}\item[{\em 
Tool\-Bar\label{classKMainWindow_w7w1}
}]adds action to show/hide the toolbar(s) and adds action to configure the toolbar(s). 

\begin{Desc}
\item[See also:]{\bf set\-Standard\-Tool\-Bar\-Menu\-Enabled}{\rm (p.\,\pageref{classKMainWindow_a26})} \end{Desc}
\index{Keys@{Keys}!KMainWindow@{KMainWindow}}\index{KMainWindow@{KMainWindow}!Keys@{Keys}}\item[{\em 
Keys\label{classKMainWindow_w7w2}
}]adds action to show the key configure action. \index{StatusBar@{StatusBar}!KMainWindow@{KMainWindow}}\index{KMainWindow@{KMainWindow}!StatusBar@{StatusBar}}\item[{\em 
Status\-Bar\label{classKMainWindow_w7w3}
}]adds action to show/hide the statusbar if the statusbar exists. 

\begin{Desc}
\item[See also:]{\bf create\-Standard\-Status\-Bar\-Action}{\rm (p.\,\pageref{classKMainWindow_a28})} \end{Desc}
\index{Save@{Save}!KMainWindow@{KMainWindow}}\index{KMainWindow@{KMainWindow}!Save@{Save}}\item[{\em 
Save\label{classKMainWindow_w7w4}
}]auto-saves (and loads) the toolbar/menubar/statusbar settings and window size using the default name. 

\begin{Desc}
\item[See also:]{\bf set\-Auto\-Save\-Settings}{\rm (p.\,\pageref{classKMainWindow_a19})}\end{Desc}
Typically you want to let the default window size be determined by the widgets size hints. Make sure that {\bf setup\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a29})} is called after all the widgets are created ( including set\-Central\-Widget ) so the default size's will be correct. \begin{Desc}
\item[See also:]{\bf set\-Auto\-Save\-Settings}{\rm (p.\,\pageref{classKMainWindow_a19})} for more information on this topic. \end{Desc}
\index{Create@{Create}!KMainWindow@{KMainWindow}}\index{KMainWindow@{KMainWindow}!Create@{Create}}\item[{\em 
Create\label{classKMainWindow_w7w5}
}]calls {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})} once Tool\-Bar, Keys and Statusbar have been taken care of. 

\begin{Desc}
\item[See also:]{\bf create\-GUI}{\rm (p.\,\pageref{classKMainWindow_a9})} \end{Desc}
\end{description}
\end{Desc}



Definition at line 546 of file kmainwindow.h.

\subsection{Constructor \& Destructor Documentation}
\index{KMainWindow@{KMain\-Window}!KMainWindow@{KMainWindow}}
\index{KMainWindow@{KMainWindow}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMain\-Window::KMain\-Window ({\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0}, WFlags {\em f} = {\tt WType\_\-TopLevel$|$WDestructiveClose})}\label{classKMainWindow_a0}


Construct a main window. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]The widget parent. This is usually 0 but it may also be the window group leader. In that case, the KMain\-Window becomes sort of a secondary window.\item[{\em name}]The object name. For session management and window management to work properly, all main windows in the application should have a different name. When passing 0 (the default), KMain\-Window 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 KMain\-Window will append 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. \char`\"{}mainwindow\char`\"{} and for the composer windows \char`\"{}composer\#\char`\"{}.\item[{\em f}]Specify the widget flags. The default is WType\_\-Top\-Level and WDestructive\-Close. Top\-Level indicates that a main window is a toplevel window, regardless of whether it has a parent or not. Destructive\-Close indicates that a main window is automatically destroyed when its window is closed. Pass 0 if you do not want this behavior.\end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\tt http://doc.trolltech.com/3.2/qt.html\#Widget\-Flags-enum}\end{Desc}
KMain\-Windows must be created on the heap with 'new', like: 

\footnotesize\begin{verbatim} KMainWindow *kmw = new KMainWindow (...);
\end{verbatim}
\normalsize
 

Definition at line 167 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!KMainWindow@{KMainWindow}}
\index{KMainWindow@{KMainWindow}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMain\-Window::KMain\-Window (int {\em cflags}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0}, WFlags {\em f} = {\tt WType\_\-TopLevel$|$WDestructiveClose})}\label{classKMainWindow_a1}


Overloaded constructor which allows passing some {\bf KMain\-Window::Creation\-Flags}{\rm (p.\,\pageref{classKMainWindow_w6})}. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 173 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!~KMainWindow@{$\sim$KMainWindow}}
\index{~KMainWindow@{$\sim$KMainWindow}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMain\-Window::$\sim${\bf KMain\-Window} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a2}


Destructor. 

Will also destroy the toolbars, and menubar if needed. 

Definition at line 314 of file kmainwindow.cpp.

References member\-List, and QPtr\-List::remove().

\subsection{Member Function Documentation}
\index{KMainWindow@{KMain\-Window}!helpMenu@{helpMenu}}
\index{helpMenu@{helpMenu}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KMain\-Window::help\-Menu (const {\bf QString} \& {\em about\-App\-Text} = {\tt QString::null}, bool {\em show\-Whats\-This} = {\tt true})}\label{classKMainWindow_a3}


Retrieve the standard help menu. 

It contains entires for the help system (activated by F1), an optional \char`\"{}What's This?\char`\"{} entry (activated by Shift F1), an application specific dialog box, and an \char`\"{}About KDE\char`\"{} dialog box.

Example (adding a standard help menu to your application): 

\footnotesize\begin{verbatim} KPopupMenu *help = helpMenu( <myTextString> );
 menuBar()->insertItem( i18n("&Help"), help );
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em about\-App\-Text}]The string that is used in the application specific dialog box. If you leave this string empty the information in the global {\bf KAbout\-Data} of the application will be used to make a standard dialog box.\item[{\em show\-Whats\-This}]Set this to false if you do not want to include the \char`\"{}What's This\char`\"{} menu entry.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A standard help menu. \end{Desc}


Definition at line 324 of file kmainwindow.cpp.

References KXMLGUIClient::instance(), KHelp\-Menu::menu(), and show\-About\-Application().\index{KMainWindow@{KMain\-Window}!customHelpMenu@{customHelpMenu}}
\index{customHelpMenu@{customHelpMenu}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KMain\-Window::custom\-Help\-Menu (bool {\em show\-Whats\-This} = {\tt true})}\label{classKMainWindow_a4}


Returns the help menu. 

Creates a standard help menu if none exists yet.

It contains entries for the help system (activated by F1), an optional \char`\"{}What's This?\char`\"{} entry (activated by Shift F1), an application specific dialog box, and an \char`\"{}About KDE\char`\"{} dialog box. You must create the application specific dialog box yourself. When the \char`\"{}About application\char`\"{} menu entry is activated, a signal will trigger the show\-About\-Application slot. See show\-About\-Application for more information.

Example (adding a help menu to your application): 

\footnotesize\begin{verbatim} menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em show\-Whats\-This}]Set this to {\tt false} if you do not want to include the \char`\"{}What's This\char`\"{} menu entry.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A standard help menu. \end{Desc}


Definition at line 341 of file kmainwindow.cpp.

References KHelp\-Menu::menu(), and show\-About\-Application().\index{KMainWindow@{KMain\-Window}!canBeRestored@{canBeRestored}}
\index{canBeRestored@{canBeRestored}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::can\-Be\-Restored (int {\em number})\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_e0}


{\bf Session Management} 

Try to restore the toplevel widget as defined by the number (1..X).

If the session did not contain so high a number, the configuration is not changed and {\tt false} returned.

That means clients could simply do the following: 

\footnotesize\begin{verbatim} if (kapp->isRestored()){
   int n = 1;
   while (KMainWindow::canBeRestored(n)){
     (new childMW)->restore(n);
     n++;
   }
 } else {
   // create default application as usual
 }
\end{verbatim}
\normalsize
 Note that {\bf QWidget::show()} is called implicitly in restore.

With this you can easily restore all toplevel windows of your application.

If your application uses different kinds of toplevel windows, then you can use KMain\-Window::class\-Name\-Of\-Toplevel(n) to determine the exact type before calling the child\-MW constructor in the example from above.

If your client has only one kind of toplevel widgets (which should be pretty usual) then you should use the RESTORE-macro for backwards compatibility with 3.1 and 3.0 branches:



\footnotesize\begin{verbatim} if (kapp->isRestored())
   RESTORE(childMW)
 else {
   // create default application as usual
 }
\end{verbatim}
\normalsize


The macro expands to the term above but is easier to use and less code to write.

For new code or if you have more than one kind of toplevel widget (each derived from KMain\-Window, of course), you can use the templated k\-Restore\-Main\-Windows global functions:



\footnotesize\begin{verbatim} if (kapp->isRestored())
   kRestoreMainWindows< childMW1, childMW2, childMW3 >();
 else {
   // create default application as usual
 }
\end{verbatim}
\normalsize


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 k\-Restore\-Main\-Windows, a define KDE\_\-RESTORE\_\-MAIN\_\-WINDOWS\_\-NUM\_\-TEMPLATE\_\-ARGS is provided.

\begin{Desc}
\item[See also:]{\bf restore()}{\rm (p.\,\pageref{classKMainWindow_a7})} 

{\bf class\-Name\-Of\-Toplevel()}{\rm (p.\,\pageref{classKMainWindow_e1})} \end{Desc}


Definition at line 352 of file kmainwindow.cpp.

References KConfig\-Base::read\-Num\-Entry(), and KConfig\-Base::set\-Group().

Referenced by restore().\index{KMainWindow@{KMain\-Window}!classNameOfToplevel@{classNameOfToplevel}}
\index{classNameOfToplevel@{classNameOfToplevel}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString} KMain\-Window::class\-Name\-Of\-Toplevel (int {\em number})\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_e1}


Returns the class\-Name() of the {\tt number} of the toplevel window which should be restored. 

This is only useful if your application uses different kinds of toplevel windows. 

Definition at line 364 of file kmainwindow.cpp.

References KConfig\-Base::has\-Key(), QString::prepend(), KConfig\-Base::read\-Entry(), KConfig\-Base::set\-Group(), and QString::set\-Num().\index{KMainWindow@{KMain\-Window}!show@{show}}
\index{show@{show}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::show ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a5}


Reimplementation of QMain\-Window::show(). 



Definition at line 381 of file kmainwindow.cpp.

Referenced by restore().\index{KMainWindow@{KMain\-Window}!hide@{hide}}
\index{hide@{hide}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::hide ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a6}


Reimplementation of QMain\-Window::hide(). 



Definition at line 391 of file kmainwindow.cpp.

References QString::append(), and QWidget::hide().\index{KMainWindow@{KMain\-Window}!restore@{restore}}
\index{restore@{restore}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::restore (int {\em number}, bool {\em show} = {\tt true})}\label{classKMainWindow_a7}


Restore the session specified by {\tt number}. 

Returns {\tt false} if this fails, otherwise returns {\tt true} and shows the window. You should call {\bf can\-Be\-Restored()}{\rm (p.\,\pageref{classKMainWindow_e0})} first. If {\tt show} is true (default), this widget will be shown automatically. 

Definition at line 411 of file kmainwindow.cpp.

References can\-Be\-Restored(), and show().\index{KMainWindow@{KMain\-Window}!createGUI@{createGUI}}
\index{createGUI@{createGUI}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::create\-GUI (const {\bf QString} \& {\em xmlfile} = {\tt QString::null}, bool {\em \_\-conserve\-Memory} = {\tt true})}\label{classKMainWindow_a9}


Create a GUI given a local XML file. 

If {\tt xmlfile} is NULL, then it will try to construct a local XML filename like appnameui.rc 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.

Note that when passing true for the conserve\-Memory argument subsequent calls to gui\-Factory()-$>$add\-Client/remove\-Client may not work as expected. Also retrieving references to containers like popup menus or toolbars using the container method will not work.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em xmlfile}]The local xmlfile (relative or absolute) \item[{\em \_\-conserve\-Memory}]Specify whether {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})} should call KXMLGui\-Client::conserve\-Memory() to free all memory allocated by the {\bf QDom\-Document} and by the {\bf KXMLGUIFactory}{\rm (p.\,\pageref{classKXMLGUIFactory})}. \end{description}
\end{Desc}


Definition at line 477 of file kmainwindow.cpp.

References KXMLGUIClient::action\-Collection(), KXMLGUIFactory::add\-Client(), QDom\-Element::attribute(), QPtr\-List::clear(), QMenu\-Bar::clear(), KXMLGUIClient::conserve\-Memory(), QDom\-Document::document\-Element(), KXMLGUIClient::dom\-Document(), KXMLGUIClient::instance(), QDom\-Node::is\-Null(), locate(), QDom\-Node::next\-Sibling(), KXMLGUIFactory::remove\-Client(), KXMLGUIFactory::reset\-Container(), QPtr\-List::set\-Auto\-Delete(), KXMLGUIClient::set\-XMLFile(), QDom\-Element::tag\-Name(), QDom\-Node::to\-Element(), and tool\-Bar\-Iterator().

Referenced by save\-New\-Toolbar\-Config(), and setup\-GUI().\index{KMainWindow@{KMain\-Window}!setHelpMenuEnabled@{setHelpMenuEnabled}}
\index{setHelpMenuEnabled@{setHelpMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Help\-Menu\-Enabled (bool {\em show\-Help\-Menu} = {\tt true})}\label{classKMainWindow_a10}


Enables the build of a standard help menu when calling {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})}. 

The default behavior is to build one, you must call this function to disable it 

Definition at line 557 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!isHelpMenuEnabled@{isHelpMenuEnabled}}
\index{isHelpMenuEnabled@{isHelpMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::is\-Help\-Menu\-Enabled ()}\label{classKMainWindow_a11}


Return {\tt true} when the help menu is enabled. 



Definition at line 562 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!hasMenuBar@{hasMenuBar}}
\index{hasMenuBar@{hasMenuBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::has\-Menu\-Bar ()}\label{classKMainWindow_a12}


Returns true, if there is a menubar \begin{Desc}
\item[Since:]3.1. \end{Desc}




Definition at line 1052 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!menuBar@{menuBar}}
\index{menuBar@{menuBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMenu\-Bar} $\ast$ KMain\-Window::menu\-Bar ()}\label{classKMainWindow_a13}


Returns a pointer to the menu bar. 

If there is no menu bar yet one will be created. 

Definition at line 1057 of file kmainwindow.cpp.

References QMain\-Window::menu\-Bar().\index{KMainWindow@{KMain\-Window}!statusBar@{statusBar}}
\index{statusBar@{statusBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KStatus\-Bar} $\ast$ KMain\-Window::status\-Bar ()}\label{classKMainWindow_a14}


Returns a pointer to the status bar. 

If there is no status bar yet, one will be created.

Note that tooltips for kactions in {\bf action\-Collection()}{\rm (p.\,\pageref{classKXMLGUIClient_a5})} are not automatically connected to this status\-Bar. See the {\bf KAction\-Collection}{\rm (p.\,\pageref{classKActionCollection})} documentation for more details.

\begin{Desc}
\item[See also:]{\bf KAction\-Collection}{\rm (p.\,\pageref{classKActionCollection})} \end{Desc}


Definition at line 1069 of file kmainwindow.cpp.

References QMain\-Window::status\-Bar().

Referenced by KXMLGUIBuilder::create\-Container(), and create\-Standard\-Status\-Bar\-Action().\index{KMainWindow@{KMain\-Window}!getMemberList@{getMemberList}}
\index{getMemberList@{getMemberList}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ KMain\-Window::get\-Member\-List ()\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_e2}


List of members of KMain\-Window class. 

\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 1221 of file kmainwindow.cpp.

References member\-List.\index{KMainWindow@{KMain\-Window}!toolBar@{toolBar}}
\index{toolBar@{toolBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KTool\-Bar} $\ast$ KMain\-Window::tool\-Bar (const char $\ast$ {\em name} = {\tt 0})}\label{classKMainWindow_a15}


Returns a pointer to the toolbar with the specified name. 

This refers to toolbars created dynamically from the XML UI framework. If the toolbar does not exist one will be created.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]The internal name of the toolbar. If no name is specified \char`\"{}main\-Tool\-Bar\char`\"{} is assumed.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the toolbar \end{Desc}


Definition at line 1127 of file kmainwindow.cpp.

Referenced by KToggle\-Tool\-Bar\-Action::plug(), and size\-For\-Central\-Widget\-Size().\index{KMainWindow@{KMain\-Window}!toolBarIterator@{toolBarIterator}}
\index{toolBarIterator@{toolBarIterator}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List\-Iterator}$<$ {\bf KTool\-Bar} $>$ KMain\-Window::tool\-Bar\-Iterator ()}\label{classKMainWindow_a16}


\begin{Desc}
\item[Returns:]An iterator over the list of all toolbars for this window. \end{Desc}


Definition at line 1142 of file kmainwindow.cpp.

References QPtr\-List::append(), QPtr\-List::clear(), QPtr\-List::first(), QPtr\-List::next(), and QMain\-Window::tool\-Bars().

Referenced by apply\-Main\-Window\-Settings(), create\-GUI(), and save\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!accel@{accel}}
\index{accel@{accel}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KAccel} $\ast$ KMain\-Window::accel ()}\label{classKMainWindow_a17}


\begin{Desc}
\item[Returns:]A {\bf KAccel} instance bound to this mainwindow. Used automatically by {\bf KAction}{\rm (p.\,\pageref{classKAction})} to make keybindings work in all cases. \end{Desc}


Definition at line 1157 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!setAutoSaveSettings@{setAutoSaveSettings}}
\index{setAutoSaveSettings@{setAutoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Auto\-Save\-Settings (const {\bf QString} \& {\em group\-Name} = {\tt {\bf QString::from\-Latin1}(\char`\"{}MainWindow\char`\"{})}, bool {\em save\-Window\-Size} = {\tt true})}\label{classKMainWindow_a19}


Call this to enable \char`\"{}auto-save\char`\"{} of toolbar/menubar/statusbar settings (and optionally window size). 

If the $\ast$bars were moved around/shown/hidden when the window is closed, save\-Main\-Window\-Settings( {\bf KGlobal::config()}, group\-Name ) will be called.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em group\-Name}]a name that identifies this \char`\"{}type of window\char`\"{}. You can have several types of window in the same application.\item[{\em save\-Window\-Size}]set it to true to include the window size when saving.\end{description}
\end{Desc}
Typically, you will call {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a19})} in your KMain\-Window-inherited class constructor, and it will take care of restoring and saving automatically. Make sure you call this \_\-after all\_\- your $\ast$bars have been created.

To make sure that KMain\-Window propertly obtains the default size of the window you should do the following:\begin{itemize}
\item Remove hard coded resize() calls in the constructor or main, they should be removed in favor of letting the automatic resizing determine the default window size. Hard coded window sizes will be wrong for users that have big fonts, use different styles, long/small translations, large toolbars, and other factors.\item Put the set\-Auto\-Save\-Settings ( or {\bf setup\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a29})} ) call after all widgets have been created and placed inside the main window (i.e. for 99\% of apps {\bf set\-Central\-Widget()})\item Widgets that inherit from {\bf QWidget} (like game boards) should overload \char`\"{}virtual QSize size\-Hint() const;\char`\"{} to specify a default size rather than letting QWidget::adjust use the default size of 0x0. \end{itemize}


Definition at line 1003 of file kmainwindow.cpp.

References apply\-Main\-Window\-Settings(), QMain\-Window::dock\-Window\-Position\-Changed(), and set\-Settings\-Dirty().

Referenced by setup\-GUI().\index{KMainWindow@{KMain\-Window}!resetAutoSaveSettings@{resetAutoSaveSettings}}
\index{resetAutoSaveSettings@{resetAutoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::reset\-Auto\-Save\-Settings ()}\label{classKMainWindow_a20}


Disable the auto-save-settings feature. 

You don't normally need to call this, ever. 

Definition at line 1018 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!autoSaveSettings@{autoSaveSettings}}
\index{autoSaveSettings@{autoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::auto\-Save\-Settings () const}\label{classKMainWindow_a21}


\begin{Desc}
\item[Returns:]the current autosave setting, i.e. true if {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a19})} was called, false by default or if {\bf reset\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a20})} was called. \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 1025 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!autoSaveGroup@{autoSaveGroup}}
\index{autoSaveGroup@{autoSaveGroup}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMain\-Window::auto\-Save\-Group () const}\label{classKMainWindow_a22}


\begin{Desc}
\item[Returns:]the group used for setting-autosaving. Only meaningful if {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a19})} was called. This can be useful for forcing a save or an apply, e.g. before and after using {\bf KEdit\-Toolbar}{\rm (p.\,\pageref{classKEditToolbar})}. \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 1030 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!applyMainWindowSettings@{applyMainWindowSettings}}
\index{applyMainWindowSettings@{applyMainWindowSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::apply\-Main\-Window\-Settings ({\bf KConfig} $\ast$ {\em config}, const {\bf QString} \& {\em group\-Name}, bool {\em force})}\label{classKMainWindow_a23}


Read settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]Config file to read the settings from. \item[{\em group\-Name}]Group name to use. If not specified, the last used group name is used. \item[{\em force}]if set, even default settings are re-applied \end{description}
\end{Desc}


Definition at line 820 of file kmainwindow.cpp.

References KTool\-Bar::apply\-Settings(), QPtr\-List\-Iterator::current(), endl(), finalize\-GUI(), QMenu\-Bar::hide(), kd\-Debug(), QString::number(), QString::prepend(), restore\-Window\-Size(), QMenu\-Bar::show(), and tool\-Bar\-Iterator().

Referenced by save\-New\-Toolbar\-Config(), and set\-Auto\-Save\-Settings().\index{KMainWindow@{KMain\-Window}!saveMainWindowSettings@{saveMainWindowSettings}}
\index{saveMainWindowSettings@{saveMainWindowSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Main\-Window\-Settings ({\bf KConfig} $\ast$ {\em config}, const {\bf QString} \& {\em group\-Name} = {\tt QString::null})}\label{classKMainWindow_a25}


Save settings for statusbar, menubar and toolbar to their respective groups in the config file {\tt config}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]Config file to save the settings to. \item[{\em group\-Name}]Group name to use. If not specified, the last used group name is used \end{description}
\end{Desc}


Definition at line 702 of file kmainwindow.cpp.

References QPtr\-List\-Iterator::current(), endl(), QString::from\-Latin1(), kd\-Debug(), QString::number(), QString::prepend(), KTool\-Bar::save\-Settings(), save\-Window\-Size(), and tool\-Bar\-Iterator().

Referenced by configure\-Toolbars(), and save\-Auto\-Save\-Settings().\index{KMainWindow@{KMain\-Window}!setStandardToolBarMenuEnabled@{setStandardToolBarMenuEnabled}}
\index{setStandardToolBarMenuEnabled@{setStandardToolBarMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Standard\-Tool\-Bar\-Menu\-Enabled (bool {\em enable})}\label{classKMainWindow_a26}


Sets whether KMain\-Window should provide a menu that allows showing/hiding the available toolbars ( using {\bf KToggle\-Tool\-Bar\-Action}{\rm (p.\,\pageref{classKToggleToolBarAction})} ) . 

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=\char`\"{}Standard\-Tool\-Bar\-Menu\-Handler\char`\"{} /$>$ line to the settings menu section of your resource file ( usually appname.rc ).

Note that you should enable this feature before calling {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})} ( or similar ) . You enable/disable it anytime if you pass false to the conserve\-Memory argument of create\-GUI. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 755 of file kmainwindow.cpp.

References KXMLGUIFactory::add\-Client(), KXMLGUIClient::factory(), and KXMLGUIFactory::remove\-Client().

Referenced by setup\-GUI().\index{KMainWindow@{KMain\-Window}!isStandardToolBarMenuEnabled@{isStandardToolBarMenuEnabled}}
\index{isStandardToolBarMenuEnabled@{isStandardToolBarMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::is\-Standard\-Tool\-Bar\-Menu\-Enabled () const}\label{classKMainWindow_a27}


\begin{Desc}
\item[Since:]3.1 \end{Desc}




Definition at line 777 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!createStandardStatusBarAction@{createStandardStatusBarAction}}
\index{createStandardStatusBarAction@{createStandardStatusBarAction}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::create\-Standard\-Status\-Bar\-Action ()}\label{classKMainWindow_a28}


Sets whether KMain\-Window should provide a menu that allows showing/hiding of the statusbar ( using KToggle\-Status\-Bar\-Action ). 

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 {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})} ( 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 KMain\-Window know when that status (hidden/shown) of the statusbar has changed. For example: connect(action, SIGNAL(activated()), kmainwindow, SLOT({\bf set\-Settings\-Dirty()}{\rm (p.\,\pageref{classKMainWindow_i7})})); Otherwise the status (hidden/show) of the statusbar might not be saved by KMain\-Window. \begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 782 of file kmainwindow.cpp.

References KXMLGUIClient::action\-Collection(), set\-Settings\-Dirty(), KStd\-Action::show\-Statusbar(), and status\-Bar().

Referenced by setup\-GUI().\index{KMainWindow@{KMain\-Window}!setupGUI@{setupGUI}}
\index{setupGUI@{setupGUI}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::setup\-GUI (int {\em options} = {\tt ToolBar$|$Keys$|$StatusBar$|$Save$|$Create}, const {\bf QString} \& {\em xmlfile} = {\tt QString::null})}\label{classKMainWindow_a29}


Configures the current windows and its actions in the typical {\bf 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 {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a9})}.

\begin{Desc}
\item[See also:]{\bf Standard\-Window\-Options}{\rm (p.\,\pageref{classKMainWindow_w7})}\end{Desc}
\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 445 of file kmainwindow.cpp.

References KXMLGUIClient::action\-Collection(), configure\-Toolbars(), KStd\-Action::configure\-Toolbars(), Create, create\-GUI(), create\-Standard\-Status\-Bar\-Action(), KStd\-Action::key\-Bindings(), Keys, Save, set\-Auto\-Save\-Settings(), set\-Standard\-Tool\-Bar\-Menu\-Enabled(), Status\-Bar, and Tool\-Bar.\index{KMainWindow@{KMain\-Window}!toolBarMenuAction@{toolBarMenuAction}}
\index{toolBarMenuAction@{toolBarMenuAction}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KAction} $\ast$ KMain\-Window::tool\-Bar\-Menu\-Action ()}\label{classKMainWindow_a30}


Returns a pointer to the mainwindows action responsible for the toolbars menu \begin{Desc}
\item[Since:]3.1. \end{Desc}




Definition at line 264 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!finalizeGUI@{finalizeGUI}}
\index{finalizeGUI@{finalizeGUI}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::finalize\-GUI ({\bf KXMLGUIClient} $\ast$ {\em client})\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a32}


\begin{Desc}
\item[Since:]3.1 \end{Desc}




Reimplemented from {\bf KXMLGUIBuilder} {\rm (p.\,\pageref{classKXMLGUIBuilder})}.

Definition at line 1225 of file kmainwindow.cpp.

Referenced by apply\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!initialGeometrySet@{initialGeometrySet}}
\index{initialGeometrySet@{initialGeometrySet}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::initial\-Geometry\-Set () const}\label{classKMainWindow_a34}


\begin{Desc}
\item[Returns:]true if a -geometry argument was given on the command line, and this is the first window created (the one on which this option applies) \end{Desc}


Definition at line 966 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!sizeForCentralWidgetSize@{sizeForCentralWidgetSize}}
\index{sizeForCentralWidgetSize@{sizeForCentralWidgetSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSize} KMain\-Window::size\-For\-Central\-Widget\-Size ({\bf QSize} {\em size})}\label{classKMainWindow_a36}


\begin{Desc}
\item[Returns:]the size the mainwindow should have so that the central widget will be of {\tt size}.\end{Desc}


\begin{Desc}
\item[{\bf Deprecated}]You normally don't need this, the recommended way to achieve a certain central widget size is as follows: \begin{itemize}
\item Override size\-Hint() in the central widget so that it returns the desired size. \item Call update\-Geometry() in the central widget whenever the desired size changes. This ensures that the new size\-Hint() is properly propagated to any parent layout. \item Now call adjust\-Size() in the mainwindow to resize the mainwindow such that the central widget will become the desired size. \end{itemize}
\end{Desc}


Definition at line 1169 of file kmainwindow.cpp.

References KTool\-Bar::bar\-Pos, QMain\-Window::dock\-Windows\-Movable(), QSize::height(), QMenu\-Bar::height\-For\-Width(), KTool\-Bar::size\-Hint(), tool\-Bar(), and QSize::width().\index{KMainWindow@{KMain\-Window}!configureToolbars@{configureToolbars}}
\index{configureToolbars@{configureToolbars}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KMain\-Window::configure\-Toolbars ()\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i0}


Show a standard configure toolbar dialog. 

This slot can be connected dirrectly to the action to configure shortcuts. This is very simple to do that by adding a single line 

\footnotesize\begin{verbatim} KStdAction::configureToolbars( guiFactory(), SLOT( configureToolbars() ),
                                actionCollection() );
\end{verbatim}
\normalsize


\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 431 of file kmainwindow.cpp.

References KXMLGUIClient::action\-Collection(), QDialog::exec(), save\-Main\-Window\-Settings(), save\-New\-Toolbar\-Config(), and KXMLGUIClient::xml\-File().

Referenced by setup\-GUI().\index{KMainWindow@{KMain\-Window}!setCaption@{setCaption}}
\index{setCaption@{setCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Caption (const {\bf QString} \& {\em caption})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i1}


Makes a {\bf KDE} compliant caption. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. {\em Do\/} {\em not\/} include the application name in this string. It will be added automatically according to the {\bf KDE} standard. \end{description}
\end{Desc}


Definition at line 567 of file kmainwindow.cpp.

References set\-Plain\-Caption().\index{KMainWindow@{KMain\-Window}!setCaption@{setCaption}}
\index{setCaption@{setCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Caption (const {\bf QString} \& {\em caption}, bool {\em modified})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i2}


Makes a {\bf KDE} compliant caption. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. {\em Do\/} {\em not\/} include the application name in this string. It will be added automatically according to the {\bf KDE} standard. \item[{\em modified}]Specify whether the document is modified. This displays an additional sign in the title bar, usually \char`\"{}$\ast$$\ast$\char`\"{}. \end{description}
\end{Desc}


Definition at line 572 of file kmainwindow.cpp.

References set\-Plain\-Caption().\index{KMainWindow@{KMain\-Window}!setPlainCaption@{setPlainCaption}}
\index{setPlainCaption@{setPlainCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Plain\-Caption (const {\bf QString} \& {\em caption})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i3}


Make a plain caption without any modifications. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. This is the string that will be displayed in the window title. \end{description}
\end{Desc}


Definition at line 577 of file kmainwindow.cpp.

References NETWin\-Info::set\-Name().

Referenced by set\-Caption().\index{KMainWindow@{KMain\-Window}!appHelpActivated@{appHelpActivated}}
\index{appHelpActivated@{appHelpActivated}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::app\-Help\-Activated (void)\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i4}


Open the help page for the application. 

The application name is used as a key to determine what to display and the system will attempt to open $<$app\-Name$>$/index.html.

This method is intended for use by a help button in the toolbar or components outside the regular help menu. Use {\bf help\-Menu()}{\rm (p.\,\pageref{classKMainWindow_a3})} when you want to provide access to the help system from the help menu.

Example (adding a help button to the first toolbar):



\footnotesize\begin{verbatim} KIconLoader &loader = *KGlobal::iconLoader();
 QPixmap pixmap = loader.loadIcon( "help" );
 toolBar(0)->insertButton( pixmap, 0, SIGNAL(clicked()),
   this, SLOT(appHelpActivated()), true, i18n("Help") );
\end{verbatim}
\normalsize
 

Definition at line 586 of file kmainwindow.cpp.

References KHelp\-Menu::app\-Help\-Activated().\index{KMainWindow@{KMain\-Window}!slotStateChanged@{slotStateChanged}}
\index{slotStateChanged@{slotStateChanged}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::slot\-State\-Changed (const {\bf QString} \& {\em newstate})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i5}


Apply a state change. 

Enable and disable actions as defined in the XML rc file \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 596 of file kmainwindow.cpp.

References KXMLGUIClient::state\-Changed().\index{KMainWindow@{KMain\-Window}!slotStateChanged@{slotStateChanged}}
\index{slotStateChanged@{slotStateChanged}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::slot\-State\-Changed (const {\bf QString} \& {\em newstate}, KXMLGUIClient::Reverse\-State\-Change)\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i6}


Apply a state change. 

Enable and disable actions as defined in the XML rc file, can \char`\"{}reverse\char`\"{} the state (disable the actions which should be enabled, and vice-versa) if specified. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 604 of file kmainwindow.cpp.

References KXMLGUIClient::state\-Changed().\index{KMainWindow@{KMain\-Window}!setSettingsDirty@{setSettingsDirty}}
\index{setSettingsDirty@{setSettingsDirty}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Settings\-Dirty ()\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i7}


Tell the main window that it should save its settings when being closed. 

This is part of the auto-save-settings feature. For everything related to toolbars this happens automatically, but you have to call {\bf set\-Settings\-Dirty()}{\rm (p.\,\pageref{classKMainWindow_i7})} in the slot that toggles the visibility of the statusbar. 

Definition at line 976 of file kmainwindow.cpp.

References save\-Auto\-Save\-Settings().

Referenced by create\-Standard\-Status\-Bar\-Action(), and set\-Auto\-Save\-Settings().\index{KMainWindow@{KMain\-Window}!closeEvent@{closeEvent}}
\index{closeEvent@{closeEvent}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::close\-Event ({\bf QClose\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b3}


Reimplemented to call the {\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} and {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} handlers. 

We recommend that you reimplement the handlers rather than {\bf close\-Event()}{\rm (p.\,\pageref{classKMainWindow_b3})}. If you do it anyway, ensure to call the base implementation to keep {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} running. 

Definition at line 620 of file kmainwindow.cpp.

References QPtr\-List\-Iterator::current(), member\-List, query\-Close(), query\-Exit(), save\-Auto\-Save\-Settings(), and QPtr\-List\-Iterator::to\-First().\index{KMainWindow@{KMain\-Window}!queryExit@{queryExit}}
\index{queryExit@{queryExit}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::query\-Exit ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b4}


Called before the very last window is closed, either by the user or indirectly by the session manager. 

It is not recommended to do any user interaction in this function other than indicating severe errors. Better ask the user on {\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} (see below).

A typical usage of {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} is to write configuration data back. Note that the application may continue to run after {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} (the user may have canceled a shutdown), so you should not do any cleanups here. The purpose of {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} is purely to prepare the application (with possible user interaction) so it can safely be closed later (without user interaction).

If you need to do serious things on exit (like shutting a dial-up connection down), connect to the signal {\bf KApplication::shut\-Down()}.

Default implementation returns {\tt true}. Returning {\tt false} will cancel the exiting. In the latter case, the last window will remain visible. If {\bf KApplication::session\-Saving()} is true, refusing the exit will also cancel {\bf KDE} logout.

\begin{Desc}
\item[See also:]{\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} 

{\bf KApplication::session\-Saving()} \end{Desc}


Definition at line 650 of file kmainwindow.cpp.

Referenced by close\-Event().\index{KMainWindow@{KMain\-Window}!queryClose@{queryClose}}
\index{queryClose@{queryClose}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::query\-Close ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b5}


Called before the window is closed, either by the user or indirectly by the session manager. 

The purpose of this function is to prepare the window in a way that it is safe to close it, i.e. without the user losing some data.

Default implementation returns true. Returning {\tt false} will cancel the closing, and, if {\bf KApplication::session\-Saving()} is true, it will also cancel {\bf KDE} logout.

Reimplement this function to prevent the user from losing data. Example: 

\footnotesize\begin{verbatim}       switch ( KMessageBox::warningYesNoCancel( this,
                i18n("Save changes to document foo?")) ) {
       case KMessageBox::Yes :
         // save document here. If saving fails, return false;
         return true;
       case KMessageBox::No :
         return true;
       default: // cancel
         return false;
\end{verbatim}
\normalsize


Note that you should probably {\em not\/} actually close the document from within this method, as it may be called by the session manager before the session is saved. If the document is closed before the session save occurs, its location might not be properly saved. In addition, the session shutdown may be canceled, in which case the document should remain open.

\begin{Desc}
\item[See also:]{\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} 

{\bf KApplication::session\-Saving()} \end{Desc}


Reimplemented in {\bf UIServer}.

Definition at line 655 of file kmainwindow.cpp.

Referenced by close\-Event().\index{KMainWindow@{KMain\-Window}!saveProperties@{saveProperties}}
\index{saveProperties@{saveProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KMain\-Window::save\-Properties ({\bf KConfig} $\ast$)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKMainWindow_b6}


Save your instance-specific properties. 

The function is invoked when the session manager requests your application to save its state.

You {\em must\/} {\em not\/} change the group of the {\tt kconfig} object, since KMain\-Window uses one group for each window. Please reimplement these function in childclasses.

Note: No user interaction is allowed in this function! 

Definition at line 861 of file kmainwindow.h.\index{KMainWindow@{KMain\-Window}!readProperties@{readProperties}}
\index{readProperties@{readProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KMain\-Window::read\-Properties ({\bf KConfig} $\ast$)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKMainWindow_b7}


Read your instance-specific properties. 



Definition at line 866 of file kmainwindow.h.\index{KMainWindow@{KMain\-Window}!saveGlobalProperties@{saveGlobalProperties}}
\index{saveGlobalProperties@{saveGlobalProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Global\-Properties ({\bf KConfig} $\ast$ {\em session\-Config})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b8}


Save your application-wide properties. 

The function is invoked when the session manager requests your application to save its state.

This function is similar to {\bf save\-Properties()}{\rm (p.\,\pageref{classKMainWindow_b6})} but is only called for the very first main window, regardless how many main window are open.

Override it if you need to save other data about your documents on session end. session\-Config is a config to which that data should be saved. Normally, you don't need this function. But if you want to save data about your documents that are not in opened windows you might need it.

Default implementation does nothing. 

Definition at line 660 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!readGlobalProperties@{readGlobalProperties}}
\index{readGlobalProperties@{readGlobalProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::read\-Global\-Properties ({\bf KConfig} $\ast$ {\em session\-Config})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b9}


The counterpart of {\bf save\-Global\-Properties()}{\rm (p.\,\pageref{classKMainWindow_b8})}. 

Read the application-specific properties in again. 

Definition at line 664 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!settingsDirty@{settingsDirty}}
\index{settingsDirty@{settingsDirty}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::settings\-Dirty () const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b12}


For inherited classes. 



Definition at line 993 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!settingsGroup@{settingsGroup}}
\index{settingsGroup@{settingsGroup}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMain\-Window::settings\-Group () const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b13}


For inherited classes. 



Definition at line 998 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!saveWindowSize@{saveWindowSize}}
\index{saveWindowSize@{saveWindowSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Window\-Size ({\bf KConfig} $\ast$ {\em config}) const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b14}


For inherited classes Note that the group must be set before calling. 



Definition at line 888 of file kmainwindow.cpp.

References QApplication::desktop(), QString::from\-Latin1(), QRect::height(), and QRect::width().

Referenced by save\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!restoreWindowSize@{restoreWindowSize}}
\index{restoreWindowSize@{restoreWindowSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::restore\-Window\-Size ({\bf KConfig} $\ast$ {\em config})\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b15}


For inherited classes Note that the group must be set before calling, and that a -geometry on the command line has priority. 



Definition at line 920 of file kmainwindow.cpp.

References QApplication::desktop(), QRect::height(), parse\-Geometry(), and QRect::width().

Referenced by apply\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!parseGeometry@{parseGeometry}}
\index{parseGeometry@{parseGeometry}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::parse\-Geometry (bool {\em parsewidth})\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b16}


parse the geometry from the geometry command line argument 



Definition at line 279 of file kmainwindow.cpp.

References QApplication::desktop(), QSize::height(), and QSize::width().

Referenced by restore\-Window\-Size().\index{KMainWindow@{KMain\-Window}!saveNewToolbarConfig@{saveNewToolbarConfig}}
\index{saveNewToolbarConfig@{saveNewToolbarConfig}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-New\-Toolbar\-Config ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKMainWindow_j0}


Rebuilds the GUI after {\bf KEdit\-Toolbar}{\rm (p.\,\pageref{classKEditToolbar})} changed the toolbar layout. 

\begin{Desc}
\item[See also:]{\bf configure\-Toolbars()}{\rm (p.\,\pageref{classKMainWindow_i0})} \end{Desc}


Definition at line 439 of file kmainwindow.cpp.

References apply\-Main\-Window\-Settings(), create\-GUI(), and KXMLGUIClient::xml\-File().

Referenced by configure\-Toolbars().\index{KMainWindow@{KMain\-Window}!showAboutApplication@{showAboutApplication}}
\index{showAboutApplication@{showAboutApplication}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::show\-About\-Application ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKMainWindow_j1}


This slot does nothing. 

It must be reimplemented if you want to use a custom About Application dialog box. This slot is connected to the About Application entry in the menu returned by custom\-Help\-Menu.

Example: 

\footnotesize\begin{verbatim} void MyMainLevel::setupInterface()
 {
   ..
   menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
   ..
 }

 void MyMainLevel::showAboutApplication()
 {
   <activate your custom dialog>
 }
\end{verbatim}
\normalsize
 

Definition at line 674 of file kmainwindow.cpp.

Referenced by custom\-Help\-Menu(), and help\-Menu().\index{KMainWindow@{KMain\-Window}!saveAutoSaveSettings@{saveAutoSaveSettings}}
\index{saveAutoSaveSettings@{saveAutoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Auto\-Save\-Settings ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKMainWindow_j2}


This slot should only be called in case you reimplement {\bf close\-Event()}{\rm (p.\,\pageref{classKMainWindow_b3})} and if you are using the \char`\"{}auto-save\char`\"{} feature. 

In all other cases, {\bf set\-Settings\-Dirty()}{\rm (p.\,\pageref{classKMainWindow_i7})} should be called instead to benefit from the delayed saving.

\begin{Desc}
\item[See also:]{\bf set\-Auto\-Save\-Settings}{\rm (p.\,\pageref{classKMainWindow_a19})} 

{\bf set\-Settings\-Dirty}{\rm (p.\,\pageref{classKMainWindow_i7})}\end{Desc}
\begin{Desc}
\item[Since:]3.2\end{Desc}
Example: 

\footnotesize\begin{verbatim} void MyMainWindow::closeEvent( QCloseEvent *e )
 {
   // Save settings if auto-save is enabled, and settings have changed
   if ( settingsDirty() && autoSaveSettings() )
     saveAutoSaveSettings();
   ..
 }
\end{verbatim}
\normalsize
 

Definition at line 1035 of file kmainwindow.cpp.

References KGlobal::config(), save\-Main\-Window\-Settings(), and KConfig\-Base::sync().

Referenced by close\-Event(), and set\-Settings\-Dirty().

\subsection{Member Data Documentation}
\index{KMainWindow@{KMain\-Window}!memberList@{memberList}}
\index{memberList@{memberList}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ {\bf KMain\-Window::member\-List} = 0L\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_s0}


List of members of KMain\-Window class. 



Definition at line 79 of file kmainwindow.cpp.

Referenced by close\-Event(), get\-Member\-List(), and $\sim$KMain\-Window().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmainwindow.h\item 
kmainwindow.cpp\end{CompactItemize}
