Skip to content
Snippets Groups Projects
Commit 030b0ac7 authored by alexander.mruchok's avatar alexander.mruchok
Browse files

Merge branch 'develop' into feature-3045

parents ab11fb75 edaa08d6
No related branches found
No related tags found
2 merge requests!17Develop old,!11Feature 3131
...@@ -24,4 +24,11 @@ namespace Utils ...@@ -24,4 +24,11 @@ namespace Utils
} }
return (result.size() == 4) ? QColor(result.at(0), result.at(1), result.at(2), result.at(3)) : QColor(); return (result.size() == 4) ? QColor(result.at(0), result.at(1), result.at(2), result.at(3)) : QColor();
} }
int toIntValue(const QString &a_text)
{
QRegExp regString("(\\d+)");
regString.indexIn(a_text);
return regString.cap(0).toInt();
}
} }
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
namespace Utils namespace Utils
{ {
QColor toColor(const QString &strRGBA); QColor toColor(const QString &strRGBA);
///The function returns the first integer in the string.
/// 100%=>100 100px=>100 100**=>100 100=>100
int toIntValue(const QString &a_text);
}; };
#endif // UTILS_H #endif // UTILS_H
#include "CustomComboBox.h"
/** @brief constructor
* @param a_parent object parent
*/
CustomComboBox::CustomComboBox(QWidget *parent):
QComboBox (parent)
{
}
/** @brief Reimplemented QComboBox::enterEvent is sent to the widget when the mouse cursor enters the widget.
* @param event
*/
void CustomComboBox:: enterEvent(QEvent *event)
{
Q_UNUSED(event);
setProperty("hoverState",1);
style()->unpolish(this);
style()->polish(this);
update();
}
/** @brief Reimplemented QComboBox::leaveEvent is sent to the widget when the mouse cursor leaves the widget.
* @param event
*/
void CustomComboBox::leaveEvent(QEvent *event)
{
Q_UNUSED(event);
setProperty("hoverState",0);
style()->unpolish(this);
style()->polish(this);
update();
}
#ifndef CUSTOMCOMBOBOX_H
#define CUSTOMCOMBOBOX_H
#include <QComboBox>
/** @brief QComboBox with changing downArrow when hover on control.
*To indicate the selection of an object in css
*
*#ComboBoxName[hoverState = "1"]::drop-down,
*{
* image: url(path to icon);
*}
*
* Everything else unchanged
*/
class CustomComboBox : public QComboBox
{
Q_OBJECT
public:
CustomComboBox(QWidget *parent = Q_NULLPTR);
protected:
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
};
#endif // CUSTOMCOMBOBOX_H
#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
...@@ -28,11 +28,12 @@ void StyledDropShadowEffect::updateStyle() ...@@ -28,11 +28,12 @@ void StyledDropShadowEffect::updateStyle()
else else
this->setColor(Utils::toColor(colorStr)); this->setColor(Utils::toColor(colorStr));
int blur = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "blur").toInt(); int blur = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "blur"));
this->setBlurRadius(blur); this->setBlurRadius(blur);
//Offset: //Offset:
int x = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "x").toInt(); int x = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "x"));
int y = AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "y").toInt(); int y = Utils::toIntValue(AppStyleSheetHandler::getValueFromStylesheet(stylesheet, "y"));
this->setOffset(x, y); this->setOffset(x, y);
} }
...@@ -2,6 +2,8 @@ SOURCES += \ ...@@ -2,6 +2,8 @@ SOURCES += \
$$PWD/AdaptiveWidget.cpp \ $$PWD/AdaptiveWidget.cpp \
$$PWD/AnimationChangingWidget.cpp \ $$PWD/AnimationChangingWidget.cpp \
$$PWD/ComboBoxDelegate.cpp \ $$PWD/ComboBoxDelegate.cpp \
$$PWD/CustomComboBox.cpp \
$$PWD/CustomLineHeightLabel.cpp \
$$PWD/CustomPlacementButton.cpp \ $$PWD/CustomPlacementButton.cpp \
$$PWD/ServersComboBox.cpp \ $$PWD/ServersComboBox.cpp \
$$PWD/AnimatedLineEdit.cpp \ $$PWD/AnimatedLineEdit.cpp \
...@@ -13,6 +15,8 @@ HEADERS += \ ...@@ -13,6 +15,8 @@ HEADERS += \
$$PWD/AdaptiveWidget.h \ $$PWD/AdaptiveWidget.h \
$$PWD/AnimationChangingWidget.h \ $$PWD/AnimationChangingWidget.h \
$$PWD/ComboBoxDelegate.h \ $$PWD/ComboBoxDelegate.h \
$$PWD/CustomComboBox.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