[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: PATCH: KProgress (#44279)
From: Maks Orlovich <mo002j () mail ! rochester ! edu>
Date: 2002-12-14 1:03:31
[Download RAW message or body]
(Sending here as no maintainer listed in the MAINTAINERS file, and it is to
kdelibs)...
Hi..
In short: The attached patch tries to address #44279 by having KProgress turn
on centering of the indicator when a custom format string is set.
Background: LightV2, LightV3, and some Qt styles (Qt Platinum, Qt Windows)
draw the text string for the progressbar on the side of it, and not centered.
That requires laying out the space for the text in advance (since otherwise
the length of the bar section may change - ugly). That's easy when there are
percentages - at most 4 digits will be output; but that's pretty much
impossible with arbitrary format strings KProgress supports (and besides,
there may simply not be enough room). Thus, right now they don't work well at
all with the above mentionned styles. The patch just forces the indicator to
center on the user setting a format string other then %p%. It's somewhat ugly
in that it triggers a behavior change based on an unrelated settings, but
it's:
a. documented in the patch.
b. A lot better than having the text cutoff.
c. Invisible in all other styles, which do the centering anyway..
Comments, suggestions?
Thanks,
Maksim
["kprog.diff" (text/x-diff)]
Index: kprogress.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kprogress.h,v
retrieving revision 1.31
diff -u -3 -p -r1.31 kprogress.h
--- kprogress.h 21 May 2002 16:55:30 -0000 1.31
+++ kprogress.h 14 Dec 2002 00:52:50 -0000
@@ -111,6 +111,10 @@ public slots:
*
* The default format is "%p%" (which looks like "42%".)
*
+ * Note: Setting the format to anything other then "%p%" will force centerIndicator to true,
+ * since it's often impossible to layout a progressbar with a more general format with the
+ * indicator string anywhere else.
+ *
* @param format %p is replaced by percentage done, %v is replaced by actual
* value, %m is replaced by the maximum value.
*/
Index: kprogress.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kprogress.cpp,v
retrieving revision 1.40
diff -u -3 -p -r1.40 kprogress.cpp
--- kprogress.cpp 23 May 2002 17:36:31 -0000 1.40
+++ kprogress.cpp 14 Dec 2002 00:52:50 -0000
@@ -107,6 +107,8 @@ bool KProgress::textEnabled() const
void KProgress::setFormat(const QString & format)
{
mFormat = format;
+ if (mFormat != "%p%")
+ setCenterIndicator(true);
}
QString KProgress::format() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic