casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
casa::QCloseableWidget Class Reference

Wrapper around a QWidget with a "Close" button. More...

#include <QCloseableWidget.qo.h>

Inheritance diagram for casa::QCloseableWidget:

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...
 

Detailed Description

Wrapper around a QWidget with a "Close" button.

Synopsis

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.

Constructor & Destructor Documentation

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 ( )

Member Function Documentation

void casa::QCloseableWidget::clearWidget ( )

"Clears" the current widget by replacing it with a blank widget.

This method does delete the old widget.

void casa::QCloseableWidget::closeRequest ( )
privateslot

Slot to handle the "Close" button's clicked() signal.

Emits the closeRequested() signal.

void casa::QCloseableWidget::closeRequested ( QWidget *  widget)
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.

void casa::QCloseableWidget::setup ( )
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.

Member Data Documentation

QWidget* casa::QCloseableWidget::currWidget
private

The current widget held by the wrapper.

Definition at line 92 of file QCloseableWidget.qo.h.

QGridLayout* casa::QCloseableWidget::grid
private

Convenience pointer to the layout of this QCloseableWidget.

Definition at line 89 of file QCloseableWidget.qo.h.


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