diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-04-30 09:30:46 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-04-30 11:03:24 +0300 |
commit | b94234c5d8463314f65e0beed5ad199b711f5b07 (patch) | |
tree | 296b8cff57cb558f404ac1e03655b943ad36249f /src/datavis3d/utils/utils.cpp | |
parent | 0b2a88b0287f3d1764f643548c1bb35ecf4b1f51 (diff) |
Refactoring to get ready for a second vis type
Moved enums to global header.
Moved drawLabel to Drawer.
Change-Id: Ifb103467254b4288dee1ef6f7bb0c2aa23868dab
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavis3d/utils/utils.cpp')
-rw-r--r-- | src/datavis3d/utils/utils.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/datavis3d/utils/utils.cpp b/src/datavis3d/utils/utils.cpp index 83c23f04..7b4cb6f6 100644 --- a/src/datavis3d/utils/utils.cpp +++ b/src/datavis3d/utils/utils.cpp @@ -53,8 +53,6 @@ QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE -const float m_pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; - QVector3D Utils::vectorFromColor(const QColor &color) { return QVector3D(color.redF(), color.greenF(), color.blueF()); @@ -135,8 +133,7 @@ void Utils::printText(QPainter *painter, const QString &text, const QSize &posit } QImage Utils::printTextToImage(const QFont &font, const QString &text, const QColor &bgrColor, - const QColor &txtColor, - Q3DBars::LabelTransparency transparency) + const QColor &txtColor, LabelTransparency transparency) { // Calculate text dimensions QFont valueFont = font; @@ -145,7 +142,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo int valueStrWidth = valueFM.width(text); int valueStrHeight = valueFM.height(); QSize labelSize; - if (Q3DBars::TransparencyNoBackground == transparency) + if (TransparencyNoBackground == transparency) labelSize = QSize(valueStrWidth, valueStrHeight); else labelSize = QSize(valueStrWidth + 30, valueStrHeight + 30); @@ -160,8 +157,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo painter.setRenderHint(QPainter::Antialiasing, true); painter.setCompositionMode(QPainter::CompositionMode_Source); switch (transparency) { - case Q3DBars::TransparencyNoBackground: - { + case TransparencyNoBackground: { painter.setFont(valueFont); painter.setPen(txtColor); painter.drawText(0, 0, @@ -170,8 +166,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo text); break; } - case Q3DBars::TransparencyFromTheme: - { + case TransparencyFromTheme: { painter.setBrush(QBrush(bgrColor)); painter.setPen(bgrColor); painter.drawRoundedRect(0, 0, labelSize.width(), labelSize.height(), 10.0, 10.0f); @@ -183,8 +178,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo text); break; } - case Q3DBars::TransparencyNone: - { + case TransparencyNone: { painter.setBrush(QBrush(bgrColor)); painter.setPen(bgrColor); painter.drawRect(0, 0, labelSize.width(), labelSize.height()); |