Warning, file /graphics/glaxnimate/src/gui/widgets/spin2d.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QToolButton> 0010 #include <QVector2D> 0011 #include "smaller_spinbox.hpp" 0012 0013 namespace glaxnimate::gui { 0014 0015 class Spin2D : public QWidget 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 Spin2D(bool ratio_lock, QWidget* parent = nullptr); 0021 Spin2D(QWidget* parent = nullptr); 0022 0023 QVector2D value_vector() const; 0024 QPointF value_point() const; 0025 QSizeF value_size() const; 0026 0027 void enable_ratio_lock(); 0028 0029 void set_value(const QVector2D& v); 0030 void set_value(const QPointF& v); 0031 void set_value(const QSizeF& v); 0032 void set_value(qreal x, qreal y); 0033 0034 void set_decimals(int decimals); 0035 0036 qreal x() const; 0037 qreal y() const; 0038 0039 protected: 0040 void changeEvent ( QEvent* e ) override; 0041 0042 private Q_SLOTS: 0043 void lock_toggled(bool on); 0044 void x_changed(qreal x); 0045 void y_changed(qreal y); 0046 0047 Q_SIGNALS: 0048 void value_changed(); 0049 0050 private: 0051 bool ratio_lock() const; 0052 void retranslate(); 0053 0054 qreal ratio = 1; 0055 SmallerSpinBox* spin_x; 0056 SmallerSpinBox* spin_y; 0057 QToolButton* lock = nullptr; 0058 }; 0059 0060 } // namespace glaxnimate::gui