1
//=============================================================================
3
// File : KviTalGroupBox.cpp
4
// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
6
// This file is part of the KVIrc irc client distribution
7
// Copyright (C) 2007-2010 Szymon Stefanek (pragma at kvirc dot net)
9
// This program is FREE software. You can redistribute it and/or
10
// modify it under the terms of the GNU General Public License
11
// as published by the Free Software Foundation; either version 2
12
// of the License, or (at your opinion) any later version.
14
// This program is distributed in the HOPE that it will be USEFUL,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
// See the GNU General Public License for more details.
19
// You should have received a copy of the GNU General Public License
20
// along with this program. If not, write to the Free Software Foundation,
21
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
//=============================================================================
25
#include "KviTalGroupBox.h"
27
#include <QChildEvent>
30
KviTalGroupBox::KviTalGroupBox(QWidget * pParent, char * pcName)
33
setObjectName(pcName);
34
m_pLayout = new QHBoxLayout(this);
35
QGroupBox::setLayout(m_pLayout);
38
KviTalGroupBox::KviTalGroupBox(QWidget * pParent)
44
KviTalGroupBox::KviTalGroupBox(const QString & szTitle, QWidget * pParent)
45
: QGroupBox(szTitle,pParent)
50
KviTalGroupBox::KviTalGroupBox(Qt::Orientation orientation, QWidget * pParent)
53
if(orientation == Qt::Vertical)
54
m_pLayout = new QHBoxLayout(this);
56
m_pLayout = new QVBoxLayout(this);
57
QGroupBox::setLayout(m_pLayout);
60
KviTalGroupBox::KviTalGroupBox(Qt::Orientation orientation, const QString & szTitle, QWidget * pParent)
61
: QGroupBox(szTitle,pParent)
63
mOrientation = orientation;
64
if(orientation == Qt::Vertical)
65
m_pLayout = new QHBoxLayout(this);
67
m_pLayout = new QVBoxLayout(this);
68
QGroupBox::setLayout(m_pLayout);
71
KviTalGroupBox::~KviTalGroupBox()
75
void KviTalGroupBox::childEvent(QChildEvent * e)
77
if(!e->child()->isWidgetType())
79
if(e->child()->parent() != this)
83
if(m_pLayout != layout())
88
case QEvent::ChildAdded:
89
m_pLayout->addWidget((QWidget *)(e->child()));
91
case QEvent::ChildRemoved:
92
m_pLayout->removeWidget((QWidget *)(e->child()));
99
void KviTalGroupBox::addSpace(int iSpace)
101
if(m_pLayout && m_pLayout==layout())
103
if(mOrientation == Qt::Vertical)
104
((QHBoxLayout*)m_pLayout)->addSpacing(iSpace);
106
((QVBoxLayout*)m_pLayout)->addSpacing(iSpace);
110
void KviTalGroupBox::setOrientation(Qt::Orientation orientation)
118
mOrientation = orientation;
120
if(orientation == Qt::Vertical)
121
m_pLayout = new QHBoxLayout(this);
123
m_pLayout = new QVBoxLayout(this);
124
QGroupBox::setLayout(m_pLayout);
127
void KviTalGroupBox::setLayout(QLayout * layout)
135
QGroupBox::setLayout(layout);
138
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
139
#include "KviTalGroupBox.moc"
140
#endif //COMPILE_USE_STANDALONE_MOC_SOURCES