Skip to content

Commit

Permalink
Base type, bh and bt serialization support
Browse files Browse the repository at this point in the history
  • Loading branch information
hrobeers committed Jan 6, 2022
1 parent f45af2b commit c5db78e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
20 changes: 19 additions & 1 deletion include/foillogic/foil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions include/foillogic/profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/foillogic/profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/version_autogen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c5db78e

Please sign in to comment.