OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
WUIQtWidgetBase Class Referenceabstract

Implementation of WUIWidgetBase. More...

#include <WUIQtWidgetBase.h>

+ Inheritance diagram for WUIQtWidgetBase:
+ Collaboration diagram for WUIQtWidgetBase:

Public Types

typedef std::shared_ptr< WUIQtWidgetBaseSPtr
 Convenience typedef for a std::shared_ptr< WUIQtWidgetBase >. More...
 
typedef std::shared_ptr< const WUIQtWidgetBaseConstSPtr
 Convenience typedef for a std::shared_ptr< const WUIQtWidgetBase >. More...
 

Public Member Functions

 WUIQtWidgetBase (WMainWindow *mainWindow, WUIQtWidgetBase::SPtr parent)
 Default constructor. More...
 
virtual ~WUIQtWidgetBase ()
 Destructor. More...
 
virtual QString getTitleQString () const =0
 The title as QString. More...
 
virtual bool isReal ()
 The widget was created and can be used. More...
 
virtual void show ()
 Show this widget if not yet visible. More...
 
virtual void setVisible (bool visible=true)
 Hide/show this widget. More...
 
virtual bool isVisible () const
 Check if the widget is hidden or not. More...
 
virtual void realize (WCondition::SPtr abortCondition=WCondition::SPtr())
 Realize the widget. More...
 
virtual void close ()=0
 Handle shutdown. More...
 
QWidget * getWidget () const
 Get the widget representation. More...
 
QWidget * getParentAsQtWidget () const
 Get the parent as Qt widget. More...
 
WUIQtWidgetBase::SPtr getQtParent () const
 Parent widget. More...
 
