OpenWalnut
1.5.0dev
|
Implementation of WUIWidgetBase. More...
#include <WUIQtWidgetBase.h>
Public Types | |
typedef std::shared_ptr< WUIQtWidgetBase > | SPtr |
Convenience typedef for a std::shared_ptr< WUIQtWidgetBase >. More... | |
typedef std::shared_ptr< const WUIQtWidgetBase > | ConstSPtr |
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 | |
WMainWindow * | m_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... | |
WQtDockWidget * | asDockWidget () |
Returns m_widget as WQtDockWidget if possible. More... | |
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.
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.
typedef std::shared_ptr< WUIQtWidgetBase > WUIQtWidgetBase::SPtr |
Convenience typedef for a std::shared_ptr< WUIQtWidgetBase >.
Definition at line 45 of file WUIQtWidgetBase.h.
WUIQtWidgetBase::WUIQtWidgetBase | ( | WMainWindow * | mainWindow, |
WUIQtWidgetBase::SPtr | parent | ||
) |
Default constructor.
mainWindow | the main window instance |
parent | the parent widget. Can be NULL. |
Definition at line 34 of file WUIQtWidgetBase.cpp.
|
virtual |
|
virtual |
Implement WUIWidgetBase::addAction.
toggle | the property to use. |
icon | the 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().
|
virtual |
Implement WUIWidgetBase::addAction.
group | the property to use. |
icon | the 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().
|
virtual |
Implement WUIWidgetBase::addAction.
trigger | the property to use. |
icon | the 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().
|
protectedvirtual |
Implement WUIWidgetBase::addAction.
toggle | the property to use. |
icon | the 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().
|
protectedvirtual |
Implement WUIWidgetBase::addAction.
group | the property to use. |
icon | the 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().
|
protectedvirtual |
Implement WUIWidgetBase::addAction.
trigger | the property to use. |
icon | the 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().
|
private |
Returns m_widget as WQtDockWidget if possible.
NULL if not.
Definition at line 287 of file WUIQtWidgetBase.cpp.
References m_widget.
Referenced by addActionBoolGT(), addActionGroupGT(), and addActionTriggerGT().
|
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().
|
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.
|
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().
|
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().
|
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.
content | your widget to config and embed |
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().
|
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.
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().
QWidget * WUIQtWidgetBase::getParentAsQtWidget | ( | ) | const |
Get the parent as Qt widget.
Can be NULL.
Definition at line 160 of file WUIQtWidgetBase.cpp.
References getQtParent().
Referenced by getCompellingQParent().
WUIQtWidgetBase::SPtr WUIQtWidgetBase::getQtParent | ( | ) | const |
Parent widget.
Can be NULL.
Definition at line 172 of file WUIQtWidgetBase.cpp.
References m_parent.
Referenced by getParentAsQtWidget(), hasUIParent(), and WUIQtViewWidget::realizeImpl().
|
pure virtual |
The title as QString.
Implemented in WUIQtViewWidget, WUIQtTabbedWidget, WUIQtPropertyGroupWidget, and WUIQtGridWidget.
Referenced by closeImpl(), and embedContent().
QWidget * WUIQtWidgetBase::getWidget | ( | ) | const |
Get the widget representation.
Can be NULL if not yet created.
Definition at line 155 of file WUIQtWidgetBase.cpp.
References m_widget.
Referenced by WUIQtTabbedWidget::addTabImpl(), and WUIQtGridWidget::placeWidgetImpl().
|
protected |
Check if the widget is embedded into another WUI widget.
Definition at line 240 of file WUIQtWidgetBase.cpp.
References getQtParent().
Referenced by embedContent().
|
virtual |
The widget was created and can be used.
Definition at line 83 of file WUIQtWidgetBase.cpp.
References m_widget.
|
virtual |
Check if the widget is hidden or not.
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().
|
protectedvirtual |
Check if the widget is hidden or not.
Called in GUI Thread (GT).
Definition at line 134 of file WUIQtWidgetBase.cpp.
References m_widget.
|
virtual |
Realize the widget.
This method blocks until the GUI thread created the widget.
abortCondition | a 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().
|
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().
|
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().
|
virtual |
Hide/show this widget.
Unlike close(), you can show the widget again using show().
visible | false 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().
|
protectedvirtual |
Hide/show this widget.
Unlike close(), you can show the widget again using show(). Called in GUI Thread (GT).
visible | false to hide widget |
Definition at line 129 of file WUIQtWidgetBase.cpp.
References m_widget.
Referenced by setVisible().
|
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().
|
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().
|
protected |
The main window instance.
Definition at line 200 of file WUIQtWidgetBase.h.
Referenced by closeGT(), embedContent(), getCompellingQParent(), and realizeGT().
|
protected |
Parent widget.
Can be NULL.
Definition at line 210 of file WUIQtWidgetBase.h.
Referenced by getQtParent(), and realizeGT().
|
protected |
The widget representing this abstract UI element.
Definition at line 205 of file WUIQtWidgetBase.h.
Referenced by asDockWidget(), closeGT(), closeImpl(), embedContent(), getWidget(), isReal(), isVisible(), isVisibleGT(), WUIQtGridWidget::realizeImpl(), setVisible(), setVisibleGT(), show(), showGT(), and ~WUIQtWidgetBase().