|
|
The base class for MyTest application windows. It sets up the main window and reads the config file as well as providing a menubar, toolbar and statusbar. In initView(), your main view is created as the MDI child window manager. Child windows are created in createClient(), which gets a document instance as it's document to display whereby one document can have several views.The MDI child is an instance of MyTestView, the document an instance of MyTestDoc. MyTestApp reimplements the methods that KTMainWindow provides for main window handling and supports full session management as well as keyboard accelerator configuration by using KAccel.
See also: KMainWindow, KApplication, KConfig, KAccel
MyTestApp ()
| MyTestApp |
construtor of MyTestApp, calls all init functions to create the application.
See also: initMenuBar, initToolBar
~MyTestApp ()
| ~MyTestApp |
void openDocumentFile (const KURL& url=0)
| openDocumentFile |
opens a file specified by commandline option
bool queryClose ()
| queryClose |
[protected virtual]
queryClose is called by KTMainWindow on each closeEvent of a window. Against the default implementation (only returns true), this overridden function retrieves all modified documents from the open document list and asks the user to select which files to save before exiting the application.
See also: KTMainWindow#queryClose, KTMainWindow#closeEvent
bool queryExit ()
| queryExit |
[protected virtual]
queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent(). Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's properties.
See also: KTMainWindow#queryExit, KTMainWindow#closeEvent
void saveProperties (KConfig *_cfg)
| saveProperties |
[protected virtual]
saves the window properties for each open window during session end to the session config file, including saving the currently opened file by a temporary filename provided by KApplication.
See also: KTMainWindow#saveProperties
void readProperties (KConfig *_cfg)
| readProperties |
[protected virtual]
reads the session config file and restores the application's state including the last opened files and documents by reading the temporary files saved by saveProperties()
See also: KTMainWindow#readProperties
bool eventFilter (QObject* object, QEvent* event)
| eventFilter |
[protected virtual]
event filter to catch close events for MDI child windows and is installed in createClient() on every child window. Closing a window calls the eventFilter first which removes the view from the connected documents' view list. If the last view is going to be closed, the eventFilter() tests if the document is modified; if yes, it asks the user to save the document. If the document title contains "Untitled", slotFileSaveAs() gets called to get a save name and path.
void createClient (MyTestDoc* doc)
| createClient |
[protected]
creates a new child window. The document that will be connected to it has to be created before and the instances filled, with e.g. openDocument(). Then call createClient() to get a new MDI child window.
Parameters:
doc | pointer to the document instance that the view will be connected to. |
See also: addView, openDocument
void slotFileNew ()
| slotFileNew |
[private slots slot]
void slotFileOpen ()
| slotFileOpen |
[private slots slot]
void slotFileOpenRecent (const KURL& url)
| slotFileOpenRecent |
[private slots slot]
void slotFileSave ()
| slotFileSave |
[private slots slot]
void slotFileSaveAs ()
| slotFileSaveAs |
[private slots slot]
void slotFileClose ()
| slotFileClose |
[private slots slot]
void slotFilePrint ()
| slotFilePrint |
[private slots slot]
void slotFileQuit ()
| slotFileQuit |
[private slots slot]
void slotEditUndo ()
| slotEditUndo |
[private slots slot]
void slotEditCut ()
| slotEditCut |
[private slots slot]
put the marked text/object into the clipboard and remove it from the document
void slotEditCopy ()
| slotEditCopy |
[private slots slot]
put the marked text/object into the clipboard
void slotEditPaste ()
| slotEditPaste |
[private slots slot]
paste the clipboard into the document
void slotViewToolBar ()
| slotViewToolBar |
[private slots slot]
toggles the toolbar
void slotViewStatusBar ()
| slotViewStatusBar |
[private slots slot]
toggles the statusbar
void slotWindowNewWindow ()
| slotWindowNewWindow |
[private slots slot]
creates a new view for the document in the active child window and adds the new view to the list of views the document maintains.
void slotStatusMsg (const QString &text)
| slotStatusMsg |
[private slots slot]
changes the statusbar contents for the standard label permanently, used to indicate current actions.
Parameters:
text | the text that is displayed in the statusbar |
void windowMenuAboutToShow ()
| windowMenuAboutToShow |
[private slots slot]
void windowMenuActivated ( int id )
| windowMenuActivated |
[private slots slot]
void slotWindowTile ()
| slotWindowTile |
[private slots slot]
void slotWindowCascade ()
| slotWindowCascade |
[private slots slot]
void saveOptions ()
| saveOptions |
[private]
save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration file
void readOptions ()
| readOptions |
[private]
read general Options again and initialize all variables like the recent file list
void initActions ()
| initActions |
[private]
void initStatusBar ()
| initStatusBar |
[private]
sets up the statusbar for the main window by initialzing a statuslabel.
void initView ()
| initView |
[private]
Creates the main view of the KTMainWindow instance and initializes the MDI view area including any needed connections.
KConfig * config | config |
[private]
QWorkspace * pWorkspace | pWorkspace |
[private]
QPrinter * printer | printer |
[private]
int untitledCount | untitledCount |
[private]
QList<MyTestDoc> * pDocList | pDocList |
[private]
KAction* fileNew | fileNew |
[private]
KAction* fileOpen | fileOpen |
[private]
KRecentFilesAction* fileOpenRecent | fileOpenRecent |
[private]
KAction* fileSave | fileSave |
[private]
KAction* fileSaveAs | fileSaveAs |
[private]
KAction* fileClose | fileClose |
[private]
KAction* filePrint | filePrint |
[private]
KAction* fileQuit | fileQuit |
[private]
KAction* editCut | editCut |
[private]
KAction* editCopy | editCopy |
[private]
KAction* editPaste | editPaste |
[private]
KAction* windowNewWindow | windowNewWindow |
[private]
KAction* windowTile | windowTile |
[private]
KAction* windowCascade | windowCascade |
[private]
KToggleAction* viewToolBar | viewToolBar |
[private]
KToggleAction* viewStatusBar | viewStatusBar |
[private]
KActionMenu* windowMenu | windowMenu |
[private]