All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Slots | Signals | Public Member Functions
Qtilities::CoreGui::QtilitiesMainWindow Class Reference

A class which can be used as a frontend of applications using the Qtilities libraries. More...

#include <QtilitiesMainWindow.h>

List of all members.

Public Types

enum  ModeLayout {
  ModesNone = 0, ModesTop = 1, ModesRight = 2, ModesBottom = 4,
  ModesLeft = 8
}
 The possible places where modes can be displayed. More...

Public Slots

void processPriorityMessage (Logger::MessageType message_type, const QString &message)
 Slot which received incomming priority messages from the Qtilities logger.

Signals

void aboutToBeDestroyed (QObject *object)
 Signal which is emitted at the beginning of the QtilitiesMainWindow destructor.

Public Member Functions

void disablePriorityMessages ()
 Function to disable priority messages in the status bar of the main window.
void enablePriorityMessages ()
 Function to enabled priority messages in the status bar of the main window.
virtual void forceCloseApplication ()
 Function which is called when the user selects to force close the application.
void hideTaskSummaryWidget ()
 Hides a task summary widget next to the mode list widget.
bool lastReadSettingsIsMaximized () const
 Returns if the main window was maximized according to the settings read in readSettings().
ModeLayout modeLayout () const
 Returns the current mode layout of the widget.
ModeManagermodeManager ()
 Returns a reference to the mode widget which allows management of modes in the main window.
QLabel * priorityMessageLabel () const
 Function which provides access to the label used to display priority messages.
void readSettings (const QString &gui_id="MainWindow")
 Restores the state of the main window.
void showTaskSummaryWidget ()
 Shows a task summary widget next to the mode list widget.
TaskSummaryWidgettaskSummaryWidget () const
 Function which provides access to the label used to display priority messages.
bool taskSummaryWidgetVisible () const
 Hides a task summary widget next to the mode list widget.
void writeSettings (const QString &gui_id="MainWindow")
 Saves the state of the main window.

Detailed Description

A class which can be used as a frontend of applications using the Qtilities libraries.

The QtilitiesMainWindow extends the normal QMainWindow class by adding the following:

Qtilities provides a main window architecture which allows you to create complex main windows easily. Once you created your widget, it is recommended to set it as the main window on QtilitiesApplication as shown below:

int main(int argc, char *argv[])
{
QtilitiesApplication a(argc, argv);
QtilitiesApplication::setOrganizationName("Jaco Naudé");
QtilitiesApplication::setApplicationName("Main Window Example");
// Create a QtilitiesMainWindow to show our different modes:
QtilitiesMainWindow* example_main_window = new QtilitiesMainWindow(QtilitiesMainWindow::ModesLeft);
// Lots of application code...
}

Application modes are supported, where modes are classes implementing the Qtilities::CoreGui::Interfaces::IMode interface. Each mode provide a widget and an icon identifying the mode. Modes are listed in the main window depending on modeLayout() setting. When a mode's icon is clicked, its widget is set as the active widget in the main window. It is also possible to the use the main window without modes by using the ModesNone modeLayout().

Below is an example of the main window in action:

class_qtilitiesmainwindow_modes_left.jpg
Main Window With Modes On The Left

Alternatively, we can put the modes on either the top, right or bottom. For example:

To create your widget, add something like the following to your main.cpp code:

