Gui::MainWindow Class Reference

The MainWindow class provides a main window with menu bar, toolbars, dockable windows, a status bar and mainly a workspace for the MDI windows. More...

#include <MainWindow.h>

List of all members.

Public Slots

void activateNextWindow ()
 Activates the next window in the child window chain.
void activatePreviousWindow ()
 Activates the previous window in the child window chain.
void activateWorkbench (const QString &)
 Just emits the workbenchActivated() signal to notify all receivers.
void arrangeIcons ()
 Arranges all child windows in a horizontal tile pattern.
void cascade ()
 Arranges all the child windows in a cascade pattern.
void closeActiveWindow ()
 Closes the child window that is currently active.
void closeAllWindows ()
 Closes all child windows.
void setPaneText (int i, QString text)
 Sets text to the pane in the status bar.
void showMessage (const QString &message, int timeout=0)
void switchToDockedMode ()
void switchToTopLevelMode ()
void tile ()
 Arranges all child windows in a tile pattern.
void whatsThis ()
 Starts the what's this mode.

Signals

void mainWindowClosed ()
void timeEvent ()
void windowStateChanged (MDIView *)
void workbenchActivated (const QString &)

Public Member Functions

MDIViewactiveWindow () const
 Returns the active MDI window or 0 if there is none.
void addWindow (MDIView *view)
 Adds an MDI window view to the main window's workspace and adds a new tab to the tab bar.
void appendRecentFile (const QString &filename)
 MRU: Appends file to the list of recent files.
QMenu * createPopupMenu ()
 Returns true that the context menu contains the 'Customize.
bool eventFilter (QObject *o, QEvent *e)
 Filters events if this object has been installed as an event filter for the watched object.
 MainWindow (QWidget *parent=0, Qt::WFlags f=Qt::Window)
 Constructs an empty main window.
void removeWindow (MDIView *view)
 Removes an MDI window from the main window's workspace and its associated tab without deleting the widget.
void setActiveWindow (MDIView *view)
 Sets the active window to view.
void tabChanged (MDIView *view)
 Can be called after the caption of an MDIView has changed to update the tab's caption.
QList< QWidget * > windows (QMdiArea::WindowOrder order=QMdiArea::CreationOrder) const
 Returns a list of all MDI windows in the worpspace.
 ~MainWindow ()
 Destroys the object and frees any allocated resources.
MIME data handling



bool canInsertFromMimeData (const QMimeData *source) const
 Check if mime data contains object data.
QMimeData * createMimeDataFromSelection () const
 Create mime data from selected objects.
void insertFromMimeData (const QMimeData *source)
 Insert the objects into the active document.
void loadUrls (App::Document *, const QList< QUrl > &)
 Load files from the given URLs into the given document.
Layout Methods



void loadWindowSettings ()
 Loads the main window settings.
void saveWindowSettings ()
 Saves the main window settings.

Protected Member Functions

void changeEvent (QEvent *e)
 This method is called from the Qt framework automatically whenever a QTranslator object has been installed.
void closeEvent (QCloseEvent *e)
 This method checks if the main window can be closed by checking all open documents and views.
void customEvent (QEvent *e)
void dragEnterEvent (QDragEnterEvent *e)
 Checks if a mime source object can be interpreted.
void dropEvent (QDropEvent *e)
 Try to interpret dropped elements.
bool event (QEvent *e)
void hideEvent (QHideEvent *e)
void showEvent (QShowEvent *e)
void timerEvent (QTimerEvent *)

Splasher and access methods



void showDocumentation (const char *Article=0)
 Shows the online documentation.
void showTipOfTheDay (bool force=false)
 Shows the Tip-of-the-day dialog after startup.
QPixmap splashImage () const
void startSplasher (void)
 Starts the splasher at startup.
void stopSplasher (void)
 Stops the splasher after startup.
static MainWindowgetInstance ()
 Gets the one and only instance.

Detailed Description

The MainWindow class provides a main window with menu bar, toolbars, dockable windows, a status bar and mainly a workspace for the MDI windows.

Author:
Werner Mayer

Definition at line 69 of file MainWindow.h.


Constructor & Destructor Documentation

MainWindow::MainWindow ( QWidget *  parent = 0,
Qt::WFlags  f = Qt::Window 
)
MainWindow::~MainWindow (  ) 

Destroys the object and frees any allocated resources.

Definition at line 426 of file MainWindow.cpp.

References Gui::MainWindowP::status.


Member Function Documentation

void MainWindow::activateNextWindow (  )  [slot]

Activates the next window in the child window chain.

