![]() |
Workspace 6.21.5
|
Provides a floating window which keeps its title synchronized with its source. More...
#include <Workspace/Widgets/widgetwindow.h>
Inherits QWidget.
Signals | |
void | shortcutPressed (CSIRO::Widgets::WidgetWindow *toggleWidget) |
Public Member Functions | |
WidgetWindow (DataExecution::IOBase &iobase, QWidget *parent=nullptr) | |
~WidgetWindow () override | |
void | focusInEvent (QFocusEvent *event) override |
DataExecution::IOBase & | getIOBase () |
QWidget * | getWidget () |
void | keyPressEvent (QKeyEvent *event) override |
bool | loadWidgetProperties (const DataExecution::SerializedItem &item) |
void | recreateWidget () |
bool | saveWidgetProperties (DataExecution::SerializedItem &item) const |
void | setAdaptType (QString adaptType) |
void | setWidget (QWidget *w) |
QWidget * | takeWidget () |
The widget is meant to be used as a wrapper around a widget that is attached to an input or output in the workspace. It takes care of keeping the widget in sync with the input/output, ensuring that the window title is updated if the name of the input/output changes and recreating the widget if the input/output changes data type.
Because these widgets tend to be used as floating windows, they have their Qt::WA_DeleteOnClose attribute set by default.
WidgetWindow | ( | DataExecution::IOBase & | iobase, |
QWidget * | parent = nullptr |
||
) |
iobase | The input/output this window will be displaying. The title of the window will be updated whenever the name of this input/output changes |
parent | The parent widget of this window. This will normally be null, since widget windows are usually top level windows. It is for this reason that WidgetWindow is created with its Qt::WA_DeleteOnClose attribute set. |
|
override |
|
override |
DataExecution::IOBase & getIOBase | ( | ) |
QWidget * getWidget | ( | ) |
|
override |
bool loadWidgetProperties | ( | const DataExecution::SerializedItem & | item | ) |
item | The parent item from which we are loading widget properties. |
Loads custom properties into the contained widget. This can be used to load widget properties from a Workspace file.
void recreateWidget | ( | ) |
This function forces the widget currently held by this widget window to be deleted and a new one created in its place. This is most useful after the data type of the input/output the widget window is associated with is changed, such as for a polymorphic operation whose inputs and outputs change data type to match. It will create the input/output's preferred widget type if one is set.
bool saveWidgetProperties | ( | DataExecution::SerializedItem & | item | ) | const |
item | The parent item under which we are saving widget properties. |
Saves the custom properties of the contained widget into a SerializedItem. This can then be used to save widget properties with a Workspace file.
void setAdaptType | ( | QString | adaptType | ) |
void setWidget | ( | QWidget * | w | ) |
w | The new child widget, or a null pointer if the window should hold no widget (this would normally be a transitional state before eventually setting the widget to something). |
When this function is called, it deletes the currently held widget (if set) and also the current layout. It will then create a new layout and add w to it.
|
signal |
QWidget * takeWidget | ( | ) |
Takes back ownership of the currently held widget. The WidgetWindow will no longer try to delete the child widget when the window object is deleted.