OpenWalnut
1.5.0dev
|
Base class for all items in the control panel tree. More...
#include <WQtTreeItem.h>
Public Slots | |
void | update () |
Gets called by m_updateTimer in some interval to update the item state, basing on the state of m_module. More... | |
Public Member Functions | |
WQtTreeItem (QTreeWidgetItem *parent, WTreeItemType type, std::shared_ptr< WModule > module) | |
Constructor creates an empty item. More... | |
virtual | ~WQtTreeItem () |
Destructor. More... | |
WModule::SPtr | getModule () |
Get for the module pointer. More... | |
std::string | getName () |
Returns the name used for this tree item. More... | |
virtual void | gotRemoved () |
Gets called by the GUI whenever the module was removed from the root container and should now be deleted. More... | |
std::string | getHandledInput () const |
The name of the input represented by this item. More... | |
void | setHandledInput (std::string in) |
Sets the name of the input represented by this item. More... | |
std::string | getHandledOutput () const |
The name of the output represented by this item. More... | |
void | setHandledOutput (std::string out) |
Sets the name of the output represented by this item. More... | |
virtual void | handleCheckStateChange () |
Handle changes in check state. More... | |
Static Public Member Functions | |
static std::string | createTooltip (WModule::SPtr module) |
Create tooltip for a given module. More... | |
Protected Member Functions | |
virtual void | updateState () |
Updates the state of the tree item basing on the module's state. More... | |
Protected Attributes | |
std::shared_ptr< QTimer > | m_updateTimer |
Updates this item in regular intervals. More... | |
std::string | m_name |
Name of the tree item. More... | |
bool | m_deleteInProgress |
True if the treeitem and the module gets deleted currently. More... | |
bool | m_needPostDeleteEvent |
True if no delete event has been posted yet. More... | |
WPropString | m_nameProp |
The property containing the name of the module. More... | |
std::string | m_handledInput |
The name of the input connector represented by this item. More... | |
std::string | m_handledOutput |
The output name handled by this item. More... | |
Private Member Functions | |
void | nameChanged () |
Called when the name property changes. More... | |
void | slotDataChanged (std::shared_ptr< WModuleConnector > connector) |
Called on output-connector update. More... | |
Private Attributes | |
std::shared_ptr< WModule > | m_module |
The module represented by this tree item. More... | |
std::vector< boost::signals2::connection > | m_outputUpdateConnections |
The output connector update connections. More... | |
Base class for all items in the control panel tree.
Definition at line 43 of file WQtTreeItem.h.
WQtTreeItem::WQtTreeItem | ( | QTreeWidgetItem * | parent, |
WTreeItemType | type, | ||
std::shared_ptr< WModule > | module | ||
) |
Constructor creates an empty item.
parent | The widget managing this widget |
module | The represented module |
type | the type used for the treeitem. Used to identify the items. |
Definition at line 48 of file WQtTreeItem.cpp.
References m_module, m_name, m_nameProp, m_outputUpdateConnections, m_updateTimer, nameChanged(), slotDataChanged(), and update().
|
virtual |
|
static |
Create tooltip for a given module.
This can be used by all the widgets needing a tooltip for a module.
module | the module to create the tooltip for |
Definition at line 119 of file WQtTreeItem.cpp.
Referenced by WQtNetworkItem::updater(), and updateState().
std::string WQtTreeItem::getHandledInput | ( | ) | const |
The name of the input represented by this item.
Definition at line 280 of file WQtTreeItem.cpp.
References m_handledInput.
std::string WQtTreeItem::getHandledOutput | ( | ) | const |
The name of the output represented by this item.
Definition at line 290 of file WQtTreeItem.cpp.
References m_handledOutput.
std::shared_ptr< WModule > WQtTreeItem::getModule | ( | ) |
Get for the module pointer.
Definition at line 109 of file WQtTreeItem.cpp.
References m_module.
Referenced by WQtControlPanel::deleteModule(), WQtControlPanel::event(), WQtNetworkEditor::event(), WQtControlPanel::findItemsByModule(), and WQtControlPanel::getSelectedModule().
std::string WQtTreeItem::getName | ( | ) |
Returns the name used for this tree item.
Definition at line 114 of file WQtTreeItem.cpp.
References m_name.
|
virtual |
Gets called by the GUI whenever the module was removed from the root container and should now be deleted.
Definition at line 266 of file WQtTreeItem.cpp.
References m_deleteInProgress.
|
virtual |
Handle changes in check state.
Definition at line 300 of file WQtTreeItem.cpp.
References m_module.
Referenced by WQtControlPanel::changeTreeItem().
|
private |
Called when the name property changes.
Definition at line 274 of file WQtTreeItem.cpp.
References m_name, and m_nameProp.
Referenced by WQtTreeItem().
void WQtTreeItem::setHandledInput | ( | std::string | in | ) |
Sets the name of the input represented by this item.
in | the input name. |
Definition at line 285 of file WQtTreeItem.cpp.
References m_handledInput.
void WQtTreeItem::setHandledOutput | ( | std::string | out | ) |
Sets the name of the output represented by this item.
out | the output name. |
Definition at line 295 of file WQtTreeItem.cpp.
References m_handledOutput.
|
private |
Called on output-connector update.
connector | the connector that was updated. |
Definition at line 165 of file WQtTreeItem.cpp.
References WQtGui::getMainWindow(), and m_module.
Referenced by WQtTreeItem().
|
slot |
Gets called by m_updateTimer in some interval to update the item state, basing on the state of m_module.
Definition at line 171 of file WQtTreeItem.cpp.
References updateState().
Referenced by WQtTreeItem().
|
protectedvirtual |
Updates the state of the tree item basing on the module's state.
Definition at line 176 of file WQtTreeItem.cpp.
References createTooltip(), WQtGui::getMainWindow(), m_deleteInProgress, m_handledInput, m_handledOutput, m_module, m_name, and m_needPostDeleteEvent.
Referenced by update().
|
protected |
True if the treeitem and the module gets deleted currently.
Definition at line 149 of file WQtTreeItem.h.
Referenced by gotRemoved(), and updateState().
|
protected |
The name of the input connector represented by this item.
Definition at line 164 of file WQtTreeItem.h.
Referenced by getHandledInput(), setHandledInput(), and updateState().
|
protected |
The output name handled by this item.
Definition at line 169 of file WQtTreeItem.h.
Referenced by getHandledOutput(), setHandledOutput(), and updateState().
|
private |
The module represented by this tree item.
Definition at line 175 of file WQtTreeItem.h.
Referenced by getModule(), handleCheckStateChange(), slotDataChanged(), updateState(), and WQtTreeItem().
|
protected |
Name of the tree item.
Definition at line 144 of file WQtTreeItem.h.
Referenced by getName(), nameChanged(), updateState(), and WQtTreeItem().
|
protected |
The property containing the name of the module.
Definition at line 159 of file WQtTreeItem.h.
Referenced by nameChanged(), and WQtTreeItem().
|
protected |
True if no delete event has been posted yet.
Definition at line 154 of file WQtTreeItem.h.
Referenced by updateState().
|
private |
The output connector update connections.
The NEED to be disconnected on destruction manually!
Definition at line 185 of file WQtTreeItem.h.
Referenced by WQtTreeItem(), and ~WQtTreeItem().
|
protected |
Updates this item in regular intervals.
Definition at line 139 of file WQtTreeItem.h.
Referenced by WQtTreeItem().