Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
grid_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header
11// file may change from version to version without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QDESIGNER_GRID_H
17#define QDESIGNER_GRID_H
18
20
21#include <QtCore/qcompare.h>
22#include <QtCore/qvariant.h>
23
25
26class QWidget;
27class QPaintEvent;
28class QPainter;
29
30namespace qdesigner_internal {
31
32// Designer grid which is able to serialize to QVariantMap
34{
35public:
36 Grid();
37
38 bool fromVariantMap(const QVariantMap& vm);
39
40 void addToVariantMap(QVariantMap& vm, bool forceKeys = false) const;
41 QVariantMap toVariantMap(bool forceKeys = false) const;
42
43 bool visible() const { return m_visible; }
45
46 bool snapX() const { return m_snapX; }
47 void setSnapX(bool snap) { m_snapX = snap; }
48
49 bool snapY() const { return m_snapY; }
50 void setSnapY(bool snap) { m_snapY = snap; }
51
52 int deltaX() const { return m_deltaX; }
53 void setDeltaX(int dx) { m_deltaX = dx; }
54
55 int deltaY() const { return m_deltaY; }
56 void setDeltaY(int dy) { m_deltaY = dy; }
57
58 void paint(QWidget *widget, QPaintEvent *e) const;
59 void paint(QPainter &p, const QWidget *widget, QPaintEvent *e) const;
60
61 QPoint snapPoint(const QPoint &p) const;
62
63 int widgetHandleAdjustX(int x) const;
64 int widgetHandleAdjustY(int y) const;
65
66private:
67 friend bool comparesEqual(const Grid &lhs, const Grid &rhs) noexcept
68 {
69 return lhs.m_visible == rhs.m_visible
72 }
74
75 int snapValue(int value, int grid) const;
76 bool m_visible;
77 bool m_snapX;
78 bool m_snapY;
79 int m_deltaX;
80 int m_deltaY;
81};
82} // namespace qdesigner_internal
83
84QT_END_NAMESPACE
85
86#endif // QDESIGNER_GRID_H
friend class QPainter
friend class QWidget
Definition qpainter.h:432
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
void fromSettings(const QDesignerSharedSettings &s)
void toSettings(QDesignerSharedSettings &s) const
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
#define QDESIGNER_SHARED_EXPORT