Definition at line 509 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdActivateNextWindow::activated().

void MainWindow::activatePreviousWindow (  )  [slot]

Activates the previous window in the child window chain.

Definition at line 518 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdActivatePrevWindow::activated().

void MainWindow::activateWorkbench ( const QString &  name  )  [slot]

Just emits the workbenchActivated() signal to notify all receivers.

Definition at line 527 of file MainWindow.cpp.

References workbenchActivated().

Referenced by Gui::Application::activateWorkbench().

MDIView * MainWindow::activeWindow ( void   )  const
void MainWindow::addWindow ( MDIView view  ) 
void MainWindow::appendRecentFile ( const QString &  filename  ) 

MRU: Appends file to the list of recent files.

Definition at line 1136 of file MainWindow.cpp.

References Gui::RecentFilesAction::appendFile().

Referenced by Gui::Application::exportTo(), Gui::Application::importFrom(), Gui::Application::open(), and Gui::Document::saveAs().

void MainWindow::arrangeIcons (  )  [slot]

Arranges all child windows in a horizontal tile pattern.

Definition at line 464 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdArrangeIcons::activated().

bool MainWindow::canInsertFromMimeData ( const QMimeData *  source  )  const

Check if mime data contains object data.

Definition at line 1378 of file MainWindow.cpp.

Referenced by StdCmdPaste::isActive().

void MainWindow::cascade (  )  [slot]

Arranges all the child windows in a cascade pattern.

Definition at line 482 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdCascadeWindows::activated().

void MainWindow::changeEvent ( QEvent *  e  )  [protected]

This method is called from the Qt framework automatically whenever a QTranslator object has been installed.

This allows to translate all relevant user visible text.

Definition at line 1453 of file MainWindow.cpp.

References Gui::WorkbenchManager::active(), Gui::Application::commandManager(), Gui::CommandManager::getAllCommands(), Gui::WorkbenchManager::instance(), Gui::Application::Instance, Gui::Workbench::retranslate(), and Gui::MainWindowP::sizeLabel.

void MainWindow::closeActiveWindow (  )  [slot]

Closes the child window that is currently active.

Definition at line 491 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdCloseActiveWindow::activated().

void MainWindow::closeAllWindows (  )  [slot]

Closes all child windows.

The windows are closed in random order. The operation stops if a window does not accept the close event.

Definition at line 500 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdCloseAllWindows::activated().

void MainWindow::closeEvent ( QCloseEvent *  e  )  [protected]

This method checks if the main window can be closed by checking all open documents and views.

Definition at line 1071 of file MainWindow.cpp.

References Gui::MainWindowP::activityTimer, Gui::MainWindowP::assistant, Gui::Application::Instance, mainWindowClosed(), saveWindowSettings(), and Gui::Application::tryClose().

QMimeData * MainWindow::createMimeDataFromSelection (  )  const
QMenu * MainWindow::createPopupMenu (  ) 
void MainWindow::customEvent ( QEvent *  e  )  [protected]
void MainWindow::dragEnterEvent ( QDragEnterEvent *  e  )  [protected]

Checks if a mime source object can be interpreted.

Definition at line 1315 of file MainWindow.cpp.

void MainWindow::dropEvent ( QDropEvent *  e  )  [protected]

Try to interpret dropped elements.

Drops the event e and tries to open the files.

Definition at line 1303 of file MainWindow.cpp.

References loadUrls().

bool MainWindow::event ( QEvent *  e  )  [protected]
bool MainWindow::eventFilter ( QObject *  o,
QEvent *  e 
)

Filters events if this object has been installed as an event filter for the watched object.

Definition at line 602 of file MainWindow.cpp.

References RobotExample::w, Gui::MainWindowP::whatstext, Gui::MainWindowP::whatsthis, WhatsThis, and windowStateChanged().

MainWindow * MainWindow::getInstance (  )  [static]

Gets the one and only instance.

Definition at line 433 of file MainWindow.cpp.

Referenced by Gui::getMainWindow(), loadWindowSettings(), MainWindow(), saveWindowSettings(), and setupMainWindow().

void MainWindow::hideEvent ( QHideEvent *  e  )  [protected]

Definition at line 1103 of file MainWindow.cpp.

References Gui::MainWindowP::visibleTimer.

void MainWindow::insertFromMimeData ( const QMimeData *  source  ) 

Insert the objects into the active document.

If no document exists one gets created.

Definition at line 1387 of file MainWindow.cpp.

References App::Application::getActiveDocument(), App::GetApplication(), Gui::MergeDocuments::importObjects(), loadUrls(), and App::Application::newDocument().

