Skip to content
Snippets Groups Projects
Commit d267abce authored by konstantin.kukharenko's avatar konstantin.kukharenko
Browse files

Merge branch 'features-3063' into 'develop'

[+]New class

See merge request !5
parents 51cd7ce6 4c93898d
No related branches found
No related tags found
3 merge requests!17Develop old,!11Feature 3131,!5[+]New class
#include "CustomLineHeightLabel.h"
#include "AppStyleSheetHandler.h"
CustomLineHeightLabel::CustomLineHeightLabel(QWidget *a_parent)
:QLabel (a_parent)
{
}
void CustomLineHeightLabel::setText(const QString &text)
{
if(m_lineHeight.isEmpty())m_lineHeight = "100";
QString textToHtml = QString("<p style = 'line-height:%1;'> %2 </p>").arg(m_lineHeight).arg(text);
QLabel::setText(textToHtml);
}
void CustomLineHeightLabel::setObjectName(const QString &name)
{
QObject::setObjectName(name);
updateStyleSheets();
}
void CustomLineHeightLabel::updateStyleSheets()
{
StyleSheatSearchPar searchPar;
searchPar.widgetName = "#" + this->objectName();
QString stylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
//line-height:
m_lineHeight = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "line-height");
}
#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_lineHeight;
};
#endif // CUSTOMLINEHEIGHTLABEL_H
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 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment