[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2043: Make VClickLabel right-to-left aware. (in trunk: . src/gui/common)
Author: edmanm
Date: 2007-10-19 02:39:38 -0400 (Fri, 19 Oct 2007)
New Revision: 2043
Modified:
trunk/
trunk/src/gui/common/vclicklabel.cpp
Log:
r2147@lysithea: edmanm | 2007-10-19 02:39:33 -0400
Make VClickLabel right-to-left aware.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2147] on dc66be73-d13e-47ba-a267-8dc7cda68c65
Modified: trunk/src/gui/common/vclicklabel.cpp
===================================================================
--- trunk/src/gui/common/vclicklabel.cpp 2007-10-19 06:19:19 UTC (rev 2042)
+++ trunk/src/gui/common/vclicklabel.cpp 2007-10-19 06:39:38 UTC (rev 2043)
@@ -26,6 +26,7 @@
*/
#include <QPainter>
+#include <vidalia.h>
#include "vclicklabel.h"
@@ -61,10 +62,22 @@
{
QPainter p(this);
QRect rect = this->rect();
- if (!_pixmap.isNull())
- p.drawPixmap(0, qMax((rect.height()-_pixmap.height())/2,0), _pixmap);
- if (!_text.isEmpty())
- p.drawText(_pixmap.width()+2, (rect.height()+fontInfo().pixelSize())/2, _text);
+
+ if (vApp->isLeftToRight()) {
+ if (!_pixmap.isNull())
+ p.drawPixmap(0, qMax((rect.height()-_pixmap.height())/2, 0), _pixmap);
+ if (!_text.isEmpty())
+ p.drawText(_pixmap.width()+2, (rect.height()+fontInfo().pixelSize())/2, _text);
+ } else {
+ if (!_pixmap.isNull())
+ p.drawPixmap(qMax(rect.right()-_pixmap.width(), 0),
+ qMax((rect.height()-_pixmap.height())/2, 0), _pixmap);
+ if (!_text.isEmpty()) {
+ int textWidth = fontMetrics().width(_text);
+ p.drawText(qMax(rect.right()-_pixmap.width()-textWidth-2, 0),
+ (rect.height()+fontInfo().pixelSize())/2, _text);
+ }
+ }
e->accept();
}