diff --git a/controls/CustomLineHeightLabel.cpp b/controls/CustomLineHeightLabel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f45fe23df47f1017a063f260c1022e5041dc7a25 --- /dev/null +++ b/controls/CustomLineHeightLabel.cpp @@ -0,0 +1,37 @@ +#include "CustomLineHeightLabel.h" +#include "AppStyleSheetHandler.h" + +CustomLineHeightLabel::CustomLineHeightLabel(QWidget *a_parent) + :QLabel (a_parent) +{ +} + +void CustomLineHeightLabel::setText(const QString &text) +{ + if(m_HightLine.isEmpty())m_HightLine = "100"; + QString textToHtml = QString("<p style = 'line-height:%1;'>").arg(m_HightLine); + textToHtml += text; + textToHtml += "</p>"; + + QLabel::setText(textToHtml); + +} + +void CustomLineHeightLabel::setObjectName(const QString &name) +{ + QObject::setObjectName(name); + + updateStyleSheets(); +} + +void CustomLineHeightLabel::updateStyleSheets() +{ + + StyleSheatSearchPar searchPar; + searchPar.widgetName = "#"+ parent()->objectName() + " #" + this->objectName(); + + QString stylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar); + //line-height: + m_HightLine = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "line-height"); + +} diff --git a/controls/CustomLineHeightLabel.h b/controls/CustomLineHeightLabel.h new file mode 100644 index 0000000000000000000000000000000000000000..91f640f37bb5a71dd4759f4d4685aa5d03c6030a --- /dev/null +++ b/controls/CustomLineHeightLabel.h @@ -0,0 +1,20 @@ +#ifndef CUSTOMLINEHEIGHTLABEL_H +#define CUSTOMLINEHEIGHTLABEL_H + +#include <QLabel> + +class CustomLineHeightLabel: public QLabel +{ +public: + explicit CustomLineHeightLabel(QWidget *a_parent = Q_NULLPTR); + + void setText(const QString &text); + void setObjectName(const QString &name); + + void updateStyleSheets(); + +private: + QString m_HightLine; +}; + +#endif // CUSTOMLINEHEIGHTLABEL_H diff --git a/controls/controls.pri b/controls/controls.pri index 457e3909cc1e372d966d0a227dc94ac104ccdd38..d098b5407ebde7021bdd364e223cbb8299fe8640 100644 --- a/controls/controls.pri +++ b/controls/controls.pri @@ -1,6 +1,7 @@ SOURCES += \ $$PWD/AnimationChangingWidget.cpp \ $$PWD/ComboBoxDelegate.cpp \ + $$PWD/CustomLineHeightLabel.cpp \ $$PWD/CustomPlacementButton.cpp \ $$PWD/ServersComboBox.cpp \ $$PWD/AnimatedLineEdit.cpp \ @@ -11,6 +12,7 @@ SOURCES += \ HEADERS += \ $$PWD/AnimationChangingWidget.h \ $$PWD/ComboBoxDelegate.h \ + $$PWD/CustomLineHeightLabel.h \ $$PWD/CustomPlacementButton.h \ $$PWD/ServersComboBox.h \ $$PWD/AnimatedLineEdit.h \