diff options
author | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2010-04-27 11:26:42 (GMT) |
---|---|---|
committer | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2010-04-27 11:30:51 (GMT) |
commit | 4580c2e9c2bbcb911f9e1cecd4551054598d256d (patch) | |
tree | b38eb05baac4864e309921b843b8246ffd4ab087 /src/gui/kernel/qwidget.cpp | |
parent | 9cea45515ef283c9a870c6f515da50d31addafcf (diff) | |
download | Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.zip Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.tar.gz Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.tar.bz2 |
QTabWidget documentMode not working correctly on Mac
This feature was implemented in Carbon and was never ported to Cocoa.
The major problem is the fact that Cocoa draws a line under the titlebar,
regardless of what we say. The only way to avoid drawing that line is
by adding a native toolbar and ask it not to draw its baseline. If there
is not toolbar, as it happens in this case, there is no way to prevent
that line from being drawn. So instead we paint over that line and hope
for the best.
Task-number: QTBUG-8159
Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 441e823..cf952aa 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -220,6 +220,11 @@ QWidgetPrivate::QWidgetPrivate(int version) isWidget = true; memset(high_attributes, 0, sizeof(high_attributes)); +#if QT_MAC_USE_COCOA + drawRectOriginalAdded = false; + originalDrawMethod = true; + changeMethods = false; +#endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "widgets" << ++count; @@ -12292,6 +12297,28 @@ void QWidgetPrivate::_q_delayedDestroy(WId winId) } #endif +#if QT_MAC_USE_COCOA +void QWidgetPrivate::syncUnifiedMode() { + // The whole purpose of this method is to keep the unifiedToolbar in sync. + // That means making sure we either exchange the drawing methods or we let + // the toolbar know that it does not require to draw the baseline. + Q_Q(QWidget); + // This function makes sense only if this is a top level + if(!q->isWindow()) + return; + OSWindowRef window = qt_mac_window_for(q); + if(changeMethods) { + // Ok, we are in documentMode. + if(originalDrawMethod) + qt_mac_replaceDrawRect(window, this); + } else { + if(!originalDrawMethod) + qt_mac_replaceDrawRectOriginal(window, this); + } +} + +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE #include "moc_qwidget.cpp" |