itom
Loading...
Searching...
No Matches
ito::AbstractDockWidget Class Referenceabstract

abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an instance of QMainWindow. The real widget is then placed as central widget of this QMainWindow. QMainWindow has the ability to show a menubar as well as a toolbar, which is used in different versions depending on docked state. Inherit AbstractDockWidget in order to realize content of QMainWindow. More...

#include <abstractDockWidget.h>

Inheritance diagram for ito::AbstractDockWidget:
ito::AIManagerWidget ito::BookmarkDockWidget ito::BreakPointDockWidget ito::CallStackDockWidget ito::FigureWidget ito::FileSystemDockWidget ito::HelpDockWidget ito::LastCommandDockWidget ito::PythonMessageDockWidget ito::ScriptDockWidget ito::WorkspaceDockWidget

Classes

struct  Toolbar
 

Public Types

enum  tFloatingStyle { floatingNone , floatingStandard , floatingWindow }
 The floating style of a widget, derived from AbstractDockWidget. More...
 
enum  tMovingStyle { movingDisabled , movingEnabled }
 The configuration if a docked AbstractDockWidget can be moved from one docking area to another one. More...
 
enum  tTopLevelStyle { topLevelOverall , topLevelParentOnly , topLevelNothing }
 The top level style of a widget, derived from AbstractDockWidget. More...
 

Public Slots

void setEnabled (bool)
 
virtual void setVisible (bool visible)
 
virtual void pythonStateChanged (tPythonTransitions pyTransition)
 slot invoked if python state changed. Sets the specific member variables according to the python transition.
 
void raiseAndActivate ()
 activates this dock widget or window and raises it on top of all opened windows
 
void mini ()
 
void setDockSize (int newWidth, int newHeight)
 
void dockWidget ()
 docks this dockWidget.
 
void undockWidget (bool show_it=true)
 undocks this dockWidget.
 
RetVal setAdvancedWindowTitle (QString newCompleteTitle=QString(), bool appendToBasicTitle=true)
 changes the title of widget
 

Signals

void dockStateChanged (bool docked)
 emitted if the widget is either docked or undocked from the main window
 

Public Member Functions

 AbstractDockWidget (bool docked, bool isDockAvailable, tFloatingStyle floatingStyle, tMovingStyle movingStyle, const QString &title=QString(), const QString &objName=QString(), QWidget *parent=0)
 constructor
 
virtual ~AbstractDockWidget ()
 destructor
 
bool docked () const
 
RetVal setTopLevel (tTopLevelStyle topLevel, bool showWindow=true)
 
void setParent (QWidget *parent)
 
QWidget * getActiveInstance ()
 
QRect frameGeometry () const
 
const QRect & geometry () const
 
QRect normalGeometry () const
 
int x () const
 
int y () const
 
QPoint pos () const
 
QSize frameSize () const
 
QSize size () const
 
int width () const
 
int height () const
 
QRect rect () const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void move (int x, int y)
 
void move (const QPoint &)
 
void resize (int w, int h)
 
void resize (const QSize &)
 
void setGeometry (int x, int y, int w, int h)
 
void setGeometry (const QRect &)
 
void setMinimumSize (const QSize &size)
 
QString windowTitle ()
 
void setWindowTitle (const QString &title)
 
bool isEnabled () const
 
bool isVisible () const
 
void saveState (const QString &iniName) const
 
void restoreState (const QString &iniName)
 
void synchronizeTopLevelState ()
 synchronizes the top level state of the dock widget with the floating settings of this abstract dock widget
 
virtual QSize sizeHint () const
 
virtual QSize minimumSizeHint () const
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event)
 eventFilter for m_pWindow
 
void init ()
 init method, called by constructor
 
virtual void closeEvent (QCloseEvent *event)
 closeEvent invoked if this AbstractDockWidget should be closed
 
virtual void createActions ()=0
 
virtual void createMenus ()=0
 
virtual void createToolBars ()=0
 
virtual void createStatusBar ()=0
 
virtual void updateActions ()
 
virtual void updatePythonActions ()=0
 
Qt::WindowFlags modifyFlags (const Qt::WindowFlags &flags, const Qt::WindowFlags &setFlags, const Qt::WindowFlags &unsetFlags)
 