int main(int argc, char *argv[])
{
QtilitiesApplication a(argc, argv);
QtilitiesApplication::setOrganizationName("Jaco Naudé");
QtilitiesApplication::setApplicationName("Main Window Example");
// Create a QtilitiesMainWindow with modes at the top:
QtilitiesMainWindow* example_main_window = new QtilitiesMainWindow(QtilitiesMainWindow::ModesTop);
// Lots of application code...

The result is:

class_qtilitiesmainwindow_modes_top.jpg
Main Window With Modes At The Top

The QtilitiesMainWindow widget supports the Qtilities Logger's priority messaging functionality and displays the priority messages in the status bar of the main window by default. To disable this feature the disablePriorityMessages() function can be called.

Further, the Qtilities::CoreGui::DynamicSideWidgetViewer class is able to display widgets implementing the Qtilities::CoreGui::Interfaces::ISideViewerWidget interface. Each side viewer is wrapped using the Qtilities::CoreGui::DynamicSideWidgetWrapper class which provides actions to remove the side viewer or to duplicate the side viewer. For more information on this see the relevant class documentation.

By default a Qtilities::CoreGui::TaskSummaryWidget is shown. You can disable this through showTaskSummaryWidget() & hideTaskSummaryWidget(). You can access the task summary widget shown through taskSummaryWidget().


Member Enumeration Documentation

The possible places where modes can be displayed.

The default is ModesNone.

Enumerator:
ModesNone 

No mode display.

ModesTop 

Display modes as a horizontal list in the top of the widget.

ModesRight 

Display modes as a vertical list in the right of the widget.

ModesBottom 

Display modes as a horizontal list in the bottom of the widget.

ModesLeft 

Display modes as a vertical list in the left of the widget.


Member Function Documentation

void Qtilities::CoreGui::QtilitiesMainWindow::aboutToBeDestroyed ( QObject *  object)
signal

Signal which is emitted at the beginning of the QtilitiesMainWindow destructor.

Slots connected to this signal can get hold of information about all IMode interfaces shown in the QtilitiesMainWindow before the window itself is destroyed.

void Qtilities::CoreGui::QtilitiesMainWindow::disablePriorityMessages ( )

Function to disable priority messages in the status bar of the main window.

Enabled by default.

See also:
enablePriorityMessages(), priorityMessageLabel()
void Qtilities::CoreGui::QtilitiesMainWindow::enablePriorityMessages ( )

Function to enabled priority messages in the status bar of the main window.

Enabled by default.

See also:
disablePriorityMessages(), priorityMessageLabel()
void Qtilities::CoreGui::QtilitiesMainWindow::forceCloseApplication ( )
virtual

Function which is called when the user selects to force close the application.

By default, this function just calls qApp->quit();

void Qtilities::CoreGui::QtilitiesMainWindow::hideTaskSummaryWidget ( )

Hides a task summary widget next to the mode list widget.

Note:
The task summary widget is only available when the ModeLayout() is set up to actually show modes.
At present the task summary is only supported with ModesTop and ModesBottom.
See also:
showTaskSummaryWidget(), taskSummaryWidgetVisible(), taskSummaryWidget()
bool Qtilities::CoreGui::QtilitiesMainWindow::lastReadSettingsIsMaximized ( ) const

Returns if the main window was maximized according to the settings read in readSettings().

This function was added in Qtilities v1.2.

Qtilities::CoreGui::ModeManager * Qtilities::CoreGui::QtilitiesMainWindow::modeManager ( )

Returns a reference to the mode widget which allows management of modes in the main window.

Note:
Important: If modeLayout() is ModesNone, this function returns null. To use modes make sure you pass your mode layout in the constructor.
QLabel * Qtilities::CoreGui::QtilitiesMainWindow::priorityMessageLabel ( ) const

Function which provides access to the label used to display priority messages.

Access to the lable allows you to modify it according to your needs. For example, we can enable/disable word wrapping etc.

See also:
enablePriorityMessages(), disablePriorityMessages()

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::QtilitiesMainWindow::showTaskSummaryWidget ( )

Shows a task summary widget next to the mode list widget.

When using Qtilities::CoreGui::QtilitiesMainWindow you can set it up to show a task summary information automatically for you. This makes it very easy to provide an overview of tasks in your application. The Tasking Example demonstrates this:

example_tasking.jpg
Tasking Example
Note:
The task summary widget is only available when the ModeLayout() is set up to actually show modes.
At present the task summary is only supported with ModesTop and ModesBottom.
See also:
hideTaskSummaryWidget(), taskSummaryWidgetVisible(), taskSummaryWidget()
Qtilities::CoreGui::TaskSummaryWidget * Qtilities::CoreGui::QtilitiesMainWindow::taskSummaryWidget ( ) const

Function which provides access to the label used to display priority messages.

Access to the lable allows you to modify it according to your needs. For example, we can enable/disable word wrapping etc.

See also:
showTaskSummaryWidget(), hideTaskSummaryWidget(), taskSummaryWidgetVisible()
Note:
At present the task summary is only supported with ModesTop and ModesBottom.

This function was added in Qtilities v1.1.

bool Qtilities::CoreGui::QtilitiesMainWindow::taskSummaryWidgetVisible ( ) const

Hides a task summary widget next to the mode list widget.

True by default.

Note:
The task summary widget is only available when the ModeLayout() is set up to actually show modes.
At present the task summary is only supported with ModesTop and ModesBottom.
See also:
setShowTaskSummaryWidget(), taskSummaryWidget()


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé