casa
5.7.0-16
|
Wrapper around a QWidget with a "Close" button. More...
#include <QCloseableWidget.qo.h>
Signals | |
void | closeRequested (QWidget *widget) |
The closeRequested signal is emitted whenever the "Close" button is pressed. More... | |
Public Member Functions | |
QCloseableWidget () | |
Default Constructor. More... | |
QCloseableWidget (QWidget *widget, casacore::String closeText="") | |
Constructor that takes the initial widget to display and the text for the close button. More... | |
~QCloseableWidget () | |
QWidget * | getCurrentWidget () |
Returns the current widget held by the wrapper. More... | |
void | setWidget (QWidget *widget, bool shouldDeleteOld=false) |
Sets the current widget to the given widget. More... | |
void | setCloseButtonText (casacore::String name) |
Sets the text on the "close" button to the given String. More... | |
void | clearWidget () |
"Clears" the current widget by replacing it with a blank widget. More... | |
Private Slots | |
void | closeRequest () |
Slot to handle the "Close" button's clicked() signal. More... | |
Private Member Functions | |
void | setup () |
Initial set-up of GUI components. More... | |
Private Attributes | |
QGridLayout * | grid |
Convenience pointer to the layout of this QCloseableWidget. More... | |
QWidget * | currWidget |
The current widget held by the wrapper. More... | |
Wrapper around a QWidget with a "Close" button.
A QCloseableWidget is a convenience class that adds a "close" functionality to any QWidget subclass. It does this by providing methods (such as getting, setting, and clearing the QWidget) and signals indicating when the close button has been pressed. Important: it is the responsibility of the caller/parent to actually close the object; the QCloseableWidget just provides the signal.
Definition at line 51 of file QCloseableWidget.qo.h.
casa::QCloseableWidget::QCloseableWidget | ( | ) |
Default Constructor.
Creates a blank widget with a close button.
casa::QCloseableWidget::QCloseableWidget | ( | QWidget * | widget, |
casacore::String | closeText = "" |
||
) |
Constructor that takes the initial widget to display and the text for the close button.
If the text is empty, the default close button text is displayed.
casa::QCloseableWidget::~QCloseableWidget | ( | ) |
void casa::QCloseableWidget::clearWidget | ( | ) |
"Clears" the current widget by replacing it with a blank widget.
This method does delete the old widget.
|
privateslot |
Slot to handle the "Close" button's clicked() signal.
Emits the closeRequested() signal.
|
signal |
The closeRequested signal is emitted whenever the "Close" button is pressed.
The widget paramater points to the currently shown widget, or NULL if there is none.
QWidget* casa::QCloseableWidget::getCurrentWidget | ( | ) |
Returns the current widget held by the wrapper.
void casa::QCloseableWidget::setCloseButtonText | ( | casacore::String | name | ) |
Sets the text on the "close" button to the given String.
|
private |
Initial set-up of GUI components.
void casa::QCloseableWidget::setWidget | ( | QWidget * | widget, |
bool | shouldDeleteOld = false |
||
) |
Sets the current widget to the given widget.
If shouldDeleteOld is true, the old widget held by the wrapper is deleted.
|
private |
The current widget held by the wrapper.
Definition at line 92 of file QCloseableWidget.qo.h.
|
private |
Convenience pointer to the layout of this QCloseableWidget.
Definition at line 89 of file QCloseableWidget.qo.h.