| #pragma once |
| |
| #ifndef INTPAIRFIELD_H |
| #define INTPAIRFIELD_H |
| |
| #include "toonzqt/intfield.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 IntPairField : public QWidget |
| { |
| Q_OBJECT |
| |
| 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); |
| |
| IntLineEdit *m_leftLineEdit; |
| IntLineEdit *m_rightLineEdit; |
| |
| QColor m_lightLineColor; |
| QColor m_darkLineColor; |
| Q_PROPERTY(QColor LightLineColor READ getLightLineColor WRITE setLightLineColor); |
| Q_PROPERTY(QColor DarkLineColor READ getDarkLineColor WRITE setDarkLineColor); |
| |
| QLabel *m_leftLabel, *m_rightLabel; |
| |
| std::pair<int, int> m_values; |
| int m_minValue, m_maxValue; |
| int m_grabOffset, m_grabIndex; |
| int m_leftMargin, m_rightMargin; |
| |
| bool m_isMaxRangeLimited; |
| |
| public: |
| IntPairField(QWidget *parent = 0, bool isMaxRangeLimited = true); |
| ~IntPairField() {} |
| |
| |
| void setValues(const std::pair<int, int> &values); |
| |
| std::pair<int, int> getValues() const { return m_values; } |
| |
| |
| |
| void setLeftText(const QString &text); |
| |
| |
| void setRightText(const QString &text); |
| |
| void setLabelsEnabled(bool enable); |
| |
| |
| void setRange(int minValue, int maxValue); |
| |
| void getRange(int &minValue, int &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; } |
| protected: |
| |
| double pos2value(int x) const; |
| |
| int value2pos(double v) const; |
| |
| |
| |
| |
| void setValue(int v); |
| |
| void paintEvent(QPaintEvent *); |
| |
| void mousePressEvent(QMouseEvent *event); |
| void mouseMoveEvent(QMouseEvent *event); |
| void mouseReleaseEvent(QMouseEvent *event); |
| |
| protected slots: |
| |
| |
| |
| |
| |
| void onLeftEditingFinished(); |
| |
| |
| |
| |
| |
| |
| void onRightEditingFinished(); |
| |
| signals: |
| |
| |
| void valuesChanged(bool isDragging); |
| }; |
| |
| |
| } |
| |
| |
| #endif |