Skip to content
Snippets Groups Projects
Commit 2d798ebf authored by konstantin.kukharenko's avatar konstantin.kukharenko Committed by Alexandr Mruchok
Browse files

Features 3017

parent c04e4dcd
No related branches found
No related tags found
1 merge request!17Develop old
#include "FAQWidget.h"
FAQWidget::FAQWidget(const FAQDataModel &model, QWidget *parent): QWidget (parent)
{
setObjectName("wgtFAQWidget");
m_lblIcon = new QLabel(this);
m_lblHeader = new CustomLineHeightLabel(this);
m_lblText = new CustomLineHeightLabel(this);
m_lblBottomLine = new QLabel(this);
m_topLayout = new QHBoxLayout();
m_mainLayout = new QVBoxLayout();
m_lblIcon->setObjectName("lblIcon");
m_lblHeader->setObjectName("lblHeaderText");
m_lblText->setObjectName("lblText");
m_lblBottomLine->setObjectName("lblBottomLine");
m_lblHeader->setText(model.text);
m_lblHeader->setWordWrap(true);
m_lblText->setText(model.aboutText);
m_lblText->setWordWrap(true);
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
m_lblIcon->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
m_lblHeader->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
m_lblText->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
m_topLayout->addWidget(m_lblHeader);
m_topLayout->addWidget(m_lblIcon);
m_mainLayout->addLayout(m_topLayout);
m_mainLayout->addWidget(m_lblText);
m_mainLayout->addWidget(m_lblBottomLine);
setLayout(m_mainLayout);
m_topLayout->setSpacing(0);
m_topLayout->setMargin(0);
m_mainLayout->setSpacing(0);
m_mainLayout->setMargin(0);
m_topLayout->setAlignment(m_lblHeader,Qt::AlignTop);
m_topLayout->setAlignment(m_lblIcon,Qt::AlignTop);
m_mainLayout->setAlignment(m_lblText,Qt::AlignLeft);
m_lblText->setVisible(false);
show();
}
void FAQWidget::mousePressEvent(QMouseEvent *event)
{
if(!m_lblText->isVisible())
{
m_lblIcon->setProperty("state","arow-down");
m_lblText->setVisible(true);
style()->unpolish(m_lblIcon);
style()->polish(m_lblIcon);
update();
}
else
{
m_lblIcon->setProperty("state","default");
m_lblText->setVisible(false);
style()->unpolish(m_lblIcon);
style()->polish(m_lblIcon);
update();
}
QWidget::mousePressEvent(event);
}
#ifndef FAQWIDGET_H
#define FAQWIDGET_H
#include <QWidget>
#include <QLabel>
#include <QBoxLayout>
#include <QTextEdit>
#include <QStyle>
#include "CustomLineHeightLabel.h"
struct FAQDataModel
{
QString text;
QString aboutText;
};
class FAQWidget: public QWidget
{
Q_OBJECT
public:
/// Widget constructor.
/// @param model Data from model with text.
/// @param parent
FAQWidget(const FAQDataModel &model, QWidget *parent = nullptr);
protected:
/// Expands and closes the list, changes the settings for the style.
/// @param event
void mousePressEvent(QMouseEvent *event);
private:
//Right arrow icon
QLabel *m_lblIcon;
//Reference Information Description
CustomLineHeightLabel *m_lblHeader;
//Description of the problem
CustomLineHeightLabel *m_lblText;
//Line under the description
QLabel *m_lblBottomLine;
QHBoxLayout *m_topLayout;
QVBoxLayout *m_mainLayout;
};
#endif // FAQWIDGET_H
......@@ -4,17 +4,12 @@
#include <QAbstractListModel>
#include <QDebug>
#include <QString>
#include <QStringList>
//class ListModel
//{
//public:
// ListModel();
//};
struct DataModel
{
QString iconPath;
QString text;
QString aboutText;
};
......
......@@ -9,6 +9,7 @@ SOURCES += \
$$PWD/CustomPlacementButton.cpp \
$$PWD/CustomPlacementButton_New.cpp \
$$PWD/CustomWidget.cpp \
$$PWD/FAQWidget.cpp \
$$PWD/ListModel.cpp \
$$PWD/ServersComboBox.cpp \
$$PWD/AnimatedLineEdit.cpp \
......@@ -27,6 +28,7 @@ HEADERS += \
$$PWD/CustomPlacementButton.h \
$$PWD/CustomPlacementButton_New.h \
$$PWD/CustomWidget.h \
$$PWD/FAQWidget.h \
$$PWD/ListModel.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