diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-04-19 07:08:34 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-04-20 09:39:56 (GMT) |
commit | c0bbdb8a293d0877e8dba517bad50748c70d0dfd (patch) | |
tree | 4249fd9a3c08d7de465c59784bd66a1ad753f214 /src/gui | |
parent | 85add63738927dc5a0ebfdb27edccfee66ba8caa (diff) | |
download | Qt-c0bbdb8a293d0877e8dba517bad50748c70d0dfd.zip Qt-c0bbdb8a293d0877e8dba517bad50748c70d0dfd.tar.gz Qt-c0bbdb8a293d0877e8dba517bad50748c70d0dfd.tar.bz2 |
ScrollBar width not updated dynamically on Windows.
Whenever the scrollbar width is changed in the system, Windows sends a
WM_SETTINGCHANGE message (with SPI_SETNONCLIENTMETRICS) to all toplevel
windows. This will now call updateGeometry() for all QScrollBar based
widgets and issue a new QEvent::LayoutRequest.
Task-number: QTBUG-9822
Reviewed-by: Jan-Arve
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 25 | ||||
-rw-r--r-- | src/gui/widgets/qabstractscrollarea.cpp | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 1d8eb4c..fb2837e 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -79,6 +79,7 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include "qlayout.h" #include "qtooltip.h" #include "qt_windows.h" +#include "qscrollbar.h" #if defined(QT_NON_COMMERCIAL) #include "qnc_win.h" #endif @@ -701,6 +702,21 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QApplication::setPalette(menu, "QMenuBar"); } +static void qt_set_windows_updateScrollBar(QWidget *widget) +{ + QList<QObject*> children = widget->children(); + for (int i = 0; i < children.size(); ++i) { + QObject *o = children.at(i); + if(!o->isWidgetType()) + continue; + if (QWidget *w = static_cast<QWidget *>(o)) + qt_set_windows_updateScrollBar(w); + } + if (qobject_cast<QScrollBar*>(widget)) + widget->updateGeometry(); +} + + /***************************************************************************** qt_init() - initializes Qt for Windows *****************************************************************************/ @@ -1930,6 +1946,15 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } } } + else if (msg.wParam == SPI_SETNONCLIENTMETRICS) { + widget = (QETWidget*)QWidget::find(hwnd); + if (widget && !widget->parentWidget()) { + qt_set_windows_updateScrollBar(widget); + QEvent e(QEvent::LayoutRequest); + QApplication::sendEvent(widget, &e); + } + } + break; case WM_PAINT: // paint event diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 73ec53e..8cffebd 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -983,6 +983,7 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: + case QEvent::LayoutRequest: d->layoutChildren(); // fall through default: |