KDDockWidgets API Documentation  1.5
Separator_qwidget.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDDockWidgets.
3 
4  SPDX-FileCopyrightText: 2020-2022 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 "Separator_qwidget.h"
13 #include "Widget_qwidget.h"
14 #include "Logging_p.h"
15 #include "Config.h"
16 
17 #include <QPainter>
18 #include <QStyleOption>
19 #include <QRubberBand>
20 #include <QMouseEvent>
21 
22 using namespace Layouting;
23 
25  : QWidget(parent->asQWidget())
26  , Separator(parent)
27  , Layouting::Widget_qwidget(this)
28 {
29  setMouseTracking(true);
30 }
31 
33 {
36  return;
37  }
38 
39  QPainter p(this);
40 
41  QStyleOption opt;
42  opt.palette = palette();
43  opt.rect = QWidget::rect();
44  opt.state = QStyle::State_None;
45  if (!isVertical())
46  opt.state |= QStyle::State_Horizontal;
47 
48  if (isEnabled())
49  opt.state |= QStyle::State_Enabled;
50 
52 }
53 
54 void SeparatorWidget::enterEvent(KDDockWidgets::Qt5Qt6Compat::QEnterEvent *)
55 {
56  qCDebug(separators) << Q_FUNC_INFO << this;
57  if (isVertical())
59  else
61 }
62 
64 {
66 }
67 
69 {
70  onMousePress();
71 }
72 
74 {
75  onMouseMove(mapToParent(ev->pos()));
76 }
77 
79 {
80  onMouseReleased();
81 }
82 
84 {
85  onMouseDoubleClick();
86 }
87 
89 {
90  if (!parent) {
91  qWarning() << Q_FUNC_INFO << "Parent is required";
92  return nullptr;
93  }
94 
96 }
97 
99 {
100  return this;
101 }
102 
104  : QRubberBand(QRubberBand::Line, parent ? parent->asQWidget() : nullptr)
105  , Layouting::Widget_qwidget(this)
106 {
107 }
QStyle::CE_Splitter
CE_Splitter
QMouseEvent::pos
QPoint pos() const const
QStyle::drawControl
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const const=0
QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event)
QWidget::palette
palette
Widget_qwidget.h
A Layouting::Widget that's deals in QWidget.
QWidget::mapToParent
QPoint mapToParent(const QPoint &pos) const const
Layouting::RubberBand
Definition: Rubberband_quick.h:26
QWidget::rect
rect
QWidget
Separator
Layouting::SeparatorWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *) override
Definition: Separator_qwidget.cpp:73
QPainter
QStyle::State_None
State_None
QMouseEvent
Layouting::SeparatorWidget::createRubberBand
Widget * createRubberBand(Widget *parent) override
Definition: Separator_qwidget.cpp:88
Layouting::SeparatorWidget::mousePressEvent
void mousePressEvent(QMouseEvent *) override
Definition: Separator_qwidget.cpp:68
KDDockWidgets::Config::CustomizableWidget_Separator
@ CustomizableWidget_Separator
The draggable separator between dock widgets in a layout.
Definition: Config.h:104
Layouting::Widget_qwidget
A Layouting::Widget that's deals in QWidget Allows to host a QWidget in the layout.
Definition: Widget_qwidget.h:28
QWidget::style
QStyle * style() const const
Layouting::SeparatorWidget::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *) override
Definition: Separator_qwidget.cpp:83
Layouting::Widget
An abstraction/wrapper around QWidget, QtQuickItem or anything else.
Definition: Widget.h:79
Qt::SizeVerCursor
SizeVerCursor
Layouting::SeparatorWidget::enterEvent
void enterEvent(KDDockWidgets::Qt5Qt6Compat::QEnterEvent *) override
Definition: Separator_qwidget.cpp:54
Layouting::SeparatorWidget::SeparatorWidget
SeparatorWidget(Layouting::Widget *parent=nullptr)
Definition: Separator_qwidget.cpp:24
QStyleOption
QWidget::isEnabled
bool isEnabled() const const
QWidget::setMouseTracking
void setMouseTracking(bool enable)
Config.h
Application-wide config to tune certain behaviours of the framework.
QEvent
QPaintEvent
Separator_qwidget.h
QRubberBand
Layouting::SeparatorWidget::asWidget
Widget * asWidget() override
Definition: Separator_qwidget.cpp:98
Layouting
Definition: FrameworkWidgetFactory.h:32
Layouting::RubberBand::RubberBand
RubberBand(Layouting::Widget *parent)
Definition: Rubberband_quick.cpp:16
Layouting::SeparatorWidget::paintEvent
void paintEvent(QPaintEvent *) override
Definition: Separator_qwidget.cpp:32
Layouting::SeparatorWidget::leaveEvent
void leaveEvent(QEvent *) override
Definition: Separator_qwidget.cpp:63
QWidget::parentWidget
QWidget * parentWidget() const const
QObject::parent
QObject * parent() const const
QWidget::setCursor
void setCursor(const QCursor &)
KDDockWidgets::Config::self
static Config & self()
returns the singleton Config instance
Definition: Config.cpp:82
Layouting::SeparatorWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *) override
Definition: Separator_qwidget.cpp:78

© 2019-2022 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 Mon Mar 7 2022 02:01:21 for KDDockWidgets API Documentation by doxygen 1.8.20