2016-07-07 09:22:30 +10:00
|
|
|
/**
|
|
|
|
* A stack widget to manage panels in the interface. Handles the open and close events
|
|
|
|
* for added panels.
|
|
|
|
* Any widgets that want to have a non blocking panel based interface should use this
|
|
|
|
* class to manage the panels.
|
|
|
|
*/
|
|
|
|
class QgsPanelWidgetStack: public QWidget
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgspanelwidgetstack.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A stack widget to manage panels in the interface. Handles the open and close events
|
|
|
|
* for added panels.
|
|
|
|
* @param parent
|
|
|
|
*/
|
2017-05-02 07:21:20 +02:00
|
|
|
QgsPanelWidgetStack( QWidget *parent = 0 );
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
/**
|
2016-10-06 07:15:45 +10:00
|
|
|
* Adds the main panel widget to the stack and selects it for the user
|
2016-07-07 09:22:30 +10:00
|
|
|
* The main widget can not be closed and only the showPanel signal is attached
|
|
|
|
* to handle children widget opening panels.
|
|
|
|
* @param panel The panel to set as the first widget in the stack.
|
2016-10-06 07:15:45 +10:00
|
|
|
* @note a stack can have only one main panel. Any existing main panel
|
|
|
|
* should be removed by first calling takeMainPanel().
|
|
|
|
* @see mainPanel()
|
|
|
|
* @see takeMainPanel()
|
2016-07-07 09:22:30 +10:00
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void setMainPanel( QgsPanelWidget *panel );
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
/**
|
2016-10-06 07:15:45 +10:00
|
|
|
* The main panel widget that is set in the stack. The main widget can not be closed
|
2016-07-07 09:22:30 +10:00
|
|
|
* and doesn't display a back button.
|
|
|
|
* @return The main QgsPanelWidget that is active in the stack.
|
2016-10-06 07:15:45 +10:00
|
|
|
* @see setMainPanel()
|
2016-07-07 09:22:30 +10:00
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPanelWidget *mainPanel();
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
/**
|
2016-10-06 07:15:45 +10:00
|
|
|
* Removes the main panel widget from the stack and transfers ownsership to the
|
2016-07-07 09:22:30 +10:00
|
|
|
* caller.
|
|
|
|
* @return The main widget that is set in the stack.
|
2016-10-06 07:15:45 +10:00
|
|
|
* @see mainPanel()
|
|
|
|
* @see setMainPanel()
|
2016-07-07 09:22:30 +10:00
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPanelWidget *takeMainPanel();
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the stack of all widgets. Unless the panels autoDelete is set to false
|
|
|
|
* the widget will be deleted.
|
|
|
|
*/
|
|
|
|
void clear();
|
|
|
|
|
2016-10-06 08:09:54 +10:00
|
|
|
/**
|
|
|
|
* Returns the panel currently shown in the stack.
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPanelWidget *currentPanel();
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
/**
|
|
|
|
* Accept the current active widget in the stack.
|
|
|
|
*
|
|
|
|
* Calls the panelAccepeted signal on the active widget.
|
2016-10-06 08:09:54 +10:00
|
|
|
* @see acceptAllPanels()
|
2016-07-07 09:22:30 +10:00
|
|
|
*/
|
|
|
|
void acceptCurrentPanel();
|
|
|
|
|
2016-10-06 08:09:54 +10:00
|
|
|
/**
|
|
|
|
* Accepts all panel widgets open in the stack in turn until until only the mainPanel()
|
|
|
|
* remains.
|
|
|
|
* @see acceptCurrentPanel();
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
void acceptAllPanels();
|
|
|
|
|
2016-07-07 09:22:30 +10:00
|
|
|
/**
|
|
|
|
* Show a panel in the stack widget. Will connect to the panels showPanel event to handle
|
|
|
|
* nested panels. Auto switches the the given panel for the user.
|
|
|
|
* @param panel The panel to show.
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void showPanel( QgsPanelWidget *panel );
|
2016-07-07 09:22:30 +10:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the panel in the widget. Will also delete the widget.
|
|
|
|
* This slot is normally auto connected to panelAccepted when a panel is shown.
|
|
|
|
* @param panel The panel to close.
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void closePanel( QgsPanelWidget *panel );
|
2017-03-17 13:55:31 +10:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void mouseReleaseEvent( QMouseEvent *e );
|
|
|
|
|
2016-07-07 09:22:30 +10:00
|
|
|
};
|