From 106d7a210be1e6d52946b575a262e2c76c5e51e6 Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Thu, 10 Sep 2009 11:53:31 +0200 Subject: Enable Qt3Support for Qt/Cocoa on Mac OS X. Qt on Mac OS X should not be the only desktop platform without Qt3Support once the Carpon port is dropped. This will also make the switch from Carbon to Cocoa-based Qt as smooth as possible. This is a minimal port, with some code removed: Q3FileDialog is gone. Q3MainWindow won't get the "hide toolbar" button. Q3ScrollView might to more updates than structly neccesary. The rest is there, including the QT3_SUPPORT functions in QtCore and QtGui. --- configure | 1 - src/qt3support/dialogs/q3filedialog.cpp | 5 ++++- src/qt3support/dialogs/q3filedialog.h | 4 ++++ src/qt3support/dialogs/q3filedialog_mac.cpp | 4 ++++ src/qt3support/widgets/q3mainwindow.cpp | 4 ++-- src/qt3support/widgets/q3scrollview.cpp | 4 ++++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 719db32..43aa739 100755 --- a/configure +++ b/configure @@ -5859,7 +5859,6 @@ case "$PLATFORM,$CFG_MAC_COCOA" in macx*,yes) # Cocoa QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5 - CFG_QT3SUPPORT="no" ;; macx*,no) # gcc, Carbon diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp index 66ace5d..c14ff5c 100644 --- a/src/qt3support/dialogs/q3filedialog.cpp +++ b/src/qt3support/dialogs/q3filedialog.cpp @@ -116,6 +116,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_MAC_USE_COCOA + /* XPM */ static const char * const start_xpm[]={ "16 15 8 1", @@ -6051,7 +6053,8 @@ Q3FilePreview::Q3FilePreview() function to provide file previewing. */ - +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE #include "moc_q3filedialog.cpp" diff --git a/src/qt3support/dialogs/q3filedialog.h b/src/qt3support/dialogs/q3filedialog.h index f6a7950..8644b4c 100644 --- a/src/qt3support/dialogs/q3filedialog.h +++ b/src/qt3support/dialogs/q3filedialog.h @@ -69,6 +69,8 @@ class QUrlInfo; #ifndef QT_NO_FILEDIALOG +#ifndef QT_MAC_USE_COCOA + class Q_COMPAT_EXPORT Q3FileIconProvider : public QObject { Q_OBJECT @@ -337,6 +339,8 @@ private: #endif }; +#endif // QT_MAC_USE_COCOA + #endif // QT_NO_FILEDIALOG QT_END_NAMESPACE diff --git a/src/qt3support/dialogs/q3filedialog_mac.cpp b/src/qt3support/dialogs/q3filedialog_mac.cpp index a36274dd..585fa8f 100644 --- a/src/qt3support/dialogs/q3filedialog_mac.cpp +++ b/src/qt3support/dialogs/q3filedialog_mac.cpp @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_MAC_USE_COCOA + /***************************************************************************** Externals *****************************************************************************/ @@ -564,6 +566,8 @@ QString Q3FileDialog::macGetSaveFileName(const QString &start, const QString &fi return retstr; } +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE #endif diff --git a/src/qt3support/widgets/q3mainwindow.cpp b/src/qt3support/widgets/q3mainwindow.cpp index b7fc486..e02d890 100644 --- a/src/qt3support/widgets/q3mainwindow.cpp +++ b/src/qt3support/widgets/q3mainwindow.cpp @@ -1042,7 +1042,7 @@ void Q3MainWindow::addDockWindow(Q3DockWindow *dockWindow, Qt::Dock edge, bool newLine) { Q_D(Q3MainWindow); -#ifdef Q_WS_MAC +#if defined (Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp if(isWindow() && edge == Qt::DockTop) { d->createWinId(); @@ -1217,7 +1217,7 @@ void Q3MainWindow::removeDockWindow(Q3DockWindow * dockWindow) { Q_D(Q3MainWindow); -#ifdef Q_WS_MAC +#if defined (Q_WS_MAC) && !defined (QT_MAC_USE_COCOA) extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp if(isWindow() && dockWindow->area() == topDock() && !dockWindows(Qt::DockTop).count()) ChangeWindowAttributes(qt_mac_window_for(this), 0, kWindowToolbarButtonAttribute); diff --git a/src/qt3support/widgets/q3scrollview.cpp b/src/qt3support/widgets/q3scrollview.cpp index 1178047..3be0145 100644 --- a/src/qt3support/widgets/q3scrollview.cpp +++ b/src/qt3support/widgets/q3scrollview.cpp @@ -870,15 +870,19 @@ void Q3ScrollView::updateScrollBars() mac_need_scroll = true; } else { QWidget *tlw = window(); +#ifndef QT_MAC_USE_COCOA QPoint tlw_br = QPoint(tlw->width(), tlw->height()), my_br = qt_mac_posInWindow(this) + QPoint(w, h); if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3) +#endif mac_need_scroll = true; } if(mac_need_scroll) { +#ifndef QT_MAC_USE_COCOA WindowAttributes attr; GetWindowAttributes((WindowPtr)handle(), &attr); mac_need_scroll = (attr & kWindowResizableAttribute); +#endif } if(mac_need_scroll) { showc = true; -- cgit v0.12