KDDockWidgets API Documentation
1.7
Loading...
Searching...
No Matches
source
src
private
widgets
DockWidget.cpp
Go to the documentation of this file.
1
/*
2
This file is part of KDDockWidgets.
3
4
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5
Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9
Contact KDAB at <info@kdab.com> for commercial licensing options.
10
*/
11
12
#include "
DockWidget.h
"
13
14
#include <QCloseEvent>
15
#include <QVBoxLayout>
16
24
using namespace
KDDockWidgets
;
25
26
class
DockWidget::Private
27
{
28
public
:
29
Private(
DockWidget
*q)
30
: layout(new
QVBoxLayout
(q))
31
{
32
layout->setSpacing(0);
33
layout->setContentsMargins(0, 0, 0, 0);
34
35
// propagate the max-size constraints from the guest widget to the DockWidget
36
layout->setSizeConstraint(
QLayout::SetMinAndMaxSize
);
37
}
38
39
QVBoxLayout
*
const
layout;
40
};
41
42
DockWidget::DockWidget
(
const
QString
&name, Options options, LayoutSaverOptions layoutSaverOptions)
43
:
DockWidgetBase
(name, options, layoutSaverOptions)
44
, d(new Private(this))
45
{
46
connect(
this
, &
DockWidgetBase::widgetChanged
,
this
, [
this
](
QWidget
*w) {
47
d->layout->addWidget(w);
48
});
49
}
50
51
DockWidget::~DockWidget
()
52
{
53
delete
d;
54
}
55
56
bool
DockWidget::event
(
QEvent
*e)
57
{
58
if
(e->
type
() ==
QEvent::ParentChange
) {
59
onParentChanged
();
60
}
else
if
(e->
type
() ==
QEvent::Show
) {
61
onShown
(e->
spontaneous
());
62
}
else
if
(e->
type
() ==
QEvent::Hide
) {
63
onHidden
(e->
spontaneous
());
64
}
65
66
return
QWidget::event
(e);
67
}
68
69
void
DockWidget::closeEvent
(
QCloseEvent
*e)
70
{
71
onCloseEvent
(e);
72
}
DockWidget.h
Represents a dock widget.
KDDockWidgets::DockWidgetBase
The DockWidget base-class. DockWidget and DockWidgetBase are only split in two so we can share some c...
Definition
DockWidgetBase.h:61
KDDockWidgets::DockWidgetBase::onHidden
void onHidden(bool spontaneous)
Definition
DockWidgetBase.cpp:848
KDDockWidgets::DockWidgetBase::widgetChanged
void widgetChanged(KDDockWidgets::QWidgetOrQuick *)
emitted when the hosted widget changed
KDDockWidgets::DockWidgetBase::onCloseEvent
void onCloseEvent(QCloseEvent *e) override
Definition
DockWidgetBase.cpp:873
KDDockWidgets::DockWidgetBase::onShown
void onShown(bool spontaneous)
Definition
DockWidgetBase.cpp:831
KDDockWidgets::DockWidgetBase::onParentChanged
void onParentChanged()
Definition
DockWidgetBase.cpp:818
KDDockWidgets::DockWidget
Represents a dock widget.
Definition
DockWidget.h:38
KDDockWidgets::DockWidget::closeEvent
void closeEvent(QCloseEvent *) override
Definition
DockWidget.cpp:69
KDDockWidgets::DockWidget::event
bool event(QEvent *) override
Definition
DockWidget.cpp:56
KDDockWidgets::DockWidget::DockWidget
DockWidget(const QString &uniqueName, Options options=KDDockWidgets::DockWidgetBase::Options(), LayoutSaverOptions layoutSaverOptions=KDDockWidgets::DockWidgetBase::LayoutSaverOptions())
constructs a new DockWidget
Definition
DockWidget.cpp:42
KDDockWidgets::DockWidget::~DockWidget
~DockWidget() override
destructor
Definition
DockWidget.cpp:51
KDDockWidgets
Definition
Config.cpp:37
QCloseEvent
QEvent
QEvent::ParentChange
ParentChange
QEvent::spontaneous
bool spontaneous() const const
QEvent::type
QEvent::Type type() const const
QLayout::SetMinAndMaxSize
SetMinAndMaxSize
QString
QVBoxLayout
QWidget
QWidget::event
virtual bool event(QEvent *event) override
© 2019-2023 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated on Wed Nov 1 2023 00:02:31 for KDDockWidgets API Documentation by doxygen 1.9.8