Skip to content

Commit

Permalink
Merge pull request #44 from neochapay/master
Browse files Browse the repository at this point in the history
Add function to set custom mm and dp scale factor
  • Loading branch information
locusf authored Aug 3, 2017
2 parents e239b42 + d27167f commit d5b5ece
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/controls/sizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,26 @@ float Sizing::dp(float value)
{
return value*m_dp_factor;
}


void Sizing::setMmScaleFactor(float value)
{
if(value != 0)
{
qDebug() << "Set custom mm scale factor";

m_p_width = value;
setMmScaleFactor();
}
}


void Sizing::setDpScaleFactor(float value)
{
if(value != 0)
{
qDebug() << "Set custom dp scale factor";

m_dp_factor = value;
}
}
3 changes: 3 additions & 0 deletions src/controls/sizing.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Sizing : public QObject
Q_INVOKABLE float mm(float value);
Q_INVOKABLE float dp(float value);

Q_INVOKABLE void setMmScaleFactor(float value);
Q_INVOKABLE void setDpScaleFactor(float value);

private:
bool m_valid;

Expand Down

0 comments on commit d5b5ece

Please sign in to comment.