KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
Helpers.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019 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 "Helpers_p.h"
13#include "core/DockRegistry_p.h"
14#include "core/DragController_p.h"
15#include "core/Group.h"
16#include "qtcommon/View.h"
17
18#include <QQuickItem>
19#include <QUuid>
20
21using namespace KDDockWidgets;
22
23QtQuickHelpers::QtQuickHelpers()
24{
25 KDBindings::ScopedConnection conn = DockRegistry::self()->dptr()->groupInMDIResizeChanged.connect([this] {
26 Q_EMIT groupInMDIResizeChanged();
27 });
28 m_connections.push_back(std::move(conn));
29
30 KDBindings::ScopedConnection conn2 = Core::DragController::instance()->isDraggingChanged.connect([this] {
31 Q_EMIT isDraggingChanged();
32 });
33 m_connections.push_back(std::move(conn2));
34}
35
36qreal QtQuickHelpers::logicalDpiFactor(const QQuickItem *) const
37{
38 return 1; // TODO: Support the actual dpi factor.
39 // return KDDockWidgets::logicalDpiFactor(item);
40}
41
42QObject *QtQuickHelpers::groupViewInMDIResize() const
43{
44 if (auto group = DockRegistry::self()->groupInMDIResize())
45 return QtCommon::View_qt::asQObject(group->view());
46
47 return nullptr;
48}
49
50bool QtQuickHelpers::isDragging() const
51{
52 return Core::DragController::instance()->isDragging();
53}
54
55QString QtQuickHelpers::generateUuid() const
56{
57 return QUuid::createUuid().toString();
58}
A ScopedConnection is a RAII-style way to make sure a Connection is disconnected.
Definition signal.h:533
static DockRegistry * self()
static QObject * asQObject(View *)
Class to abstract QAction, so code still works with QtQuick and Flutter.
QUuid createUuid()
QString toString() const const

© 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