virtual void addAction (WPropGroup group, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 
virtual void addAction (WPropTrigger trigger, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 
virtual void addAction (WPropBool toggle, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 

Protected Member Functions

virtual void realizeImpl ()=0
 Realize the widget. More...
 
virtual void showGT ()
 Show this widget if not yet visible. More...
 
virtual void setVisibleGT (bool visible=true)
 Hide/show this widget. More...
 
virtual bool isVisibleGT () const
 Check if the widget is hidden or not. More...
 
virtual void closeImpl ()
 Close the widget. More...
 
virtual void closeGT ()
 Close the widget. More...
 
virtual void cleanUpGT ()=0
 Cleanup the GUI. More...
 
QWidget * getCompellingQParent () const
 Returns the parent to use for your implementation in realizeImpl. More...
 
bool hasUIParent () const
 Check if the widget is embedded into another WUI widget. More...
 
QWidget * embedContent (QWidget *content)
 This method can be used if you just create some QWidget and do not want to take care about embedding the content in a dock if there is no parent, setting size constraints and similar. More...
 
virtual void addActionGroupGT (WPropGroup group, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 
virtual void addActionTriggerGT (WPropTrigger trigger, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 
virtual void addActionBoolGT (WPropBool toggle, WGEImage::SPtr icon=WGEImage::SPtr())
 Implement WUIWidgetBase::addAction. More...
 

Protected Attributes

WMainWindowm_mainWindow
 The main window instance. More...
 
QWidget * m_widget
 The widget representing this abstract UI element. More...
 
WUIQtWidgetBase::SPtr m_parent
 Parent widget. More...
 

Private Member Functions

void realizeGT ()
 Forwards call from a boost function to the virtual realizeImpl method. More...
 
WQtDockWidgetasDockWidget ()
 Returns m_widget as WQtDockWidget if possible. More...
 

Detailed Description

Implementation of WUIWidgetBase.

Not really. It is an base class for all WUIWidgetBase implementations to comfortably allow thread-save GUI ops.

Definition at line 39 of file WUIQtWidgetBase.h.

Member Typedef Documentation

◆ ConstSPtr

typedef std::shared_ptr< const WUIQtWidgetBase > WUIQtWidgetBase::ConstSPtr

Convenience typedef for a std::shared_ptr< const WUIQtWidgetBase >.

Definition at line 50 of file WUIQtWidgetBase.h.

◆ SPtr

typedef std::shared_ptr< WUIQtWidgetBase > WUIQtWidgetBase::SPtr

Convenience typedef for a std::shared_ptr< WUIQtWidgetBase >.

Definition at line 45 of file WUIQtWidgetBase.h.

Constructor & Destructor Documentation

◆ WUIQtWidgetBase()

WUIQtWidgetBase::WUIQtWidgetBase ( WMainWindow mainWindow,
WUIQtWidgetBase::SPtr  parent 
)

Default constructor.

Parameters
mainWindowthe main window instance
parentthe parent widget. Can be NULL.

Definition at line 34 of file WUIQtWidgetBase.cpp.

◆ ~WUIQtWidgetBase()

WUIQtWidgetBase::~WUIQtWidgetBase ( )
virtual

Destructor.

Definition at line 42 of file WUIQtWidgetBase.cpp.

References m_widget.

Member Function Documentation

◆ addAction() [1/3]

void WUIQtWidgetBase::addAction ( WPropBool  toggle,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
virtual

Implement WUIWidgetBase::addAction.

Parameters
togglethe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 257 of file WUIQtWidgetBase.cpp.

References addActionBoolGT(), and WQtGui::execInGUIThread().

+ Here is the call graph for this function:

◆ addAction() [2/3]

void WUIQtWidgetBase::addAction ( WPropGroup  group,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
virtual

Implement WUIWidgetBase::addAction.

Parameters
groupthe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 245 of file WUIQtWidgetBase.cpp.

References addActionGroupGT(), and WQtGui::execInGUIThread().

Referenced by WUIQtGridWidget::addAction(), WUIQtPropertyGroupWidget::addAction(), WUIQtTabbedWidget::addAction(), and WUIQtViewWidget::addAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAction() [3/3]

void WUIQtWidgetBase::addAction ( WPropTrigger  trigger,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
virtual

Implement WUIWidgetBase::addAction.

Parameters
triggerthe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 251 of file WUIQtWidgetBase.cpp.

References addActionTriggerGT(), and WQtGui::execInGUIThread().

+ Here is the call graph for this function:

◆ addActionBoolGT()

void WUIQtWidgetBase::addActionBoolGT ( WPropBool  toggle,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
protectedvirtual

Implement WUIWidgetBase::addAction.

Parameters
togglethe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Definition at line 279 of file WUIQtWidgetBase.cpp.

References WQtDockWidget::addTitleProperty(), and asDockWidget().

Referenced by addAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addActionGroupGT()

void WUIQtWidgetBase::addActionGroupGT ( WPropGroup  group,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
protectedvirtual

Implement WUIWidgetBase::addAction.

Parameters
groupthe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Definition at line 263 of file WUIQtWidgetBase.cpp.

References WQtDockWidget::addTitleProperty(), and asDockWidget().

Referenced by addAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addActionTriggerGT()

void WUIQtWidgetBase::addActionTriggerGT ( WPropTrigger  trigger,
WGEImage::SPtr  icon = WGEImage::SPtr() 
)
protectedvirtual

Implement WUIWidgetBase::addAction.

Parameters
triggerthe property to use.
iconthe icon to use. Consider a minimum size of 32x32.

Definition at line 271 of file WUIQtWidgetBase.cpp.

References WQtDockWidget::addTitleProperty(), and asDockWidget().

Referenced by addAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asDockWidget()

WQtDockWidget * WUIQtWidgetBase::asDockWidget ( )
private

Returns m_widget as WQtDockWidget if possible.

NULL if not.

Returns
the dock or NULL

Definition at line 287 of file WUIQtWidgetBase.cpp.

References m_widget.

Referenced by addActionBoolGT(), addActionGroupGT(), and addActionTriggerGT().

+ Here is the caller graph for this function:

◆ cleanUpGT()

virtual void WUIQtWidgetBase::cleanUpGT ( )
protectedpure virtual

Cleanup the GUI.

Do not delete m_widget, or your content widget. This is done by WUIQtWidgetBase. This method allows you to free resources that are not automatically freed by the Qt delete mechanism.

Implemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Referenced by closeGT().

+ Here is the caller graph for this function:

◆ close()

virtual void WUIQtWidgetBase::close ( )
pure virtual

Handle shutdown.

This includes notification of the creating module and closing the widget. Can be called from any thread. Implement in your implementation.

Implemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

◆ closeGT()

void WUIQtWidgetBase::closeGT ( )
protectedvirtual

Close the widget.

When done, the widget can be safely deleted. Called in GUI Thread (GT).

Definition at line 139 of file WUIQtWidgetBase.cpp.

References cleanUpGT(), WMainWindow::deregisterCustomWidget(), WQtGui::getSettings(), m_mainWindow, and m_widget.

Referenced by closeImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeImpl()

void WUIQtWidgetBase::closeImpl ( )
protectedvirtual

Close the widget.

When done, the widget can be safely deleted.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 113 of file WUIQtWidgetBase.cpp.

References closeGT(), wlog::debug(), WQtGui::execInGUIThread(), getTitleQString(), and m_widget.

Referenced by WUIQtGridWidget::closeImpl(), WUIQtPropertyGroupWidget::closeImpl(), WUIQtTabbedWidget::closeImpl(), and WUIQtViewWidget::closeImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ embedContent()

QWidget * WUIQtWidgetBase::embedContent ( QWidget *  content)
protected

This method can be used if you just create some QWidget and do not want to take care about embedding the content in a dock if there is no parent, setting size constraints and similar.

This method handles this. It is also aware of QDckWidgets. This means it does not embed them if you create your own QDockWidgets. It then just sets the defaults and registers it at WMainWindow.

Parameters
contentyour widget to config and embed
Returns
the container (usually WQtDockWidget) or NULL if the content is used stand-alone.

Definition at line 177 of file WUIQtWidgetBase.cpp.

References getCompellingQParent(), WMainWindow::getDefaultCustomDockArea(), WMainWindow::getDefaultCustomDockAreaWidget(), WQtGui::getSettings(), getTitleQString(), hasUIParent(), m_mainWindow, and m_widget.

Referenced by WUIQtGridWidget::realizeImpl(), WUIQtPropertyGroupWidget::realizeImpl(), WUIQtTabbedWidget::realizeImpl(), and WUIQtViewWidget::realizeImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCompellingQParent()

QWidget * WUIQtWidgetBase::getCompellingQParent ( ) const
protected

Returns the parent to use for your implementation in realizeImpl.

It is important to understand that this always returns a parent, regardless of m_parent being NULL or not. This is the parent of your QWidget.

Returns
the parent

Definition at line 229 of file WUIQtWidgetBase.cpp.

References getParentAsQtWidget(), and m_mainWindow.

Referenced by embedContent(), WUIQtGridWidget::realizeImpl(), WUIQtPropertyGroupWidget::realizeImpl(), WUIQtTabbedWidget::realizeImpl(), and WUIQtViewWidget::realizeImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentAsQtWidget()

QWidget * WUIQtWidgetBase::getParentAsQtWidget ( ) const

Get the parent as Qt widget.

Can be NULL.

Returns
the parent

Definition at line 160 of file WUIQtWidgetBase.cpp.

References getQtParent().

Referenced by getCompellingQParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQtParent()

WUIQtWidgetBase::SPtr WUIQtWidgetBase::getQtParent ( ) const

Parent widget.

Can be NULL.

Returns
the parent

Definition at line 172 of file WUIQtWidgetBase.cpp.

References m_parent.

Referenced by getParentAsQtWidget(), hasUIParent(), and WUIQtViewWidget::realizeImpl().

+ Here is the caller graph for this function:

◆ getTitleQString()

virtual QString WUIQtWidgetBase::getTitleQString ( ) const
pure virtual

The title as QString.

Returns
the title.

Implemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Referenced by closeImpl(), and embedContent().

+ Here is the caller graph for this function:

◆ getWidget()

QWidget * WUIQtWidgetBase::getWidget ( ) const

Get the widget representation.

Can be NULL if not yet created.

Returns
the widget

Definition at line 155 of file WUIQtWidgetBase.cpp.

References m_widget.

Referenced by WUIQtTabbedWidget::addTabImpl(), and WUIQtGridWidget::placeWidgetImpl().

+ Here is the caller graph for this function:

◆ hasUIParent()

bool WUIQtWidgetBase::hasUIParent ( ) const
protected

Check if the widget is embedded into another WUI widget.

Returns
true if there is a WUIQtWidgetBase parent

Definition at line 240 of file WUIQtWidgetBase.cpp.

References getQtParent().

Referenced by embedContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isReal()

bool WUIQtWidgetBase::isReal ( )
virtual

The widget was created and can be used.

Returns
true if the widget is valid.

Definition at line 83 of file WUIQtWidgetBase.cpp.

References m_widget.

◆ isVisible()

bool WUIQtWidgetBase::isVisible ( ) const
virtual

Check if the widget is hidden or not.

Returns
true if visible.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 104 of file WUIQtWidgetBase.cpp.

References m_widget.

Referenced by WUIQtGridWidget::isVisible(), WUIQtPropertyGroupWidget::isVisible(), WUIQtTabbedWidget::isVisible(), and WUIQtViewWidget::isVisible().

+ Here is the caller graph for this function:

◆ isVisibleGT()

bool WUIQtWidgetBase::isVisibleGT ( ) const
protectedvirtual

Check if the widget is hidden or not.

Called in GUI Thread (GT).

Returns
true if visible.

Definition at line 134 of file WUIQtWidgetBase.cpp.

References m_widget.

◆ realize()

void WUIQtWidgetBase::realize ( WCondition::SPtr  abortCondition = WCondition::SPtr())
virtual

Realize the widget.

This method blocks until the GUI thread created the widget.

Parameters
abortConditiona condition enforcing abort of widget creation.

Definition at line 51 of file WUIQtWidgetBase.cpp.

References WConditionSet::add(), WQtGui::execInGUIThreadAsync(), realizeGT(), WConditionSet::setResetable(), and WConditionSet::wait().

+ Here is the call graph for this function:

◆ realizeGT()

void WUIQtWidgetBase::realizeGT ( )
private

Forwards call from a boost function to the virtual realizeImpl method.

Definition at line 73 of file WUIQtWidgetBase.cpp.

References m_mainWindow, m_parent, realizeImpl(), and WMainWindow::registerCustomWidget().

Referenced by realize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ realizeImpl()

virtual void WUIQtWidgetBase::realizeImpl ( )
protectedpure virtual

Realize the widget.

This method blocks until the GUI thread created the widget. Called from within the GUI thread! So you can safely do Qt stuff.

Implemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Referenced by realizeGT().

+ Here is the caller graph for this function:

◆ setVisible()

void WUIQtWidgetBase::setVisible ( bool  visible = true)
virtual

Hide/show this widget.

Unlike close(), you can show the widget again using show().

Parameters
visiblefalse to hide widget

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 96 of file WUIQtWidgetBase.cpp.

References WQtGui::execInGUIThread(), m_widget, and setVisibleGT().

Referenced by WUIQtGridWidget::setVisible(), WUIQtPropertyGroupWidget::setVisible(), WUIQtTabbedWidget::setVisible(), and WUIQtViewWidget::setVisible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setVisibleGT()

void WUIQtWidgetBase::setVisibleGT ( bool  visible = true)
protectedvirtual

Hide/show this widget.

Unlike close(), you can show the widget again using show(). Called in GUI Thread (GT).

Parameters
visiblefalse to hide widget

Definition at line 129 of file WUIQtWidgetBase.cpp.

References m_widget.

Referenced by setVisible().

+ Here is the caller graph for this function:

◆ show()

void WUIQtWidgetBase::show ( )
virtual

Show this widget if not yet visible.

Reimplemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.

Definition at line 88 of file WUIQtWidgetBase.cpp.

References WQtGui::execInGUIThread(), m_widget, and showGT().

Referenced by WUIQtGridWidget::show(), WUIQtPropertyGroupWidget::show(), WUIQtTabbedWidget::show(), and WUIQtViewWidget::show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showGT()

void WUIQtWidgetBase::showGT ( )
protectedvirtual

Show this widget if not yet visible.

Called in GUI Thread (GT).

Definition at line 124 of file WUIQtWidgetBase.cpp.

References m_widget.

Referenced by show().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_mainWindow

WMainWindow* WUIQtWidgetBase::m_mainWindow
protected

The main window instance.

Definition at line 200 of file WUIQtWidgetBase.h.

Referenced by closeGT(), embedContent(), getCompellingQParent(), and realizeGT().

◆ m_parent

WUIQtWidgetBase::SPtr WUIQtWidgetBase::m_parent
protected

Parent widget.

Can be NULL.

Definition at line 210 of file WUIQtWidgetBase.h.

Referenced by getQtParent(), and realizeGT().

◆ m_widget

QWidget* WUIQtWidgetBase::m_widget
protected

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