version 2.17.0

iconedlabel icon size scale in auto scale mode
BlockItem decors visibility logic flags
This commit is contained in:
2023-06-05 23:26:23 +03:00
parent f6205cab55
commit 7ce2b31ec9
12 changed files with 243 additions and 78 deletions

View File

@@ -55,7 +55,7 @@ void IconedLabel::checkSpacing() {
QSize IconedLabel::realIconSize() const {
return size_.isValid() ? size_ : preferredIconSize(1.f, this);
return size_.isEmpty() ? preferredIconSize(m_iconSizeAutoScale, this) : size_;
}
@@ -96,3 +96,9 @@ void IconedLabel::setDirection(IconedLabel::Direction d) {
checkSpacing();
update();
}
void IconedLabel::setIconSizeAutoScale(double newIconSizeAutoScale) {
m_iconSizeAutoScale = newIconSizeAutoScale;
setIconSize(iconSize());
}

View File

@@ -33,6 +33,7 @@ class QAD_WIDGETS_EXPORT IconedLabel: public QFrame {
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
Q_PROPERTY(double iconSizeAutoScale READ iconSizeAutoScale WRITE setIconSizeAutoScale)
public:
enum Direction {
@@ -51,6 +52,9 @@ public:
QLabel * textLabel() { return &label_; }
double iconSizeAutoScale() const { return m_iconSizeAutoScale; }
void setIconSizeAutoScale(double newIconSizeAutoScale);
public slots:
void setText(const QString & t);
void setIcon(const QIcon & i);
@@ -66,6 +70,7 @@ protected:
QIcon sicon_;
QSize size_;
Direction dir_;
double m_iconSizeAutoScale = 1.;
};
#endif // ICONEDLABEL_H