[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi/kexiutils
From: Jaroslaw Staniek <js () iidea ! pl>
Date: 2008-11-13 19:12:00
Message-ID: 1226603520.674738.4524.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 883880 by staniek:
Widgets
= further fixes for small toolbar button width on Windows
M +11 -8 SmallToolButton.cpp
--- trunk/koffice/kexi/kexiutils/SmallToolButton.cpp #883879:883880
@@ -133,7 +133,7 @@
f.setPixelSize(KexiUtils::smallFont().pixelSize());
setFont(f);
setAutoRaise(true);
- setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ QToolButton::setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
}
void KexiSmallToolButton::setToolButtonStyle(Qt::ToolButtonStyle style)
@@ -144,17 +144,17 @@
void KexiSmallToolButton::update(const QString& text, const QIcon& icon, bool \
tipToo) {
- int width;
- const bool fixWidth = style()->inherits("QWindowsStyle");
+ int width = 0;
+ const bool fixWidth = style()->inherits("QWindowsStyle") && toolButtonStyle() != \
Qt::ToolButtonIconOnly; if (text.isEmpty() || toolButtonStyle() == \
Qt::ToolButtonIconOnly) { if (fixWidth) {
- width = 10;
+ width = 6;
}
} else {
if (fixWidth) {
- QString text2( text + " " );
+ QString text2( text + " " );
if (d->action && d->action->isCheckable())
- text2 += " ";
+ text2 += " ";
width = fontMetrics().width(text2);
}
if (toolButtonStyle() != Qt::ToolButtonTextOnly)
@@ -172,8 +172,11 @@
QToolButton::setIcon(icon);
}
if (fixWidth) {
- QStyleOption opt;
- width += style()->pixelMetric(QStyle::PM_ButtonMargin, &opt, this);
+ if (!text.isEmpty()) {
+ QStyleOption opt;
+ opt.initFrom(this);
+ width += style()->pixelMetric(QStyle::PM_ButtonMargin, &opt, this);
+ }
setFixedWidth( width );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic