KCapacityBar's painting code
David Faure
faure at kde.org
Fri Oct 11 09:25:21 UTC 2013
Hi Stephen,
The commit below removed the initialisation of d->ce_capacityBar,
but this variable is still used in KCapacityBar::drawCapacityBar.
Can we remove that block of code completely?
commit daef0997ef7dab76a5b0ace55cbe1009f8a86c0d
Author: Stephen Kelly <steveire at gmail.com>
Date: Mon May 14 22:29:54 2012 +0200
Make KCapacityBar 'KDE free'
All styling should be done in the style implementation.
}
void KCapacityBar::drawCapacityBar(QPainter *p, const QRect &rect) const
{
if (d->ce_capacityBar)
{
QStyleOptionProgressBar opt;
opt.initFrom(this);
opt.rect = rect;
opt.minimum = 0;
opt.maximum = 100;
opt.progress = d->value;
opt.text = d->text;
opt.textAlignment = Qt::AlignCenter;
opt.textVisible = true;
style()->drawControl(d->ce_capacityBar, &opt, p, this);
return;
}
[...]
}
Since the "[...]" contains the actual painting code, I assume the above block
can be removed, but I'm confused because the commit log seems to contradict
that. There can't be any styling in the style implementation if we never call
the style in order to do the drawing...
Or is the idea to add a way for styles to set ce_capacityBar (and to
initialize it to 0)?
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list