summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-01-13 16:05:45 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-01-13 16:06:46 (GMT)
commit6824471ce5302c6352519a8908c6c3d3ecebaadb (patch)
tree3daf8498bfcd317d6598fde26b47119451d94a0b
parente029b5b7bf8cb8815e33a1e08b6a609dafa25f52 (diff)
downloadQt-6824471ce5302c6352519a8908c6c3d3ecebaadb.zip
Qt-6824471ce5302c6352519a8908c6c3d3ecebaadb.tar.gz
Qt-6824471ce5302c6352519a8908c6c3d3ecebaadb.tar.bz2
Fix regression in clipped icon text on Windows
This was really caused by a change done to the font engine in 4.6. We now return a pixel less for the font height in multiple widgets. Some of these should be addressed in a separate patch. This patch simply ensures that the text rect is not clipped, but will not alter the height of the widget. Task-number: QTBUG-7662 Reviewed-by: prasanth
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 739a70b..74d3ec3 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1608,7 +1608,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
pr.setHeight(pmSize.height() + 6);
- tr.adjust(0, pr.height() - 1, 0, -3);
+ tr.adjust(0, pr.height() - 1, 0, -2);
pr.translate(shiftX, shiftY);
if (!hasArrow) {
proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm);
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index 51fde74..a76c82d 100644
--- a/tests/auto/qstyle/tst_qstyle.cpp
+++ b/tests/auto/qstyle/tst_qstyle.cpp
@@ -52,6 +52,7 @@
#include <qstyleoption.h>
#include <qscrollbar.h>
#include <qprogressbar.h>
+#include <qtoolbutton.h>
#include <qplastiquestyle.h>
#include <qwindowsstyle.h>
@@ -445,6 +446,8 @@ void tst_QStyle::testWindowsVistaStyle()
if (QSysInfo::WindowsVersion == QSysInfo::WV_VISTA)
testPainting(&vistastyle, "vista");
+ else if (QSysInfo::WindowsVersion == QSysInfo::WV_XP)
+ testPainting(&vistastyle, "xp");
#endif
}
@@ -460,6 +463,7 @@ void comparePixmap(const QString &filename, const QPixmap &pixmap)
void tst_QStyle::testPainting(QStyle *style, const QString &platform)
{
+qDebug("TEST PAINTING");
//Test Menu
QString fileName = "images/" + platform + "/menu.png";
QMenu menu;
@@ -538,6 +542,19 @@ void tst_QStyle::testPainting(QStyle *style, const QString &platform)
pixmap = QPixmap::grabWidget(&mdiArea);
mdiArea.hide();
comparePixmap(fileName, pixmap);
+
+ // QToolButton
+ fileName = "images/" + platform + "/toolbutton.png";
+ QToolButton tb;
+ tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+ tb.setText("AaQqPpXx");
+ tb.setIcon(style->standardPixmap(QStyle::SP_DirHomeIcon));
+ tb.setStyle(style);
+ tb.show();
+ pixmap = QPixmap::grabWidget(&tb);
+ tb.hide();
+ comparePixmap(fileName, pixmap);
+
}
void tst_QStyle::testMacStyle()