This class is the base class for your application. More...
#include <MainWindow.h>
Public Slots | |
Refresh and show | |
virtual void | refresh () |
void | show () |
inherited from QWidget, just to refresh all viewers More... | |
Public Member Functions | |
general | |
MainWindow (QString title) | |
Constructor, the window title can be changed here, it is inconsistent to use setWindowTitle(). More... | |
~MainWindow () override | |
destructor More... | |
virtual void | aboutToShow () |
this method is automatically called by Application before the first time show() is called. More... | |
title, subtitle, status bar message, progress bar state and console | |
QString | getName () const |
Get the main window title. More... | |
void | setWindowSubtitle (QString) |
The subtitle is situated at the end of the title, on the title bar, is helps for example showing which file is currently selected. More... | |
QProgressBar * | getProgressBar () |
similar as statusBar() from QMainWindow but for the progress bar More... | |
void | showStatusBar (bool) |
show the status bar (by default it is hidden) More... | |
virtual void | redirectToConsole (bool) |
use or not the application console (redirect or not standard out/err streams) More... | |
void | showConsole (bool) |
get the console window More... | |
bool | getConsoleVisibility () |
get the visibility state of the console ( More... | |
Initialize and save settings | |
virtual void | initSettings () |
void | saveSettings () |
Save MainWindow's settings into Application::settings. More... | |
Viewers | |
virtual void | showDockViewer (Viewer *, bool) |
set the visibility for the given docked viewer and its toolbar More... | |
virtual void | addDockViewer (Qt::DockWidgetArea, Viewer *) |
add a Viewer to the application as a docking widget and specify where it has to be docked Note that MainWindow takes ownership of the Viewer pointer and deletes it at the appropriate time. More... | |
void | refreshViewers () |
Method uses to refresh all the viewer of the Main Window. More... | |
virtual void | setCentralViewer (Viewer *) |
set the central Viewer of the application. More... | |
virtual Viewer * | getCentralViewer () const |
virtual void | showViewerToolbar (Viewer *theViewer, bool visible) |
Set the visibility of a viewer's toolbar. More... | |
Protected Member Functions | |
void | closeEvent (QCloseEvent *) override |
overriden from QMainWindow, just connect to slotFileQuit More... | |
void | dragEnterEvent (QDragEnterEvent *event) override |
called when a drag event started on the main window, accept drag only if file is MIME type text/uri-list More... | |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
called when the mouse leaves the widgets area during a drag/drop operation More... | |
void | dragMoveEvent (QDragMoveEvent *event) override |
called when the mouse moves inside the widgets area during a drag/drop operation More... | |
void | dropEvent (QDropEvent *event) override |
just call open with the dragged uri More... | |
Protected Attributes | |
Viewer * | centralViewer |
The actual central Viewer. More... | |
Viewer and other things | |
QList< Viewer * > | viewers |
QMap< Viewer *, QDockWidget * > | dockWidgetMap |
the map that gives the corresponding QDockWidget for a given Viewer More... | |
This class is the base class for your application.
It sets up the main window and creates a menubar, toolbar and statusbar (all hidden by default).
It is the default main window for a application.
Create a class that inherits from MainWindow to get all the goodies of CamiTK and add your own customization/UI.
See tutorials applications for examples.
The central widget's layout is a QStackedLayout: when new central viewers are added, the previous central viewer is hidden, not destroyed.
MainWindow::MainWindow | ( | QString | title | ) |
Constructor, the window title can be changed here, it is inconsistent to use setWindowTitle().
If you like to dynamically add some information to the window title, please use setWindowSubtitle() instead.
title | main window title |
References centralViewer, camitk::InterfaceLogger::ERROR, camitk::Application::getAction(), camitk::Log::getLogger(), camitk::Action::getQAction(), camitk::InterfaceLogger::INFO, showStatusBar(), camitk::InterfaceLogger::TRACE, and camitk::InterfaceLogger::WARNING.
|
override |
destructor
References dockWidgetMap.
|
virtual |
this method is automatically called by Application before the first time show() is called.
This method calls initSettings().
Reimplemented in ImpMainWindow.
References initSettings().
Referenced by camitk::Application::exec().
|
virtual |
add a Viewer to the application as a docking widget and specify where it has to be docked Note that MainWindow takes ownership of the Viewer pointer and deletes it at the appropriate time.
This method calls addViewer(...). This method calls showDockViewer(..,true) and therefore showViewerToolbar(..,true)
Reimplemented in ImpMainWindow.
References dockWidgetMap, camitk::Viewer::setDockWidget(), and showDockViewer().
Referenced by ActionStateMachine::initMainWindow().
|
overrideprotected |
overriden from QMainWindow, just connect to slotFileQuit
References camitk::Application::getAction(), saveSettings(), and camitk::Action::SUCCESS.
|
overrideprotected |
called when a drag event started on the main window, accept drag only if file is MIME type text/uri-list
|
overrideprotected |
called when the mouse leaves the widgets area during a drag/drop operation
|
overrideprotected |
called when the mouse moves inside the widgets area during a drag/drop operation
|
overrideprotected |
just call open with the dragged uri
References camitk::Application::open().
|
virtual |
References centralViewer.
bool MainWindow::getConsoleVisibility | ( | ) |
get the visibility state of the console (
QString MainWindow::getName | ( | ) | const |
Get the main window title.
QProgressBar * MainWindow::getProgressBar | ( | ) |
similar as statusBar() from QMainWindow but for the progress bar
Referenced by ImpMainWindow::openDataDirectory(), camitk::Application::resetProgressBar(), camitk::Application::setProgressBarValue(), and camitk::Application::vtkProgressFunction().
|
virtual |
init MainWindow specific settings (e.g. size, position)
References camitk::Application::getName(), camitk::Application::getSettings(), camitk::Application::getViewer(), and setCentralViewer().
Referenced by aboutToShow(), and camitk::Application::loadWorkspace().
|
virtual |
use or not the application console (redirect or not standard out/err streams)
Reimplemented in ImpMainWindow.
References CAMITK_INFO, camitk::ConsoleStream::free(), camitk::ConsoleStream::init(), and camitk::Core::version.
Referenced by ActionStateMachine::initMainWindow(), main(), and camitk::Application::setMainWindow().
|
virtualslot |
this slot is connected to all the viewers selectionChanged() signal, this will call the refresh method of all viewers
References centralViewer, camitk::Viewer::getComponentClassNames(), camitk::Application::getTriggeredAction(), camitk::Viewer::refresh(), showViewerToolbar(), and viewers.
Referenced by camitk::Application::refresh(), and show().
void MainWindow::refreshViewers | ( | ) |
Method uses to refresh all the viewer of the Main Window.
References centralViewer, camitk::Viewer::refresh(), showViewerToolbar(), and viewers.
void MainWindow::saveSettings | ( | ) |
Save MainWindow's settings into Application::settings.
References camitk::Application::getName(), and camitk::Application::getSettings().
Referenced by closeEvent(), and camitk::Application::saveWorkspace().
|
virtual |
set the central Viewer of the application.
The central viewer has a specific behaviour in a MainWindow. It uses a QStackWidget to keep all the central viewer that are used. When a new central viewers is set, the previous central viewer (i.e., its widget) is hidden but not destroyed.
This method calls addViewer(..). This method calls showViewerToolbar(..,true)
Reimplemented in ImpMainWindow.
References centralViewer, camitk::Application::getName(), camitk::Viewer::getName(), camitk::Application::getSettings(), camitk::Viewer::setEmbedder(), and showViewerToolbar().
Referenced by ActionStateMachine::initMainWindow(), and initSettings().
void MainWindow::setWindowSubtitle | ( | QString | subtitle | ) |
The subtitle is situated at the end of the title, on the title bar, is helps for example showing which file is currently selected.
It appears between brackets "[ ... ]"
Referenced by ActionStateMachine::ActionStateMachine(), and ImpMainWindow::updateActionStates().
|
slot |
inherited from QWidget, just to refresh all viewers
References camitk::Application::getAction(), camitk::Action::getQAction(), and refresh().
Referenced by camitk::Application::exec(), and showConsole().
void MainWindow::showConsole | ( | bool | show | ) |
|
virtual |
set the visibility for the given docked viewer and its toolbar
References dockWidgetMap, and showViewerToolbar().
Referenced by addDockViewer(), and ImpMainWindow::ImpMainWindow().
void MainWindow::showStatusBar | ( | bool | b | ) |
show the status bar (by default it is hidden)
Referenced by ActionStateMachine::initMainWindow(), and MainWindow().
|
virtual |
Set the visibility of a viewer's toolbar.
This method respect the toolbar visibility property of the viewer.
Referenced by refresh(), refreshViewers(), setCentralViewer(), and showDockViewer().
|
protected |
The actual central Viewer.
Referenced by getCentralViewer(), MainWindow(), refresh(), refreshViewers(), setCentralViewer(), and ImpMainWindow::updateViewMenu().
|
protected |
the map that gives the corresponding QDockWidget for a given Viewer
Referenced by addDockViewer(), ImpMainWindow::ImpMainWindow(), ImpMainWindow::resetWindows(), showDockViewer(), ImpMainWindow::updateViewMenu(), and ~MainWindow().
the set of viewers
Referenced by ImpMainWindow::editSettings(), refresh(), refreshViewers(), and ImpMainWindow::updateViewMenu().