diff --git a/include/foillogic/foil.hpp b/include/foillogic/foil.hpp index e0f505c..fdd50b2 100644 --- a/include/foillogic/foil.hpp +++ b/include/foillogic/foil.hpp @@ -42,12 +42,30 @@ namespace foillogic Q_OBJECT // read-write properties + Q_PROPERTY(QString t READ type WRITE setType RESET resetType) + Q_PROPERTY(qreal bh READ bh WRITE setBh RESET resetBh) + Q_PROPERTY(qreal bt READ bt WRITE setBt RESET resetBt) Q_PROPERTY(qreal rx READ rx WRITE setRx RESET resetRx) + QString _type; + qreal _bt; + qreal _bh; qreal _rx; public: - Q_INVOKABLE explicit Base(QObject *parent = 0) : QObject(parent), _rx(0) {} + Q_INVOKABLE explicit Base(QObject *parent = 0) : QObject(parent), _type("extend"), _bt(0), _bh(0), _rx(0) {} + + QString type() const { return _type; }; + void setType(QString type) { _type = type; } + void resetType() { _type = "extend"; } + + qreal bt() const { return _bt; }; + void setBt(qreal bt) { _bt = bt; } + void resetBt() { _bt = 0; } + + qreal bh() const { return _bh; }; + void setBh(qreal bh) { _bh = bh; } + void resetBh() { _bh = 0; } qreal rx() const { return _rx; }; void setRx(qreal rx) { _rx = rx; } diff --git a/include/foillogic/profile.hpp b/include/foillogic/profile.hpp index d08bb84..075a45a 100644 --- a/include/foillogic/profile.hpp +++ b/include/foillogic/profile.hpp @@ -71,6 +71,7 @@ namespace foillogic QPointF bottomProfileTop(qreal* t_top = 0) const; qreal pxThickness() const; qreal thicknessRatio() const; + qreal topRatio() const; // Flags bool editable() const; diff --git a/src/foillogic/profile.cpp b/src/foillogic/profile.cpp index 94dc094..7d1336d 100644 --- a/src/foillogic/profile.cpp +++ b/src/foillogic/profile.cpp @@ -127,6 +127,11 @@ qreal Profile::thicknessRatio() const return -_topProfileTop.y() / _botProfileTop.y(); } +qreal Profile::topRatio() const +{ + return -_topProfileTop.y() / (-_topProfileTop.y() + _botProfileTop.y()); +} + bool Profile::editable() const { return _flags & Flags::Editable; diff --git a/src/version_autogen.hpp b/src/version_autogen.hpp index feb396c..c7ae3bd 100644 --- a/src/version_autogen.hpp +++ b/src/version_autogen.hpp @@ -11,7 +11,7 @@ #define MINOR_VERSION 2 #define REVISION 0 -#define BUILD_NUMBER 628 -#define COMMIT_HASH "c57dda812c04db7a0f8de5ef21695940fbd191ae" +#define BUILD_NUMBER 629 +#define COMMIT_HASH "f45af2ba4b1d333f89c6f6cb0834deee20e38564" #endif // VERSION_AUTOGEN_H