Referenced by StdCmdPaste::activated().

void MainWindow::loadUrls ( App::Document doc,
const QList< QUrl > &  url 
)

Load files from the given URLs into the given document.

If the document is 0 one gets created automatically if needed.

Definition at line 1419 of file MainWindow.cpp.

References Base::Console(), App::GetApplication(), App::Application::getImportModules(), App::Document::getName(), Gui::Application::importFrom(), Gui::SelectModule::importHandler(), and Gui::Application::Instance.

Referenced by Gui::View3DInventor::dropEvent(), dropEvent(), and insertFromMimeData().

void MainWindow::loadWindowSettings (  ) 
void Gui::MainWindow::mainWindowClosed (  )  [signal]

Referenced by closeEvent().

void MainWindow::removeWindow ( Gui::MDIView view  ) 

Removes an MDI window from the main window's workspace and its associated tab without deleting the widget.

Removes the instance of Gui::MDiView from the main window and sends am event to the parent widget, a QMdiSubWindow to delete itself.

If the main windows does not have such a window nothing happens.

If you want to avoid that the Gui::MDIView instance gets destructed too you must reparent it afterwards, e.g. set parent to NULL.

Definition at line 769 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea, and windowStateChanged().

Referenced by CmdTestMDI3::activated(), CmdTestMDI1::activated(), Gui::MDIView::closeEvent(), and Gui::MDIView::setCurrentViewMode().

void MainWindow::saveWindowSettings (  ) 

Saves the main window settings.

Definition at line 1220 of file MainWindow.cpp.

References App::Application::Config(), getInstance(), Gui::DockWindowManager::instance(), RobotExample::pos, and Gui::DockWindowManager::saveState().

Referenced by closeEvent().

void MainWindow::setActiveWindow ( MDIView view  ) 
void MainWindow::setPaneText ( int  i,
QString  text 
) [slot]
void MainWindow::showDocumentation ( const char *  Article = 0  ) 

Shows the online documentation.

Definition at line 538 of file MainWindow.cpp.

References Gui::MainWindowP::assistant, and Gui::Assistant::showDocumentation().

Referenced by StdCmdOnlineHelp::activated(), and event().

void MainWindow::showEvent ( QShowEvent *  e  )  [protected]

Definition at line 1096 of file MainWindow.cpp.

References Gui::MainWindowP::visibleTimer.

void MainWindow::showMessage ( const QString &  message,
int  timeout = 0 
) [slot]
void MainWindow::showTipOfTheDay ( bool  force = false  ) 

Shows the Tip-of-the-day dialog after startup.

Definition at line 1282 of file MainWindow.cpp.

References App::Application::Config(), App::GetApplication(), ParameterGrp::GetGroup(), and App::Application::GetUserParameter().

QPixmap MainWindow::splashImage (  )  const
void MainWindow::startSplasher ( void   ) 
void MainWindow::stopSplasher ( void   ) 

Stops the splasher after startup.

Definition at line 1261 of file MainWindow.cpp.

References Gui::MainWindowP::splashscreen.

Referenced by Gui::Application::runApplication().

void MainWindow::switchToDockedMode (  )  [slot]
void MainWindow::switchToTopLevelMode (  )  [slot]

Definition at line 1158 of file MainWindow.cpp.

References Gui::getMainWindow(), and windows().

void MainWindow::tabChanged ( MDIView view  ) 

Can be called after the caption of an MDIView has changed to update the tab's caption.

Definition at line 818 of file MainWindow.cpp.

References RobotExample::pos.

Referenced by addWindow(), Gui::MDIView::changeEvent(), and MainWindow().

void MainWindow::tile (  )  [slot]

Arranges all child windows in a tile pattern.

Definition at line 473 of file MainWindow.cpp.

References Gui::MainWindowP::mdiArea.

Referenced by StdCmdTileWindows::activated().

void Gui::MainWindow::timeEvent (  )  [signal]
void Gui::MainWindow::timerEvent ( QTimerEvent *   )  [inline, protected]

Definition at line 221 of file MainWindow.h.

void MainWindow::whatsThis (  )  [slot]

Starts the what's this mode.

Definition at line 533 of file MainWindow.cpp.

QList< QWidget * > MainWindow::windows ( QMdiArea::WindowOrder  order = QMdiArea::CreationOrder  )  const
void Gui::MainWindow::windowStateChanged ( MDIView  )  [signal]
void Gui::MainWindow::workbenchActivated ( const QString &   )  [signal]

Referenced by activateWorkbench().


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:00 2011 for FreeCAD by  doxygen 1.6.1