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

[-]delete button _New

parent f65c7dde
2 merge requests!17Develop old,!15[-]delete button _New
......@@ -40,7 +40,7 @@ void CustomComboBoxPopup::setModel(QList<DataModel> *model)
for(int i=0; i<model->size();i++)
{
// CustomPlacementButton_New tmp;
m_listButton.append(new CustomPlacementButton_New());
m_listButton.append(new CustomPlacementButton());
m_listButton.last()->setIcon(model->at(i).iconPath);
m_listButton.last()->setText(model->at(i).text);
m_listButton.last()->setObjectName("btnServer");
......@@ -64,7 +64,7 @@ void CustomComboBoxPopup::setModel(QAbstractItemModel *a_model)
for(int i=0; i<a_model->rowCount(); i++)
{
// CustomPlacementButton_New tmp;
CustomPlacementButton_New *newButton = new CustomPlacementButton_New;
CustomPlacementButton *newButton = new CustomPlacementButton;
m_listButton.append(newButton);
// newButton->setIcon(a_model->at(i).iconPath);
newButton->setText(a_model->data(a_model->index(i, 0)).toString());
......
......@@ -7,7 +7,7 @@
#include <QStandardItemModel>
#include <QStandardItem>
#include <QScrollArea>
#include "CustomPlacementButton_New.h"
#include "CustomPlacementButton.h"
struct DataModel
......@@ -39,7 +39,7 @@ private:
QVBoxLayout *m_layoutScroll;
QLabel *m_lblCaption;
QScrollArea *m_scaList;
QList<CustomPlacementButton_New*> m_listButton;
QList<CustomPlacementButton*> m_listButton;
};
#endif // CUSTOMCOMBOBOXPOPUP_H
#include "CustomPlacementButton.h"
#include "AppStyleSheetHandler.h"
#include "defines.h"
/** @brief constructor
* @param a_parent object parent
*/
......@@ -7,17 +9,23 @@ CustomPlacementButton::CustomPlacementButton(QWidget *a_parent)
:QPushButton (a_parent),
m_layout (new QHBoxLayout(this)),
m_lbLeftSpacing (this),
m_lbImage (new StyledSubcontrol("image", this)),
m_lbText (new StyledSubcontrol("text", this)),
m_lbImage (this),
m_lbText (this),
m_lbRightSpacing(this)
{
m_subcontrols.append(m_lbImage);
m_subcontrols.append(m_lbText);
// Set up subcontroll object names:
m_lbLeftSpacing .setObjectName("leftSpacing");
m_lbImage .setObjectName("image");
m_lbText .setObjectName("text");
m_lbRightSpacing.setObjectName("rightSpacing");
m_lbRightSpacing.setVisible(false);
m_lbLeftSpacing.setVisible(false);
m_subcontrols.append(&m_lbImage);
m_subcontrols.append(&m_lbText);
// Set up subcontroll object names:
//Setup layout
m_layout->setMargin(0);
m_layout->setSpacing(0);
......@@ -28,18 +36,21 @@ CustomPlacementButton::CustomPlacementButton(QWidget *a_parent)
//Adding subcontrols to layout
m_layout->addWidget(&m_lbLeftSpacing);
for (StyledSubcontrol *subcontrol: m_subcontrols){
for (QLabel *subcontrol: m_subcontrols)
{
// Set up subcontroll ScaledContents:
subcontrol->widget()->setScaledContents(true);
m_layout->addWidget(subcontrol->widget());
subcontrol->setScaledContents(true);
m_layout->addWidget(subcontrol);
CustomPlacementButton::setWidgetState(subcontrol);
}
m_layout->addWidget(&m_lbRightSpacing);
setLayout(m_layout);
// on toggled update Appearance
connect(this, &QAbstractButton::toggled, [=]() {
this->updateAppearance();
connect(this, &QAbstractButton::toggled, [=](bool a_checked) {
this->setState(this->underMouse(), a_checked);
});
}
......@@ -48,49 +59,29 @@ CustomPlacementButton::CustomPlacementButton(QWidget *a_parent)
*/
void CustomPlacementButton::setText(const QString &text)
{
m_lbText->widget()->setText(text);
m_lbText.setText(text);
}
/** @brief Reimplemented QPushButton::setObjectName method. Updates stylesheets.
* @param text Text
*/
void CustomPlacementButton::setObjectName(const QString &name)
void CustomPlacementButton::setIcon(const QString &path)
{
QObject::setObjectName(name);
updateStyleSheets();
QPixmap icon(path);
m_lbImage.setPixmap(icon);
}
/** @brief Reimplemented QAbstractButton::setCheckable method. Updates stylesheets.
* @param checkable whether button is checkable
/** @brief Updates appearance of image and text
*/
void CustomPlacementButton::setCheckable(bool checkable)
void CustomPlacementButton::setState(bool isHover, bool isChecked)
{
QPushButton::setCheckable(checkable);
const char* hoverProperty = qPrintable(Properties::HOVER);
const char* checkedProperty = qPrintable(Properties::CHECKED);
updateStyleSheets();
}
if (isHover != this->property(hoverProperty) && isChecked != this->property(checkedProperty))
{
for (QLabel *subcontrol: m_subcontrols)
setWidgetState(subcontrol, isHover, isChecked);
/** @brief Initialization of image and text stylesheets
*/
void CustomPlacementButton::updateStyleSheets()
{
for (StyledSubcontrol *subcontrol: m_subcontrols){
subcontrol->updateStylesheets();
setWidgetState(this, isHover, isChecked);
}
updateAppearance();
}
/** @brief Updates appearance of image and text
*/
void CustomPlacementButton::updateAppearance()
{
for (StyledSubcontrol *subcontrol: m_subcontrols){
bool isHover = isEnabled() ? underMouse() : false;
subcontrol->setStylesheet(isHover, isChecked());
}
update();//for appliyng hover/normal stylesheet of button
}
/** @brief add new subcontrol and place it in layout
......@@ -98,14 +89,14 @@ void CustomPlacementButton::updateAppearance()
*/
void CustomPlacementButton::addSubcontrol(QString a_id)
{
StyledSubcontrol *newSubcontrol = new StyledSubcontrol(a_id, this);
newSubcontrol->widget()->setScaledContents(true);
QLabel *newSubcontrol = new QLabel((QPushButton*)this);
newSubcontrol->setObjectName(a_id);
CustomPlacementButton::setWidgetState(newSubcontrol, this->underMouse(), isChecked());
//add to list and layout
m_subcontrols.append(newSubcontrol);
m_layout->insertWidget(m_layout->count() - 1, newSubcontrol->widget());
updateStyleSheets();
m_layout->insertWidget(m_layout->count() - 1, newSubcontrol);
}
/** @brief Set image position relative to text (left or right)
......@@ -113,19 +104,25 @@ void CustomPlacementButton::addSubcontrol(QString a_id)
*/
void CustomPlacementButton::setImagePosition(ImagePos a_position /*= ImagePos::Left*/)
{
int imageIndex = m_layout->indexOf(m_lbImage->widget());
int imageIndex = m_layout->indexOf(&m_lbImage);
if (a_position == ImagePos::Left && imageIndex == 2)
{
m_layout->removeWidget(m_lbImage->widget());
m_layout->insertWidget(1, m_lbImage->widget());
m_layout->removeWidget(&m_lbImage);
m_layout->insertWidget(1, &m_lbImage);
}
else if (a_position == ImagePos::Right && imageIndex == 1)
{
m_layout->removeWidget(m_lbImage->widget());
m_layout->insertWidget(2, m_lbImage->widget());
m_layout->removeWidget(&m_lbImage);
m_layout->insertWidget(2, &m_lbImage);
}
}
void CustomPlacementButton::setGraphicsEffect(StyledDropShadowEffect *a_effect)
{
m_styledShadow = a_effect;
QPushButton::setGraphicsEffect(a_effect);
}
/** @brief event is sent to the widget when the mouse cursor enters the widget.
* @param event
......@@ -135,7 +132,10 @@ void CustomPlacementButton::enterEvent(QEvent *event)
Q_UNUSED(event);
if (isEnabled())
updateAppearance();
setState(true, isChecked());
if (m_styledShadow)
m_styledShadow->updateStyle(HOVER_SHADOW);
}
/** @brief A leave event is sent to the widget when the mouse cursor leaves the widget.
......@@ -146,19 +146,31 @@ void CustomPlacementButton::leaveEvent(QEvent *event)
Q_UNUSED(event);
if (isEnabled())
updateAppearance();
setState(false, isChecked());
if (m_styledShadow)
m_styledShadow->updateStyle(DEFAULT_SHADOW);
}
/** @brief Reimplemented QWidget::changeEvent is sent to the widget when "enabled" changed.
* @param event
*/
void CustomPlacementButton::changeEvent(QEvent *event)
void CustomPlacementButton::setWidgetState(QWidget *a_widget, bool a_isHover, bool a_isChecked)
{
if (event->type() == QEvent::EnabledChange) {
const char* hoverProperty = qPrintable(Properties::HOVER);
const char* checkedProperty = qPrintable(Properties::CHECKED);
updateAppearance();
a_widget->setProperty(hoverProperty , a_isHover );
a_widget->setProperty(checkedProperty, a_isChecked);
return QWidget::changeEvent(event);
}
return QWidget::changeEvent(event);
a_widget->style()->unpolish(a_widget);
a_widget->style()->polish (a_widget);
}
/** @brief Reimplemented QPushButton::setObjectName method. Updates stylesheets.
* @param name Name
*/
void CustomPlacementButton::setObjectName(const QString &name)
{
QPushButton::setObjectName(name);
if (m_styledShadow)
m_styledShadow->updateStyleProperties();
}
#ifndef CUSTOMPLACEMENTBUTTON_H
#define CUSTOMPLACEMENTBUTTON_H
#ifndef CUSTOMPLACEMENTBUTTON_NEW_H
#define CUSTOMPLACEMENTBUTTON_NEW_H
#include <QPushButton>
#include <QHBoxLayout>
#include <QStyle>
#include <QDebug>
#include <QEvent>
#include "StyledSubcontrol.h"
#include <QLabel>
#include "StyledDropShadowEffect.h"
#include <QFontMetrics>
enum class ImagePos {Left, Right};
/** @brief QPushButton with subControls "text" and "image"
*
*
* @details Places image and text from left to right in QHBoxLayout.
* Set style in .css file in format
* Set style in .css file in format
*> #buttonName #leftSpacing {
*> ...; //if max-width==0, left alinment
*> }
*> #buttonName::text {
*> ...
*> }
*> #buttonName::text:hover {
*> #buttonName::text[hover="true"] {
*> ...
*> }
*> #buttonName::text:checked {
*> #buttonName::text[checked = "true"] {
*> ...
*> }
*> #buttonName::text:checked:hover {
......@@ -33,10 +34,10 @@ enum class ImagePos {Left, Right};
*> #buttonName::image {
*> ...
*> }
*> #buttonName::image:hover {
*> #buttonName::image[hover="true"]{
*> ...
*> }
*> #buttonName::image:checked {
*> #buttonName::image[checked = "true"]{
*> ...
*> }
*> #buttonName::image:checked:hover {
......@@ -53,29 +54,48 @@ class CustomPlacementButton : public QPushButton
public:
explicit CustomPlacementButton(QWidget *a_parent = Q_NULLPTR);
/// Set text button.
/// @param text Set text.
void setText(const QString &text);
/// Form initialization.
/// @param path Path to Image.
void setIcon(const QString &path);
/// Set object name..
/// @param name Object name.
void setObjectName(const QString &name);
void setCheckable(bool checkable);
void updateStyleSheets();
void updateAppearance();
/// Sets the state of the button.
/// @param isHover
/// @param isChecked
void setState(bool isHover, bool isChecked);
/// .
/// @param a_id Window GUI widget.
void addSubcontrol(QString a_id);
/// Image Position on button.
/// @param a_position Enum ImagePos Right or Left.
void setImagePosition(ImagePos a_position = ImagePos::Left);
void setGraphicsEffect(StyledDropShadowEffect *a_effect);
private:
///For effect.
StyledDropShadowEffect *m_styledShadow = nullptr;
protected:
/// Cursor in.
/// @param event Signal source.
void enterEvent(QEvent *event);
/// Cursor out.
/// @param event Signal source.
void leaveEvent(QEvent *event);
void changeEvent(QEvent * event);
QHBoxLayout *m_layout;
QLabel m_lbLeftSpacing; ///<label for left spacing
QList<StyledSubcontrol*> m_subcontrols;
StyledSubcontrol *m_lbImage; ///<label with image
StyledSubcontrol *m_lbText; ///<label with text
QList<QLabel*> m_subcontrols;
QLabel m_lbImage; ///<label with image
QLabel m_lbText; ///<label with text
QLabel m_lbRightSpacing; ///<label for right spacing
private:
static void setWidgetState(QWidget* a_widget, bool a_isHover=false, bool a_isChecked = false);
};
#endif // CUSTOMPLACEMENTBUTTON_H
#endif // CUSTOMPLACEMENTBUTTON_NEW_H
#include "CustomPlacementButton_New.h"
#include "AppStyleSheetHandler.h"
#include "defines.h"
/** @brief constructor
* @param a_parent object parent
*/
CustomPlacementButton_New::CustomPlacementButton_New(QWidget *a_parent)
:QPushButton (a_parent),
m_layout (new QHBoxLayout(this)),
m_lbLeftSpacing (this),
m_lbImage (this),
m_lbText (this),
m_lbRightSpacing(this)
{
m_lbLeftSpacing .setObjectName("leftSpacing");
m_lbImage .setObjectName("image");
m_lbText .setObjectName("text");
m_lbRightSpacing.setObjectName("rightSpacing");
m_lbRightSpacing.setVisible(false);
m_lbLeftSpacing.setVisible(false);
m_subcontrols.append(&m_lbImage);
m_subcontrols.append(&m_lbText);
// Set up subcontroll object names:
//Setup layout
m_layout->setMargin(0);
m_layout->setSpacing(0);
//Setup spacing setSizePolicy
m_lbLeftSpacing .setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_lbRightSpacing.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
//Adding subcontrols to layout
m_layout->addWidget(&m_lbLeftSpacing);
for (QLabel *subcontrol: m_subcontrols)
{
// Set up subcontroll ScaledContents:
subcontrol->setScaledContents(true);
m_layout->addWidget(subcontrol);
CustomPlacementButton_New::setWidgetState(subcontrol);
}
m_layout->addWidget(&m_lbRightSpacing);
setLayout(m_layout);
// on toggled update Appearance
connect(this, &QAbstractButton::toggled, [=](bool a_checked) {
this->setState(this->underMouse(), a_checked);
});
}
/** @brief Reimplemented QPushButton::setText method. Sets text property of text subcontrol.
* @param text Text
*/
void CustomPlacementButton_New::setText(const QString &text)
{
m_lbText.setText(text);
}
void CustomPlacementButton_New::setIcon(const QString &path)
{
QPixmap icon(path);
m_lbImage.setPixmap(icon);
}
/** @brief Updates appearance of image and text
*/
void CustomPlacementButton_New::setState(bool isHover, bool isChecked)
{
const char* hoverProperty = qPrintable(Properties::HOVER);
const char* checkedProperty = qPrintable(Properties::CHECKED);
if (isHover != this->property(hoverProperty) && isChecked != this->property(checkedProperty))
{
for (QLabel *subcontrol: m_subcontrols)
setWidgetState(subcontrol, isHover, isChecked);
setWidgetState(this, isHover, isChecked);
}
}
/** @brief add new subcontrol and place it in layout
* @param a_id text id of subcontrol wich is using in CSS file
*/
void CustomPlacementButton_New::addSubcontrol(QString a_id)
{
// StyledSubcontrol_New *newSubcontrol = new StyledSubcontrol_New(a_id, this);
QLabel *newSubcontrol = new QLabel((QPushButton*)this);
newSubcontrol->setObjectName(a_id);
CustomPlacementButton_New::setWidgetState(newSubcontrol, this->underMouse(), isChecked());
//add to list and layout
m_subcontrols.append(newSubcontrol);
m_layout->insertWidget(m_layout->count() - 1, newSubcontrol);
}
/** @brief Set image position relative to text (left or right)
* @param a_position image position relatife to text (Left/Right)
*/
void CustomPlacementButton_New::setImagePosition(ImagePos a_position /*= ImagePos::Left*/)
{
int imageIndex = m_layout->indexOf(&m_lbImage);
if (a_position == ImagePos::Left && imageIndex == 2)
{
m_layout->removeWidget(&m_lbImage);
m_layout->insertWidget(1, &m_lbImage);
}
else if (a_position == ImagePos::Right && imageIndex == 1)
{
m_layout->removeWidget(&m_lbImage);
m_layout->insertWidget(2, &m_lbImage);
}
}
void CustomPlacementButton_New::setGraphicsEffect(StyledDropShadowEffect *a_effect)
{
m_styledShadow = a_effect;
QPushButton::setGraphicsEffect(a_effect);
}
/** @brief event is sent to the widget when the mouse cursor enters the widget.
* @param event
*/
void CustomPlacementButton_New::enterEvent(QEvent *event)
{
Q_UNUSED(event);
if (isEnabled())
setState(true, isChecked());
if (m_styledShadow)
m_styledShadow->updateStyle(HOVER_SHADOW);
}
/** @brief A leave event is sent to the widget when the mouse cursor leaves the widget.
* @param event
*/
void CustomPlacementButton_New::leaveEvent(QEvent *event)
{
Q_UNUSED(event);
if (isEnabled())
setState(false, isChecked());
if (m_styledShadow)
m_styledShadow->updateStyle(DEFAULT_SHADOW);
}
void CustomPlacementButton_New::setWidgetState(QWidget *a_widget, bool a_isHover, bool a_isChecked)
{
const char* hoverProperty = qPrintable(Properties::HOVER);
const char* checkedProperty = qPrintable(Properties::CHECKED);
a_widget->setProperty(hoverProperty , a_isHover );
a_widget->setProperty(checkedProperty, a_isChecked);
a_widget->style()->unpolish(a_widget);
a_widget->style()->polish (a_widget);
}
/** @brief Reimplemented QPushButton::setObjectName method. Updates stylesheets.
* @param name Name
*/
void CustomPlacementButton_New::setObjectName(const QString &name)
{
QPushButton::setObjectName(name);
if (m_styledShadow)
m_styledShadow->updateStyleProperties();
}
#ifndef CUSTOMPLACEMENTBUTTON_NEW_H
#define CUSTOMPLACEMENTBUTTON_NEW_H
#include <QPushButton>
#include <QHBoxLayout>
#include <QStyle>
#include <QDebug>
#include <QEvent>
#include <QLabel>
#include "StyledDropShadowEffect.h"
#include <QFontMetrics>
enum class ImagePos {Left, Right};
/** @brief QPushButton with subControls "text" and "image"
*
* @details Places image and text from left to right in QHBoxLayout.
* Set style in .css file in format
*> #buttonName #leftSpacing {
*> ...; //if max-width==0, left alinment
*> }
*> #buttonName::text {
*> ...
*> }
*> #buttonName::text[hover="true"] {
*> ...
*> }
*> #buttonName::text[checked = "true"] {
*> ...
*> }
*> #buttonName::text:checked:hover {
*> ...
*> }
*> #buttonName::image {
*> ...
*> }
*> #buttonName::image[hover="true"]{
*> ...
*> }
*> #buttonName::image[checked = "true"]{
*> ...
*> }
*> #buttonName::image:checked:hover {
*> ...
*> }
*> #buttonName #rightSpacing {
*> ...//if max-width==0, right alignment
*> }
* @todo Is searching style in comments also!
*/
class CustomPlacementButton_New : public QPushButton
{
Q_OBJECT
public:
explicit CustomPlacementButton_New(QWidget *a_parent = Q_NULLPTR);
/// Set text button.
/// @param text Set text.
void setText(const QString &text);
/// Form initialization.
/// @param path Path to Image.
void setIcon(const QString &path);
/// Set object name..
/// @param name Object name.
void setObjectName(const QString &name);
/// Sets the state of the button.
/// @param isHover
/// @param isChecked
void setState(bool isHover, bool isChecked);
/// .
/// @param a_id Window GUI widget.
void addSubcontrol(QString a_id);
/// Image Position on button.
/// @param a_position Enum ImagePos Right or Left.
void setImagePosition(ImagePos a_position = ImagePos::Left);
void setGraphicsEffect(StyledDropShadowEffect *a_effect);
private:
///For effect.
StyledDropShadowEffect *m_styledShadow = nullptr;
protected:
/// Cursor in.
/// @param event Signal source.
void enterEvent(QEvent *event);
/// Cursor out.
/// @param event Signal source.
void leaveEvent(QEvent *event);
QHBoxLayout *m_layout;
QLabel m_lbLeftSpacing; ///<label for left spacing
QList<QLabel*> m_subcontrols;
QLabel m_lbImage; ///<label with image
QLabel m_lbText; ///<label with text
QLabel m_lbRightSpacing; ///<label for right spacing
private:
static void setWidgetState(QWidget* a_widget, bool a_isHover=false, bool a_isChecked = false);
};
#endif // CUSTOMPLACEMENTBUTTON_NEW_H
#include "StyledSubcontrol.h"
#include "AppStyleSheetHandler.h"
#include <QDebug>
#include <QPushButton>
/** @brief Constructor
* @param a_id Text id of new subcontrol
* @param a_parent Object parent
*/
StyledSubcontrol::StyledSubcontrol(QString a_id, QWidget *a_parent)
: QObject (a_parent)
, m_widget(new QLabel(a_parent))
{
m_widget->setObjectName(a_id);
}
/** @brief Gettter for id
*/
QString StyledSubcontrol::id()
{
return m_widget->objectName();
}
/** @brief Gettter for widget
*/
QLabel *StyledSubcontrol::widget()
{
return m_widget;
}
/** @brief Reload stylesheets from StyleHolder
*/
void StyledSubcontrol::updateStylesheets()
{
QString objName = parent()->objectName();
objName = objName.simplified().replace(" ", "");
// If objName isn't empty
if (objName.isEmpty())
qWarning() << "CustomPlacementButton hasn't Object name";
else {
objName = "#" + objName;
// Initialize stylesheets
StyleSheatSearchPar searchPar;
searchPar.widgetName = objName;
searchPar.subcontrol = id();
m_normalStylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
searchPar.pseudoClass = "hover";
m_hoverStylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
//if isCheckable initialize checked stylesheet
if (qobject_cast<QPushButton*>(parent())->isCheckable()) {
searchPar.pseudoClass = "checked";
m_checkedStylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
searchPar.pseudoClass = "(?:checked:hover|hover:checked)";
m_checkedHoverStylesheet = AppStyleSheetHandler::getWidgetStyleSheet(searchPar);
}
}
}
/** @brief Apply stylesheet for particular state of CustomPlacementButton to it's own subcontrol widget
* @param a_hover Is CustomPlacementButton hovered
* @param a_checked Is CustomPlacementButton checked
*/
void StyledSubcontrol::setStylesheet(bool a_hover, bool a_checked)
{
widget()->setStyleSheet(styleSheet(a_hover, a_checked));
}
/** @brief Get stylesheet for particular state of CustomPlacementButton
* @param a_hover Is CustomPlacementButton hovered
* @param a_checked Is CustomPlacementButton checked
* @return Prepeared stylesheet for all active states
*/
QString StyledSubcontrol::styleSheet(bool a_hover, bool a_checked/*= false*/)
{
QString strStyle(m_normalStylesheet);
//if hover - add hover stylesheet
if (a_hover)
strStyle += ";" + m_hoverStylesheet;
//if isCheckable and checked - add checked stylesheet
bool isCheckable = qobject_cast<QPushButton*>(parent())->isCheckable();
if (isCheckable && a_checked) {
if (a_hover)
strStyle += ";" + m_checkedHoverStylesheet;
else
strStyle += ";" + m_checkedStylesheet;
}
return strStyle;
}
#ifndef STYLEDSUBCONTROL_H
#define STYLEDSUBCONTROL_H
#include <QObject>
#include <QLabel>
#include "AppStyleSheetHandler.h"
#include <QDebug>
/** @brief Class that consist stylesheets for all object states
*
* @details
* @todo Search style in comments also!
*/
class StyledSubcontrol: public QObject {
Q_OBJECT
public:
enum SubcontrolTypes {Image, Text};
StyledSubcontrol(QString a_id, QWidget *a_parent);
QString id();
QLabel *widget();
void updateStylesheets();
void setStylesheet(bool a_hover, bool a_checked);
QString styleSheet(bool a_hover, bool a_checked = false);
private:
QString m_normalStylesheet; ///< Subcontrol StyleSheet in normal state of CustomPlacementButton
QString m_hoverStylesheet; ///< Subcontrol StyleSheet in hover state of CustomPlacementButton
QString m_checkedStylesheet; ///< Subcontrol StyleSheet in checked state of CustomPlacementButton
QString m_checkedHoverStylesheet; ///< Subcontrol StyleSheet in checked and hover state of CustomPlacementButton
QLabel *m_widget;
};
#endif // STYLEDSUBCONTROL_H
......@@ -7,13 +7,11 @@ SOURCES += \
$$PWD/CustomLineHeightLabel.cpp \
$$PWD/CustomLineHeightTextEdit.cpp \
$$PWD/CustomPlacementButton.cpp \
$$PWD/CustomPlacementButton_New.cpp \
$$PWD/FAQWidget.cpp \
$$PWD/ServersComboBox.cpp \
$$PWD/AnimatedLineEdit.cpp \
$$PWD/ScreenOverlaying.cpp \
$$PWD/StyledDropShadowEffect.cpp \
$$PWD/StyledSubcontrol.cpp
$$PWD/StyledDropShadowEffect.cpp
HEADERS += \
$$PWD/AdaptiveWidget.h \
......@@ -24,13 +22,11 @@ HEADERS += \
$$PWD/CustomLineHeightLabel.h \
$$PWD/CustomLineHeightTextEdit.h \
$$PWD/CustomPlacementButton.h \
$$PWD/CustomPlacementButton_New.h \
$$PWD/FAQWidget.h \
$$PWD/ServersComboBox.h \
$$PWD/AnimatedLineEdit.h \
$$PWD/ScreenOverlaying.h \
$$PWD/StyledDropShadowEffect.h \
$$PWD/StyledSubcontrol.h
$$PWD/StyledDropShadowEffect.h
INCLUDEPATH += $$PWD
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