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
MQTTClient d
Definition: test10.c:1656
DockSplitterPrivate * d
Definition: DockSplitter.h:48
CDockSplitter(QWidget *parent=Q_NULLPTR)
QWidget * lastWidget() const
bool hasVisibleContent() const
#define ADS_PRINT(s)
Definition: ads_globals.h:60
Declaration of CDockSplitter.
bool isResizingWithContainer() const
Declaration of CDockAreaWidget class.
virtual ~CDockSplitter()
DockSplitterPrivate(CDockSplitter *_public)
QWidget * firstWidget() const


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:47:34