virtual void windowStateChanged (bool)
 
void setContentWidget (QWidget *widget)
 sets any given QWidget as central widget of QMainWindow and inversely sets this QWidget's parent to the instance of QMainWindget
 
QWidget * getContentWidget () const
 
QMainWindow * getCanvas ()
 
bool pythonBusy () const
 
bool pythonDebugMode () const
 
bool pythonInWaitingMode () const
 
QToolBar * getToolBar (QString key) const
 returns reference to toolbar with given key-value
 
QMenuBar * getMenuBar () const
 
RetVal addToolBar (QToolBar *tb, const QString &key, Qt::ToolBarArea area=Qt::TopToolBarArea, int section=1)
 
RetVal removeToolBar (const QString &key)
 

Protected Attributes

QAction * m_actStayOnTop
 
QAction * m_actStayOnTopOfApp
 

Properties

bool visible
 
bool enabled
 
QRect geometry
 
QRect frameGeometry
 
QRect normalGeometry
 
int x
 
int y
 
QPoint pos
 
QSize frameSize
 
QSize size
 
int width
 
int height
 
QRect rect
 
QRect childrenRect
 
QRegion childrenRegion
 
QString windowTitle
 

Private Slots

void mnuStayOnTop (bool checked)
 
void mnuStayOnTopOfApp (bool checked)
 
void returnToOldMinMaxSizes ()
 

Private Member Functions

void contextMenuEvent (QContextMenuEvent *e)
 

Private Attributes

QMainWindow * m_pWindow
 
bool m_docked
 
bool m_dockAvailable
 
tFloatingStyle m_floatingStyle
 
tMovingStyle m_movingStyle
 
QString m_basicTitle
 
QString m_completeTitle
 
QMap< QString, QToolBar * > m_toolBars
 
QList< Toolbarm_toolbars
 
bool m_pythonBusy
 
bool m_pythonDebugMode
 
bool m_pythonInWaitingMode
 
QToolBar * m_dockToolbar
 
QAction * m_actDock
 
QAction * m_actUndock
 
QWidget * m_overallParent
 
tTopLevelStyle m_recentTopLevelStyle
 
QSize m_oldMinSize
 
QSize m_oldMaxSize
 
QRect m_lastUndockedSize
 
QByteArray m_pendingGeometryState
 

Friends

class ShortcutAction
 

Detailed Description

abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an instance of QMainWindow. The real widget is then placed as central widget of this QMainWindow. QMainWindow has the ability to show a menubar as well as a toolbar, which is used in different versions depending on docked state. Inherit AbstractDockWidget in order to realize content of QMainWindow.

Base class for all widgets that should be docked into the main window of itom. Widgets, deriving from this base class, can have different appearances. Depending on their configuration, they can behave like a dock widget and be docked into the main window or undocked (floated) as independent toolbox or they can be a dock widget if docked or a real window if they are undocked.

Member Enumeration Documentation

◆ tFloatingStyle

The floating style of a widget, derived from AbstractDockWidget.

An AbstractDockWidget can have different window representations, which can also be allowed or disallowed for different widgets:

  1. An AbstractDockWidget can behave like a dock widget and be docked into different docking areas of itom's main window
  2. An AbstractDockWidget can behave like a dock widget and can be undocked and be a floating toolbox
  3. An AbstractDockWidget can behave like a default window and can then be maximized, minimized and moved at any location
Enumerator
floatingNone 

the widget can not be undocked. It can only behave like a dock widget

floatingStandard 

the widget behaves always like a dock widget and can both be docked and undocked

floatingWindow 

the widget can both behave like a dock widget if it is docked or like a window if it is undocked

◆ tMovingStyle

The configuration if a docked AbstractDockWidget can be moved from one docking area to another one.

Enumerator
movingDisabled 

The dock widget must not be moved from one docking area to another one

movingEnabled 

The dock widget can be moved from one docking area to another one

◆ tTopLevelStyle

The top level style of a widget, derived from AbstractDockWidget.

The top level style is only relevant if the widget is currently undocked and has a window representation. Then the window can behave like a normal window, or it can always stay on top of its parent window or it can stay on top of all itom windows, dialogs...

Enumerator
topLevelOverall 

