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

[+]New class

parent 51cd7ce6
No related branches found
No related tags found
3 merge requests!17Develop old,!11Feature 3131,!5[+]New class
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
#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");
}
#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
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