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

[*]Edit comments

parent 15d6ac0e
No related branches found
No related tags found
2 merge requests!26Feature 3349,!25Features 3332
......@@ -7,7 +7,8 @@ const QString CustomButtonComboBox::BUTTON_NAME_SUFFIX = "_control";
CustomButtonComboBox::CustomButtonComboBox(QWidget *a_parent)
: CustomComboBox(a_parent),
m_showTextPolicy(TextPolicy::showWhenUnselected)
m_showTextPolicy(CaptionPolicy::showWhenUnselected),
m_caption("")
{
this->setLayout(new QVBoxLayout(this));
this->layout()->setContentsMargins(0, 0 ,0, 0);
......@@ -31,8 +32,7 @@ void CustomButtonComboBox::setButtonControll(CustomButtonAbstract *a_button)
connect(this, &QComboBox::currentTextChanged, [this](const QString& a_text){
if(m_showTextPolicy == TextPolicy::showWhenUnselected)
m_button->setText(a_text);
this->setCurrentText(a_text);
});
}
......@@ -60,17 +60,25 @@ CustomButtonAbstract *CustomButtonComboBox::buttonControll() const
void CustomButtonComboBox::setCurrentText(const QString &text)
{
if (m_button)
if((m_showTextPolicy == TextPolicy::showWhenUnselected && this->currentText()=="")||m_showTextPolicy == TextPolicy::showAlways)
{
if(m_showTextPolicy == CaptionPolicy::showWhenUnselected)
m_button->setText(text);
if(text == "")
this->setCaption(m_caption);
}
}
void CustomButtonComboBox::setCaption(const QString &a_text)
{
if (m_button)
m_button->setText(a_text);
if(m_showTextPolicy == CaptionPolicy::showAlways)
m_button->setText(a_text);
m_caption = a_text;
}
void CustomButtonComboBox::setCaptionPolicy(TextPolicy a_show)
void CustomButtonComboBox::setCaptionPolicy(CaptionPolicy a_policy)
{
m_showTextPolicy = a_show;
m_showTextPolicy = a_policy;
setCaption(m_caption);
}
......@@ -7,7 +7,7 @@
#include "CustomPlacementButton.h"
#include "CustomButtonAbstract.h"
enum class TextPolicy{showWhenUnselected,showAlways};
enum class CaptionPolicy{showWhenUnselected,showAlways};
class CustomButtonComboBox : public CustomComboBox
{
......@@ -22,7 +22,7 @@ public:
void setCaption(const QString &a_text);
void setCaptionPolicy(TextPolicy a_show = TextPolicy::showWhenUnselected);
void setCaptionPolicy(CaptionPolicy a_policy = CaptionPolicy::showWhenUnselected);
public slots:
void setCurrentText(const QString &text);
......@@ -33,8 +33,8 @@ protected:
private:
TextPolicy m_showTextPolicy;
CaptionPolicy m_showTextPolicy;
QString m_caption;
CustomButtonAbstract* m_button = nullptr;
static const QString BUTTON_NAME_SUFFIX;
......
......@@ -7,7 +7,8 @@ CustomLineEdit::CustomLineEdit(QWidget *parent):CustomLineEditBase (parent)
this->clear();
setVisibleButton(false);
Utils::setPropertyAndUpdateStyle(this, Properties::FILLED,false);
Utils::setPropertyAndUpdateStyle(this, Properties::ACTIVE,false);
Utils::setPropertyAndUpdateStyle(this, Properties::ACTIVE,true);
this->setFocus();
});
}
......@@ -3,7 +3,7 @@
#include "Utils.h"
#include <QWidget>
StyledDropShadowEffect::StyledDropShadowEffect(QObject *a_parent /*= Q_NULLPTR*/)
StyledDropShadowEffect::StyledDropShadowEffect(QObject *a_parent)
:QGraphicsDropShadowEffect(a_parent)
{
defaultShadow = nullptr;
......@@ -15,16 +15,21 @@ StyledDropShadowEffect::StyledDropShadowEffect(QObject *a_parent /*= Q_NULLPTR*/
connectToParentEvents();
}
StyledDropShadowEffect::~StyledDropShadowEffect()
{
delete defaultShadow;
delete hoverShadow;
}
///@details Connects connections
void StyledDropShadowEffect::connectToParentEvents()
{
connect(this,&StyledDropShadowEffect::mouseEnter,[=]{
this->updateStyle(StyleShedow::HOVER_SHADOW);
this->updateStyle(ShadowState::HOVER_SHADOW);
});
connect(this,&StyledDropShadowEffect::mouseLaeve,[=]{
this->updateStyle(StyleShedow::DEFAULT_SHADOW);
this->updateStyle(ShadowState::DEFAULT_SHADOW);
});
connect(this->parent(),&QObject::objectNameChanged,[=]{
......@@ -56,7 +61,7 @@ void StyledDropShadowEffect::updateStyleProperties()
}
///@details Setting and setting the default shadow
void StyledDropShadowEffect::updateStyle(StyleShedow a_style)
void StyledDropShadowEffect::updateStyle(ShadowState a_style)
{
switch (a_style)
{
......
......@@ -27,15 +27,16 @@ struct ShadowProperties
QColor color;
};
enum StyleShedow{DEFAULT_SHADOW,HOVER_SHADOW};
enum ShadowState{DEFAULT_SHADOW,HOVER_SHADOW};
class StyledDropShadowEffect : public QGraphicsDropShadowEffect
{
Q_OBJECT
public:
StyledDropShadowEffect(QObject *a_parent);
~StyledDropShadowEffect();
///@details Setting the shadow
void updateStyle(StyleShedow a_style);
void updateStyle(ShadowState a_style);
///@details Collecting data from css
void updateStyleProperties();
protected:
......
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