File indexing completed on 2024-10-13 06:40:48

0001 /*
0002     SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
0003     SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
0004     SPDX-FileCopyrightText: 2016 The Qt Company Ltd. <https://www.qt.io/licensing/>
0005 
0006     This file is part of the Qt Quick Controls module of the Qt Toolkit.
0007 
0008     SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial
0009 */
0010 
0011 #ifndef KQUICKPADDING_H
0012 #define KQUICKPADDING_H
0013 
0014 #include <QObject>
0015 
0016 #include <qqmlregistration.h>
0017 
0018 class KQuickPadding : public QObject
0019 {
0020     Q_OBJECT
0021     QML_ANONYMOUS
0022 
0023     Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged)
0024     Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged)
0025     Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged)
0026     Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
0027 
0028     int m_left;
0029     int m_top;
0030     int m_right;
0031     int m_bottom;
0032 
0033 public:
0034     KQuickPadding(QObject *parent = nullptr)
0035         : QObject(parent)
0036         , m_left(0)
0037         , m_top(0)
0038         , m_right(0)
0039         , m_bottom(0)
0040     {
0041     }
0042 
0043     int left() const
0044     {
0045         return m_left;
0046     }
0047     int top() const
0048     {
0049         return m_top;
0050     }
0051     int right() const
0052     {
0053         return m_right;
0054     }
0055     int bottom() const
0056     {
0057         return m_bottom;
0058     }
0059 
0060 public Q_SLOTS:
0061     void setLeft(int arg)
0062     {
0063         if (m_left != arg) {
0064             m_left = arg;
0065             Q_EMIT leftChanged();
0066         }
0067     }
0068     void setTop(int arg)
0069     {
0070         if (m_top != arg) {
0071             m_top = arg;
0072             Q_EMIT topChanged();
0073         }
0074     }
0075     void setRight(int arg)
0076     {
0077         if (m_right != arg) {
0078             m_right = arg;
0079             Q_EMIT rightChanged();
0080         }
0081     }
0082     void setBottom(int arg)
0083     {
0084         if (m_bottom != arg) {
0085             m_bottom = arg;
0086             Q_EMIT bottomChanged();
0087         }
0088     }
0089 
0090 Q_SIGNALS:
0091     void leftChanged();
0092     void topChanged();
0093     void rightChanged();
0094     void bottomChanged();
0095 };
0096 
0097 #endif // QQUICKPADDING_H