KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
qtquick/views/Separator.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 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.h"
13#include "core/Separator.h"
14#include "core/Logging_p.h"
15#include "core/View_p.h"
16#include "core/layouting/Item_p.h"
17
18#include "qtquick/ViewFactory.h"
19#include "qtquick/Platform.h"
20
21#include <QTimer>
22
23using namespace KDDockWidgets;
24using namespace KDDockWidgets::QtQuick;
25
26Separator::Separator(Core::Separator *controller, QQuickItem *parent)
27 : QtQuick::View(controller, Core::ViewType::Separator, parent)
28 , m_controller(controller)
29{
30}
31
32void Separator::init()
33{
34 View::createItem(plat()->viewFactory()->separatorFilename().toString(), this);
35
36 // Only set on Separator::init(), so single-shot
38}
39
40bool Separator::isVertical() const
41{
42 return m_controller->isVertical();
43}
44
46{
47 if (Core::View::d->freed())
48 return;
49
50 m_controller->onMousePress();
51}
52
54{
55 if (Core::View::d->freed())
56 return;
57
58 const QPointF pos = QQuickItem::mapToItem(parentItem(), localPos);
59 m_controller->onMouseMove(pos.toPoint());
60}
61
63{
64 if (Core::View::d->freed())
65 return;
66
67 m_controller->onMouseReleased();
68}
69
71{
72 if (Core::View::d->freed())
73 return;
74
75 m_controller->onMouseDoubleClick();
76}
77
78QSize Separator::minSize() const
79{
80 // Min sizes don't really make sense for separators, as they are fixed size
81 return { 0, 0 };
82}
Q_INVOKABLE void onMouseMoved(QPointF localPos)
static QQuickItem * createItem(QQmlEngine *engine, const QString &filename, QQmlContext *context=nullptr)
Convenience to create a QQuickItem.
Class to abstract QAction, so code still works with QtQuick and Flutter.
QtQuick::Platform * plat()
A factory class for allowing the user to customize some internal widgets.

© 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 by doxygen 1.9.8