Ticket #20362: patch-qt3support-for-cocoa.diff

File patch-qt3support-for-cocoa.diff, 4.9 KB (added by jeremy.laine@…, 15 years ago)

Patch to enable partial Qt3Support in qt4-mac

  • configure

    From 106d7a210be1e6d52946b575a262e2c76c5e51e6 Mon Sep 17 00:00:00 2001
    From: Morten Sorvig <msorvig@trolltech.com>
    Date: Thu, 10 Sep 2009 11:53:31 +0200
    Subject: [PATCH] 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 configure configure
    index 719db32..43aa739 100755
    case "$PLATFORM,$CFG_MAC_COCOA" in 
    58595859    macx*,yes)
    58605860        # Cocoa
    58615861        QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
    5862         CFG_QT3SUPPORT="no"
    58635862        ;;
    58645863    macx*,no)
    58655864        # gcc, Carbon
  • src/qt3support/dialogs/q3filedialog.cpp

    diff --git src/qt3support/dialogs/q3filedialog.cpp src/qt3support/dialogs/q3filedialog.cpp
    index 66ace5d..c14ff5c 100644
     
    116116
    117117QT_BEGIN_NAMESPACE
    118118
     119#ifndef QT_MAC_USE_COCOA
     120
    119121/* XPM */
    120122static const char * const start_xpm[]={
    121123    "16 15 8 1",
    Q3FilePreview::Q3FilePreview() 
    60516053  function to provide file previewing.
    60526054*/
    60536055
    6054 
     6056#endif // QT_MAC_USE_COCOA
     6057   
    60556058QT_END_NAMESPACE
    60566059
    60576060#include "moc_q3filedialog.cpp"
  • src/qt3support/dialogs/q3filedialog.h

    diff --git src/qt3support/dialogs/q3filedialog.h src/qt3support/dialogs/q3filedialog.h
    index f6a7950..8644b4c 100644
    class QUrlInfo; 
    6969
    7070#ifndef QT_NO_FILEDIALOG
    7171
     72#ifndef QT_MAC_USE_COCOA
     73
    7274class Q_COMPAT_EXPORT Q3FileIconProvider : public QObject
    7375{
    7476    Q_OBJECT
    private: 
    337339#endif
    338340};
    339341
     342#endif // QT_MAC_USE_COCOA
     343
    340344#endif // QT_NO_FILEDIALOG
    341345
    342346QT_END_NAMESPACE
  • src/qt3support/dialogs/q3filedialog_mac.cpp

    diff --git src/qt3support/dialogs/q3filedialog_mac.cpp src/qt3support/dialogs/q3filedialog_mac.cpp
    index a36274d..585fa8f 100644
     
    6060
    6161QT_BEGIN_NAMESPACE
    6262
     63#ifndef QT_MAC_USE_COCOA
     64
    6365/*****************************************************************************
    6466  Externals
    6567 *****************************************************************************/
    QString Q3FileDialog::macGetSaveFileName(const QString &start, const QString &fi 
    564566    return retstr;
    565567}
    566568
     569#endif // QT_MAC_USE_COCOA
     570
    567571QT_END_NAMESPACE
    568572
    569573#endif
  • src/qt3support/widgets/q3mainwindow.cpp

    diff --git src/qt3support/widgets/q3mainwindow.cpp src/qt3support/widgets/q3mainwindow.cpp
    index b7fc486..e02d890 100644
    void Q3MainWindow::addDockWindow(Q3DockWindow *dockWindow, 
    10421042                              Qt::Dock edge, bool newLine)
    10431043{
    10441044    Q_D(Q3MainWindow);
    1045 #ifdef Q_WS_MAC
     1045#if defined (Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
    10461046    extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp
    10471047    if(isWindow() && edge == Qt::DockTop) {
    10481048        d->createWinId();
    void Q3MainWindow::removeDockWindow(Q3DockWindow * dockWindow) 
    12171217{
    12181218    Q_D(Q3MainWindow);
    12191219
    1220 #ifdef Q_WS_MAC
     1220#if defined (Q_WS_MAC) && !defined (QT_MAC_USE_COCOA)
    12211221    extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp
    12221222    if(isWindow() && dockWindow->area() == topDock() && !dockWindows(Qt::DockTop).count())
    12231223        ChangeWindowAttributes(qt_mac_window_for(this), 0, kWindowToolbarButtonAttribute);
  • src/qt3support/widgets/q3scrollview.cpp

    diff --git src/qt3support/widgets/q3scrollview.cpp src/qt3support/widgets/q3scrollview.cpp
    index 1178047..3be0145 100644
    void Q3ScrollView::updateScrollBars() 
    870870            mac_need_scroll = true;
    871871        } else {
    872872            QWidget *tlw = window();
     873#ifndef QT_MAC_USE_COCOA
    873874            QPoint tlw_br = QPoint(tlw->width(), tlw->height()),
    874875                    my_br = qt_mac_posInWindow(this) + QPoint(w, h);
    875876            if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3)
     877#endif
    876878                mac_need_scroll = true;
    877879        }
    878880        if(mac_need_scroll) {
     881#ifndef QT_MAC_USE_COCOA
    879882            WindowAttributes attr;
    880883            GetWindowAttributes((WindowPtr)handle(), &attr);
    881884            mac_need_scroll = (attr & kWindowResizableAttribute);
     885#endif
    882886        }
    883887        if(mac_need_scroll) {
    884888            showc = true;