Window stays on top of everything

topLevelParentOnly 

Window stays on top of its parent window only

topLevelNothing 

Window has no specific top level behaviour (default)

Constructor & Destructor Documentation

◆ AbstractDockWidget()

ito::AbstractDockWidget::AbstractDockWidget ( bool docked,
bool isDockAvailable,
tFloatingStyle floatingStyle,
tMovingStyle movingStyle,
const QString & title = QString(),
const QString & objName = QString(),
QWidget * parent = 0 )

constructor

basic member initializations. Afterwards method init is called.

Parameters
dockedtrue if widget should be docked at startup, else false
isDockAvailabletrue if docking functionality is available, else false
floatingStyleFloatingStyle of AbstractDockWidget
See also
tFloatingStyle
Parameters
movingStyleMovingStyle of AbstractDockWidget
See also
tMovingStyle
Parameters
titleinitial title for docking widget. members m_basicTitle and m_completeTitle are set to title, too.
parentparent-widget, default: NULL
See also
init

◆ ~AbstractDockWidget()

ito::AbstractDockWidget::~AbstractDockWidget ( )
virtual

destructor

returns if docking widget is docked (true) or undocked (false)

Member Function Documentation

◆ closeEvent()

void ito::AbstractDockWidget::closeEvent ( QCloseEvent * event)
protectedvirtual

closeEvent invoked if this AbstractDockWidget should be closed

In this abstract class, the event is always accepted.

Note
Please overwrite this method by derived class in order to realize desired behaviour.
Parameters
eventEvent of type QCloseEvent

Reimplemented in ito::FigureWidget, and ito::ScriptDockWidget.

◆ createActions()

virtual void ito::AbstractDockWidget::createActions ( )
protectedpure virtual

◆ createMenus()

virtual void ito::AbstractDockWidget::createMenus ( )
protectedpure virtual

◆ createStatusBar()

virtual void ito::AbstractDockWidget::createStatusBar ( )
protectedpure virtual

◆ createToolBars()

virtual void ito::AbstractDockWidget::createToolBars ( )
protectedpure virtual

◆ dockWidget

void ito::AbstractDockWidget::dockWidget ( )
slot

docks this dockWidget.

Transforms this widget into a docking widget (e.g. from a single window) and docks it into the main window. The menubar is hidden and the size of all icons is decreased to 16x16 px.

◆ eventFilter()

bool ito::AbstractDockWidget::eventFilter ( QObject * obj,
QEvent * event )
inlineprotected

eventFilter for m_pWindow

depending on m_floatingStyle and the docked property, close-events will be caught by the closeEvent-method of this docking-widget or by the closeEvent of m_pWindow, which is not overloaded directly. Therefore this event-filter is installed and in case of a QCloseEvent, the closeEvent-method of this docking widget will be invoked in order to handle the close request. Else, the event will be passed and handled by somebody else.

◆ getContentWidget()

QWidget * ito::AbstractDockWidget::getContentWidget ( ) const
inlineprotected

returns reference to central widget of docking window

◆ getToolBar()

QToolBar * ito::AbstractDockWidget::getToolBar ( QString key) const
protected

returns reference to toolbar with given key-value

Parameters
keyString with key value for desired toolbar
Returns
reference to QToolBar or NULL, if key not found

◆ init()

void ito::AbstractDockWidget::init ( )
protected

init method, called by constructor

See also
AbstractDockWidget::AbstractDockWidget

◆ pythonBusy()

bool ito::AbstractDockWidget::pythonBusy ( ) const
inlineprotected

returns if python is busy (true)

◆ pythonDebugMode()

bool ito::AbstractDockWidget::pythonDebugMode ( ) const
inlineprotected

returns if python is in debug mode (true)

◆ pythonInWaitingMode()

bool ito::AbstractDockWidget::pythonInWaitingMode ( ) const
inlineprotected

returns if python is in waiting mode (true)

See also
m_pythonInWaitingMode

◆ pythonStateChanged

void ito::AbstractDockWidget::pythonStateChanged ( tPythonTransitions pyTransition)
virtualslot

slot invoked if python state changed. Sets the specific member variables according to the python transition.

Parameters
pyTransitionpythonTransition (type tPythonTransitions) defining the transition to the destination python state

