/
qgsuserinputdockwidget.h
68 lines (53 loc) · 2.38 KB
/
qgsuserinputdockwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
qgsuserinputdockwidget.h
--------------------------------------
Date : 04.2015
Copyright : (C) 2015 Denis Rouzaud
Email : denis.rouzaud@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSUSERINPUTDOCKWIDGET_H
#define QGSUSERINPUTDOCKWIDGET_H
#include "qgsdockwidget.h"
#include <QMap>
class QFrame;
class QBoxLayout;
/** \ingroup gui
* @brief The QgsUserInputDockWidget class is a dock widget that shall be used to display widgets for user inputs.
* It can be used by map tools, plugins, etc.
* Several widgets can be displayed at once, they will be separated by a separator. Widgets will be either layout horizontally or vertically.
* The dock is automatically hidden if it contains no widget.
*/
class GUI_EXPORT QgsUserInputDockWidget : public QgsDockWidget
{
Q_OBJECT
public:
QgsUserInputDockWidget( QWidget* parent = nullptr );
~QgsUserInputDockWidget();
/** Add a widget to be displayed in the dock.
* @param widget widget to add. Ownership is not transferred.
*/
void addUserInputWidget( QWidget* widget );
protected:
// will not display the dock if it contains no widget
void paintEvent( QPaintEvent *event ) override;
private slots:
void widgetDestroyed( QObject* obj );
//! when area change, update the layout according to the new dock location
void areaChanged( Qt::DockWidgetArea area );
void floatingChanged( bool floating );
private:
//! change layout according to dock location
void updateLayoutDirection();
// list of widget with their corresponding line separator
QMap<QWidget*, QFrame*> mWidgetList;
bool mLayoutHorizontal;
QBoxLayout* mLayout;
};
#endif // QGSUSERINPUTDOCKWIDGET_H