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

[+]New class

parent 51cd7ce6
No related branches found
No related tags found
2 merge requests!17Develop old,!11Feature 3131
#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 += \ SOURCES += \
$$PWD/AnimationChangingWidget.cpp \ $$PWD/AnimationChangingWidget.cpp \
$$PWD/ComboBoxDelegate.cpp \ $$PWD/ComboBoxDelegate.cpp \
$$PWD/CustomLineHeightLabel.cpp \
$$PWD/CustomPlacementButton.cpp \ $$PWD/CustomPlacementButton.cpp \
$$PWD/ServersComboBox.cpp \ $$PWD/ServersComboBox.cpp \
$$PWD/AnimatedLineEdit.cpp \ $$PWD/AnimatedLineEdit.cpp \
...@@ -11,6 +12,7 @@ SOURCES += \ ...@@ -11,6 +12,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
$$PWD/AnimationChangingWidget.h \ $$PWD/AnimationChangingWidget.h \
$$PWD/ComboBoxDelegate.h \ $$PWD/ComboBoxDelegate.h \
$$PWD/CustomLineHeightLabel.h \
$$PWD/CustomPlacementButton.h \ $$PWD/CustomPlacementButton.h \
$$PWD/ServersComboBox.h \ $$PWD/ServersComboBox.h \
$$PWD/AnimatedLineEdit.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