DockSplitter.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Qt Advanced Docking System
3 ** Copyright (C) 2017 Uwe Kindler
4 **
5 ** This library is free software; you can redistribute it and/or
6 ** modify it under the terms of the GNU Lesser General Public
7 ** License as published by the Free Software Foundation; either
8 ** version 2.1 of the License, or (at your option) any later version.
9 **
10 ** This library is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ** Lesser General Public License for more details.
14 **
15 ** You should have received a copy of the GNU Lesser General Public
16 ** License along with this library; If not, see <http://www.gnu.org/licenses/>.
17 ******************************************************************************/
18 
19 
20 //============================================================================
25 //============================================================================
26 
27 //============================================================================
28 // INCLUDES
29 //============================================================================
30 #include "DockSplitter.h"
31 
32 #include <QDebug>
33 #include <QChildEvent>
34 
35 #include "DockAreaWidget.h"
36 
37 namespace ads
38 {
43 {
46 
47  DockSplitterPrivate(CDockSplitter* _public) : _this(_public) {}
48 };
49 
50 //============================================================================
52  : QSplitter(parent),
53  d(new DockSplitterPrivate(this))
54 {
55  setProperty("ads-splitter", true);
56  setChildrenCollapsible(false);
57 }
58 
59 
60 //============================================================================
61 CDockSplitter::CDockSplitter(Qt::Orientation orientation, QWidget *parent)
62  : QSplitter(orientation, parent),
63  d(new DockSplitterPrivate(this))
64 {
65 
66 }
67 
68 //============================================================================
70 {
71  ADS_PRINT("~CDockSplitter");
72  delete d;
73 }
74 
75 
76 //============================================================================
78 {
79  // TODO Cache or precalculate this to speed up
80  for (int i = 0; i < count(); ++i)
81  {
82  if (!widget(i)->isHidden())
83  {
84  return true;
85  }
86  }
87 
88  return false;
89 }
90 
91 
92 //============================================================================
94 {
95  return (count() > 0) ? widget(0) : nullptr;
96 }
97 
98 
99 //============================================================================
101 {
102  return (count() > 0) ? widget(count() - 1) : nullptr;
103 }
104 
105 //============================================================================
107 {
108  for (auto area : findChildren<CDockAreaWidget*>())
109  {
110  if(area->isCentralWidgetArea())
111  {
112  return true;
113  }
114  }
115 
116  return false;
117 }
118 
119 } // namespace ads
120 
121 //---------------------------------------------------------------------------
122 // EOF DockSplitter.cpp
DockSplitter.h
Declaration of CDockSplitter.
ads::DockSplitterPrivate
Definition: DockSplitter.cpp:42
ads::CDockSplitter::lastWidget
QWidget * lastWidget() const
Definition: DockSplitter.cpp:100
ads::DockSplitterPrivate::DockSplitterPrivate
DockSplitterPrivate(CDockSplitter *_public)
Definition: DockSplitter.cpp:47
ads::DockSplitterPrivate::_this
CDockSplitter * _this
Definition: DockSplitter.cpp:44
ads::CDockSplitter::d
DockSplitterPrivate * d
Definition: DockSplitter.h:48
ads
Definition: ads_globals.h:69
ads::CDockSplitter
Definition: DockSplitter.h:44
ads::CDockSplitter::isResizingWithContainer
bool isResizingWithContainer() const
Definition: DockSplitter.cpp:106
ads::CDockSplitter::firstWidget
QWidget * firstWidget() const
Definition: DockSplitter.cpp:93
ads::CDockSplitter::CDockSplitter
CDockSplitter(QWidget *parent=Q_NULLPTR)
Definition: DockSplitter.cpp:51
ADS_PRINT
#define ADS_PRINT(s)
Definition: ads_globals.h:60
DockAreaWidget.h
Declaration of CDockAreaWidget class.
d
d
ads::CDockSplitter::hasVisibleContent
bool hasVisibleContent() const
Definition: DockSplitter.cpp:77
ads::DockSplitterPrivate::VisibleContentCount
int VisibleContentCount
Definition: DockSplitter.cpp:45
ads::CDockSplitter::~CDockSplitter
virtual ~CDockSplitter()
Definition: DockSplitter.cpp:69


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44