◆ raiseAndActivate

void ito::AbstractDockWidget::raiseAndActivate ( )
slot

activates this dock widget or window and raises it on top of all opened windows

activates this dock widget or window and raises it on top of all opened windows (if possible)

Depending on the docking-state of this widget and its style (docking-widget or single-window), this widget is activated and if undocked raised on top of the window stack.

Returns
retOk

◆ setAdvancedWindowTitle

RetVal ito::AbstractDockWidget::setAdvancedWindowTitle ( QString newCompleteTitle = QString(),
bool prependToBasicTitle = true )
slot

changes the title of widget

If widget is docked or m_floatingStyle is not equal to floatingWindow, this widget always gets the title m_basicTitle. Otherwise its title is set to m_completeTitle. This member is either set to newCompleteTitle if prependToBasicTitle is equal to false, otherwise newCompleteTitle is prepended to m_basicTitle.

Parameters
newCompleteTitlenew complete title for this widget (e.g. containing filename and modification sign *)
prependToBasicTitletrue if member m_completeTitle should consist of newCompleteTitle + m_basicTitle, false if m_completeTitle is equal to newCompleteTitle
Returns
retOk

◆ setContentWidget()

void ito::AbstractDockWidget::setContentWidget ( QWidget * widget)
protected

sets any given QWidget as central widget of QMainWindow and inversely sets this QWidget's parent to the instance of QMainWindget

Parameters
widgetinstance of QWidget, which should be the central widget of this dock widget

◆ synchronizeTopLevelState()

void ito::AbstractDockWidget::synchronizeTopLevelState ( )

synchronizes the top level state of the dock widget with the floating settings of this abstract dock widget

If the floating style is floating window and the dock widget has been set as floated dock widget (e.g. by a restoreState method call) the dock widget is in the top level state, however it does not correspond to the desired undocked, main window style. This is synchronized and corrected by this function.

◆ undockWidget

void ito::AbstractDockWidget::undockWidget ( bool show_it = true)
slot

undocks this dockWidget.

If m_floatingStyle is equal to floatingWindow, then this widget is transformed into a single window with its own toolbar and menubar. All Icons are increased in size in order to have the single-window-look.

◆ updateActions()

virtual void ito::AbstractDockWidget::updateActions ( )
inlineprotectedvirtual

◆ updatePythonActions()

virtual void ito::AbstractDockWidget::updatePythonActions ( )
protectedpure virtual

Implemented in ito::BookmarkDockWidget.

Member Data Documentation

◆ m_basicTitle

QString ito::AbstractDockWidget::m_basicTitle
private

basic title for this instance, shown if dock widget is docked

◆ m_completeTitle

QString ito::AbstractDockWidget::m_completeTitle
private

complete title for this instance, shown if dock widget is undocked

◆ m_dockAvailable

bool ito::AbstractDockWidget::m_dockAvailable
private

flag indicating whether docking functionality is available (true)

◆ m_docked

bool ito::AbstractDockWidget::m_docked
private

flag indicating whether this instance is docked (true) or not (false)

◆ m_floatingStyle

tFloatingStyle ito::AbstractDockWidget::m_floatingStyle
private

floating style of dock widget

See also
tFloatingStyle

◆ m_movingStyle

tMovingStyle ito::AbstractDockWidget::m_movingStyle
private

moving style of dock widget

See also
tMovingStyle

◆ m_overallParent

QWidget* ito::AbstractDockWidget::m_overallParent
private

parent given by constructor, which is the parent of both the dock widget and the main window in floating mode

◆ m_pythonBusy

bool ito::AbstractDockWidget::m_pythonBusy
private

if true, python is busy right now

◆ m_pythonDebugMode

bool ito::AbstractDockWidget::m_pythonDebugMode
private

if true, python is in debug mode right now

◆ m_pythonInWaitingMode

bool ito::AbstractDockWidget::m_pythonInWaitingMode
private

if true, python is in debug mode but waiting for next user command (e.g. the debugger waits at a breakpoint)

◆ m_toolBars

QMap<QString,QToolBar*> ito::AbstractDockWidget::m_toolBars
private

map of different toolbars, which are shown in undocked version with bigger icon sizes comparing to docked version


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