mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 16:27:01 -05:00
Merge pull request #549 from PhenomRetroShare/Fix_PR#536
Fix PR#536 revealing of bad factor management in StyledElidedLabel.
This commit is contained in:
commit
7e536efe66
@ -25,19 +25,24 @@
|
|||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
StyledElidedLabel::StyledElidedLabel(QWidget *parent)
|
StyledElidedLabel::StyledElidedLabel(QWidget *parent)
|
||||||
: ElidedLabel(parent)
|
: ElidedLabel(parent), _lastFactor(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledElidedLabel::StyledElidedLabel(const QString &text, QWidget *parent)
|
StyledElidedLabel::StyledElidedLabel(const QString &text, QWidget *parent)
|
||||||
: ElidedLabel(text, parent)
|
: ElidedLabel(text, parent), _lastFactor(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyledElidedLabel::setFontSizeFactor(int factor)
|
void StyledElidedLabel::setFontSizeFactor(int factor)
|
||||||
{
|
{
|
||||||
QFont f = font();
|
int newFactor = factor;
|
||||||
qreal fontSize = factor * f.pointSizeF() / 100;
|
if (factor > 0) {
|
||||||
f.setPointSizeF(fontSize);
|
if (_lastFactor > 0) newFactor = 100 + factor - _lastFactor;
|
||||||
setFont(f);
|
_lastFactor = factor;
|
||||||
|
QFont f = font();
|
||||||
|
qreal fontSize = newFactor * f.pointSizeF() / 100;
|
||||||
|
f.setPointSizeF(fontSize);
|
||||||
|
setFont(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,9 @@ public:
|
|||||||
StyledElidedLabel(const QString &text, QWidget *parent = NULL);
|
StyledElidedLabel(const QString &text, QWidget *parent = NULL);
|
||||||
|
|
||||||
void setFontSizeFactor(int factor);
|
void setFontSizeFactor(int factor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int _lastFactor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user