| #pragma once |
| |
| #ifndef DOUBLEPAIRFIELD_H |
| #define DOUBLEPAIRFIELD_H |
| |
| #include "toonzqt/doublefield.h" |
| #include "tcommon.h" |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TOONZQT_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| class QSlider; |
| class QLabel; |
| |
| |
| |
| namespace DVGui { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI DoubleValuePairField : public QWidget { |
| Q_OBJECT |
| |
| protected: |
| QPixmap m_handleLeftPixmap, m_handleRightPixmap, m_handleLeftGrayPixmap, |
| m_handleRightGrayPixmap; |
| Q_PROPERTY(QPixmap HandleLeftPixmap READ getHandleLeftPixmap WRITE |
| setHandleLeftPixmap); |
| Q_PROPERTY(QPixmap HandleRightPixmap READ getHandleRightPixmap WRITE |
| setHandleRightPixmap); |
| Q_PROPERTY(QPixmap HandleLeftGrayPixmap READ getHandleLeftGrayPixmap WRITE |
| setHandleLeftGrayPixmap); |
| Q_PROPERTY(QPixmap HandleRightGrayPixmap READ getHandleRightGrayPixmap WRITE |
| setHandleRightGrayPixmap); |
| |
| QColor m_lightLineColor; |
| QColor m_darkLineColor; |
| QColor m_middleLineColor; |
| QColor m_lightLineEdgeColor; |
| Q_PROPERTY( |
| QColor LightLineColor READ getLightLineColor WRITE setLightLineColor); |
| Q_PROPERTY(QColor DarkLineColor READ getDarkLineColor WRITE setDarkLineColor); |
| Q_PROPERTY( |
| QColor MiddleLineColor READ getMiddleLineColor WRITE setMiddleLineColor); |
| Q_PROPERTY(QColor LightLineEdgeColor READ getLightLineEdgeColor WRITE |
| setLightLineEdgeColor); |
| |
| DoubleValueLineEdit *m_leftLineEdit; |
| DoubleValueLineEdit *m_rightLineEdit; |
| |
| QLabel *m_leftLabel, *m_rightLabel; |
| |
| std::pair<double, double> m_values; |
| double m_minValue, m_maxValue; |
| int m_grabOffset, m_grabIndex; |
| int m_leftMargin, m_rightMargin; |
| |
| bool m_isMaxRangeLimited; |
| |
| public: |
| DoubleValuePairField(QWidget *parent, bool isMaxRangeLimited, |
| DoubleValueLineEdit *leftLineEdit, |
| DoubleValueLineEdit *rightLineEdit); |
| ~DoubleValuePairField() {} |
| |
| |
| void setValues(const std::pair<double, double> &values); |
| |
| std::pair<double, double> getValues() const { return m_values; } |
| |
| |
| |
| void setLeftText(const QString &text); |
| |
| |
| |
| void setRightText(const QString &text); |
| |
| void setLabelsEnabled(bool enable); |
| |
| |
| void setRange(double minValue, double maxValue); |
| |
| void getRange(double &minValue, double &maxValue); |
| |
| QPixmap getHandleLeftPixmap() const { return m_handleLeftPixmap; } |
| void setHandleLeftPixmap(const QPixmap &pixmap) { |
| m_handleLeftPixmap = pixmap; |
| } |
| QPixmap getHandleRightPixmap() const { return m_handleRightPixmap; } |
| void setHandleRightPixmap(const QPixmap &pixmap) { |
| m_handleRightPixmap = pixmap; |
| } |
| QPixmap getHandleLeftGrayPixmap() const { return m_handleLeftGrayPixmap; } |
| void setHandleLeftGrayPixmap(const QPixmap &pixmap) { |
| m_handleLeftGrayPixmap = pixmap; |
| } |
| QPixmap getHandleRightGrayPixmap() const { return m_handleRightGrayPixmap; } |
| void setHandleRightGrayPixmap(const QPixmap &pixmap) { |
| m_handleRightGrayPixmap = pixmap; |
| } |
| |
| void setLightLineColor(const QColor &color) { m_lightLineColor = color; } |
| QColor getLightLineColor() const { return m_lightLineColor; } |
| void setDarkLineColor(const QColor &color) { m_darkLineColor = color; } |
| QColor getDarkLineColor() const { return m_darkLineColor; } |
| void setMiddleLineColor(const QColor &color) { m_middleLineColor = color; } |
| QColor getMiddleLineColor() const { return m_middleLineColor; } |
| void setLightLineEdgeColor(const QColor &color) { |
| m_lightLineEdgeColor = color; |
| } |
| QColor getLightLineEdgeColor() const { return m_lightLineEdgeColor; } |
| |
| protected: |
| |
| double pos2value(int x) const; |
| |
| int value2pos(double v) const; |
| |
| |
| |
| |
| |
| void setValue(double v); |
| |
| void paintEvent(QPaintEvent *) override; |
| |
| void mousePressEvent(QMouseEvent *event) override; |
| void mouseMoveEvent(QMouseEvent *event) override; |
| void mouseReleaseEvent(QMouseEvent *event) override; |
| |
| protected slots: |
| |
| |
| |
| |
| |
| |
| void onLeftEditingFinished(); |
| |
| |
| |
| |
| |
| |
| |
| |
| void onRightEditingFinished(); |
| |
| signals: |
| |
| |
| |
| void valuesChanged(bool isDragging); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI DoublePairField : public DoubleValuePairField { |
| public: |
| DoublePairField(QWidget *parent = 0, bool isMaxRangeLimited = true); |
| ~DoublePairField() {} |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI MeasuredDoublePairField final : public DoubleValuePairField { |
| public: |
| MeasuredDoublePairField(QWidget *parent = 0, bool isMaxRangeLimited = true); |
| ~MeasuredDoublePairField() {} |
| |
| void setMeasure(std::string measureName); |
| |
| void setPrecision(int precision); |
| }; |
| |
| |
| } |
| |
| |
| #endif |