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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
#ifndef _KVI_TAL_GROUPBOX_H_
#define _KVI_TAL_GROUPBOX_H_
//=============================================================================
//
// File : KviTalGroupBox.h
// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
//
// This file is part of the KVIrc IRC client distribution
// Copyright (C) 2007-2010 Szymon Stefanek (pragma at kvirc dot net)
//
// 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.
//
// This program is distributed in the HOPE that it will be USEFUL,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================
/**
* \file KviTalGroupBox.h
* \author Szymon Stefanek
* \brief Class for groupbox
*/
#include "kvi_settings.h"
#include <QGroupBox>
#include <QLayout>
class QChildEvent;
/**
* \class KviTalGroupBox
* \brief Toolkit Abstraction Layer: groupbox class
*/
class KVILIB_API KviTalGroupBox : public QGroupBox
{
Q_OBJECT
public:
/**
* \brief Constructs the groupbox object
* \param pParent The parent object
* \param pcName the name of the groupbox
* \return KviTalGroupBox
*/
KviTalGroupBox(QWidget * pParent, char * pcName = nullptr);
/**
* \brief Constructs the groupbox object
* \param pParent The parent object
* \return KviTalGroupBox
*/
KviTalGroupBox(QWidget * pParent = nullptr);
/**
* \brief Constructs the groupbox object
* \param szTitle The title of the groupbox
* \param pParent The parent object
* \return KviTalGroupBox
*/
KviTalGroupBox(const QString & szTitle, QWidget * pParent = nullptr);
/**
* \brief Constructs the groupbox object
* \param orientation The orientation of the groupbox
* \param pParent The parent object
* \return KviTalGroupBox
*/
KviTalGroupBox(Qt::Orientation orientation, QWidget * pParent = nullptr);
/**
* \brief Constructs the groupbox object
* \param orientation The orientation of the groupbox
* \param szTitle The title of the groupbox
* \param pParent The parent object
* \return KviTalGroupBox
*/
KviTalGroupBox(Qt::Orientation orientation, const QString & szTitle, QWidget * pParent = nullptr);
/**
* \brief Destroys the groupbox object
*/
~KviTalGroupBox();
protected:
Qt::Orientation mOrientation;
QLayout * m_pLayout;
public:
/**
* \brief Sets the inside margin
* \param iMargin The margin in pixels
* \return void
*/
void setInsideMargin(int iMargin)
{
if(layout())
layout()->setContentsMargins(iMargin, iMargin, iMargin, iMargin);
};
/**
* \brief Sets the inside spacing
* \param iSpacing The spacing in pixels
* \return void
*/
void setInsideSpacing(int iSpacing)
{
if(layout())
layout()->setSpacing(iSpacing);
};
/**
* \brief Returns the inside margin
* \return int
*/
int insideMargin()
{
if(layout())
return layout()->contentsMargins().top();
return 0;
};
/**
* \brief Returns the inside spacing
* \return int
*/
int insideSpacing()
{
if(layout())
return layout()->spacing();
return 0;
};
/**
* \brief Adds a space
* \param iSpace The space in pixels
* \return void
*/
void addSpace(int iSpace);
/**
* \brief Sets the orientation
* \param orientation The orientation :)
* \return void
*/
void setOrientation(Qt::Orientation orientation);
/**
* \brief Sets a new layout
* \param newLayout The new layout
* \return void
*/
void setLayout(QLayout * newLayout);
protected:
void childEvent(QChildEvent * e) override;
};
#endif // _KVI_TAL_GROUPBOX_H_
|