// qapplication.sip generated by MetaSIP on Thu Sep 11 18:50:32 2014
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2014 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


%If (- Qt_5_0_0)
%If (WS_X11)
// Mapped type for XEvent.
// Map XEvent onto sip.voidptr so that Python code can use the struct module to
// read and/or update it.
%MappedType XEvent /NoRelease, DocType="sip.voidptr"/
{
%TypeHeaderCode
#include <qapplication.h>
%End

%ConvertToTypeCode
    void *addr = sipConvertToVoidPtr(sipPy);

    if (!sipIsErr)
        return !PyErr_Occurred();

    *sipCppPtr = reinterpret_cast<XEvent *>(addr);

    return 0;
%End

%ConvertFromTypeCode
    return sipConvertFromVoidPtr(sipCpp);
%End
};
%End
%End
%If (- Qt_5_0_0)
%If (WS_X11)
void qt_x11_wait_for_window_manager(QWidget *widget);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_set_sequence_auto_mnemonic(bool enable);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_set_menubar_icons(bool enable);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_set_menubar_merge(bool enable);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_set_native_menubar(bool enable);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_secure_keyboard(bool enable);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_set_dock_menu(QMenu *menu /KeepReference/);
%End
%End
%If (- Qt_5_0_0)
%If (WS_MACX)
void qt_mac_set_press_and_hold_context(bool enable);
%End
%End
%If (- Qt_5_0_0)
// class QMacCocoaViewContainer : public QWidget
%If (WS_MACX)
%If (Qt_4_5_0 -)

class QMacCocoaViewContainer : QWidget
{
%TypeHeaderCode
#include <QMacCocoaViewContainer>
%End

public:
    QMacCocoaViewContainer(void *cocoaViewToWrap, QWidget *parent /TransferThis/ = 0);
    virtual ~QMacCocoaViewContainer();

    void setCocoaView(void *cocoaViewToWrap);
    void *cocoaView() const;

private:
    QMacCocoaViewContainer(const QMacCocoaViewContainer &);
};

%End
%End
%End
// QApplication *qApp
QApplication *qApp {
%AccessCode
    // Qt implements this has a #define to a function call so we have to handle
    // it like this.
    return qApp;
%End
};
%If (Qt_5_0_0 -)

class QApplication : QGuiApplication
{
%TypeHeaderCode
#include <qapplication.h>
%End

%ConvertToSubClassCode
    static struct class_graph {
        const char *name;
        sipTypeDef **type;
        int yes, no;
    } graph[] = {
        {sipName_QScreen, &sipType_QScreen, -1, 1},
        {sipName_QSyntaxHighlighter, &sipType_QSyntaxHighlighter, -1, 2},
        {sipName_QAction, &sipType_QAction, 40, 3},
        {sipName_QDrag, &sipType_QDrag, -1, 4},
        {sipName_QPyTextObject, &sipType_QPyTextObject, -1, 5},
        {sipName_QGraphicsTransform, &sipType_QGraphicsTransform, 41, 6},
        {sipName_QLayout, &sipType_QLayout, 43, 7},
        {sipName_QGraphicsItemAnimation, &sipType_QGraphicsItemAnimation, -1, 8},
        {sipName_QGuiApplication, &sipType_QGuiApplication, 49, 9},
        {sipName_QSystemTrayIcon, &sipType_QSystemTrayIcon, -1, 10},
        {sipName_QShortcut, &sipType_QShortcut, -1, 11},
        {sipName_QTextDocument, &sipType_QTextDocument, -1, 12},
        {sipName_QMouseEventTransition, &sipType_QMouseEventTransition, -1, 13},
        {sipName_QCompleter, &sipType_QCompleter, -1, 14},
        {sipName_QWidget, &sipType_QWidget, 50, 15},
        {sipName_QGraphicsEffect, &sipType_QGraphicsEffect, 126, 16},
        {sipName_QTextObject, &sipType_QTextObject, 130, 17},
        {sipName_QUndoGroup, &sipType_QUndoGroup, -1, 18},
        {sipName_QItemSelectionModel, &sipType_QItemSelectionModel, -1, 19},
        {sipName_QGraphicsScene, &sipType_QGraphicsScene, -1, 20},
        {sipName_QUndoStack, &sipType_QUndoStack, -1, 21},
        {sipName_QAbstractProxyModel, &sipType_QAbstractProxyModel, 134, 22},
        {sipName_QMovie, &sipType_QMovie, -1, 23},
        {sipName_QAbstractTextDocumentLayout, &sipType_QAbstractTextDocumentLayout, 136, 24},
        {sipName_QDirModel, &sipType_QDirModel, -1, 25},
        {sipName_QKeyEventTransition, &sipType_QKeyEventTransition, -1, 26},
        {sipName_QValidator, &sipType_QValidator, 137, 27},
        {sipName_QClipboard, &sipType_QClipboard, -1, 28},
        {sipName_QFileSystemModel, &sipType_QFileSystemModel, -1, 29},
        {sipName_QStringListModel, &sipType_QStringListModel, -1, 30},
        {sipName_QGraphicsObject, &sipType_QGraphicsObject, 140, 31},
        {sipName_QGraphicsAnchor, &sipType_QGraphicsAnchor, -1, 32},
        {sipName_QGesture, &sipType_QGesture, 143, 33},
        {sipName_QAbstractItemDelegate, &sipType_QAbstractItemDelegate, 148, 34},
        {sipName_QButtonGroup, &sipType_QButtonGroup, -1, 35},
        {sipName_QDataWidgetMapper, &sipType_QDataWidgetMapper, -1, 36},
        {sipName_QStandardItemModel, &sipType_QStandardItemModel, -1, 37},
        {sipName_QSessionManager, &sipType_QSessionManager, -1, 38},
        {sipName_QStyle, &sipType_QStyle, 150, 39},
        {sipName_QActionGroup, &sipType_QActionGroup, -1, -1},
        {sipName_QWidgetAction, &sipType_QWidgetAction, -1, -1},
        {sipName_QGraphicsRotation, &sipType_QGraphicsRotation, -1, 42},
        {sipName_QGraphicsScale, &sipType_QGraphicsScale, -1, -1},
        {sipName_QStackedLayout, &sipType_QStackedLayout, -1, 44},
        {sipName_QBoxLayout, &sipType_QBoxLayout, 47, 45},
        {sipName_QGridLayout, &sipType_QGridLayout, -1, 46},
        {sipName_QFormLayout, &sipType_QFormLayout, -1, -1},
        {sipName_QHBoxLayout, &sipType_QHBoxLayout, -1, 48},
        {sipName_QVBoxLayout, &sipType_QVBoxLayout, -1, -1},
        {sipName_QApplication, &sipType_QApplication, -1, -1},
        {sipName_QFrame, &sipType_QFrame, 78, 51},
        {sipName_QWizardPage, &sipType_QWizardPage, -1, 52},
        {sipName_QMdiSubWindow, &sipType_QMdiSubWindow, -1, 53},
        {sipName_QDialog, &sipType_QDialog, 100, 54},
        {sipName_QDesktopWidget, &sipType_QDesktopWidget, -1, 55},
        {sipName_QAbstractSlider, &sipType_QAbstractSlider, 112, 56},
        {sipName_QFocusFrame, &sipType_QFocusFrame, -1, 57},
        {sipName_QTabWidget, &sipType_QTabWidget, -1, 58},
        {sipName_QComboBox, &sipType_QComboBox, 115, 59},
        {sipName_QProgressBar, &sipType_QProgressBar, -1, 60},
        {sipName_QRubberBand, &sipType_QRubberBand, -1, 61},
        {sipName_QLineEdit, &sipType_QLineEdit, -1, 62},
        {sipName_QStatusBar, &sipType_QStatusBar, -1, 63},
        {sipName_QAbstractButton, &sipType_QAbstractButton, 116, 64},
        {sipName_QSplashScreen, &sipType_QSplashScreen, -1, 65},
        {sipName_QTabBar, &sipType_QTabBar, -1, 66},
        {sipName_QDialogButtonBox, &sipType_QDialogButtonBox, -1, 67},
        {sipName_QGroupBox, &sipType_QGroupBox, -1, 68},
        {sipName_QSizeGrip, &sipType_QSizeGrip, -1, 69},
        {sipName_QAbstractSpinBox, &sipType_QAbstractSpinBox, 121, 70},
        {sipName_QMenu, &sipType_QMenu, -1, 71},
        {sipName_QToolBar, &sipType_QToolBar, -1, 72},
        {sipName_QDockWidget, &sipType_QDockWidget, -1, 73},
        {sipName_QMainWindow, &sipType_QMainWindow, -1, 74},
        {sipName_QSplitterHandle, &sipType_QSplitterHandle, -1, 75},
        {sipName_QMenuBar, &sipType_QMenuBar, -1, 76},
    #if defined(SIP_FEATURE_PyQt_PrintPreviewWidget)
        {sipName_QPrintPreviewWidget, &sipType_QPrintPreviewWidget, -1, 77},
    #else
        {0, 0, -1, 77},
    #endif
        {sipName_QCalendarWidget, &sipType_QCalendarWidget, -1, -1},
        {sipName_QLabel, &sipType_QLabel, -1, 79},
        {sipName_QAbstractScrollArea, &sipType_QAbstractScrollArea, 84, 80},
        {sipName_QStackedWidget, &sipType_QStackedWidget, -1, 81},
        {sipName_QLCDNumber, &sipType_QLCDNumber, -1, 82},
        {sipName_QSplitter, &sipType_QSplitter, -1, 83},
        {sipName_QToolBox, &sipType_QToolBox, -1, -1},
        {sipName_QScrollArea, &sipType_QScrollArea, -1, 85},
        {sipName_QAbstractItemView, &sipType_QAbstractItemView, 90, 86},
        {sipName_QPlainTextEdit, &sipType_QPlainTextEdit, -1, 87},
        {sipName_QMdiArea, &sipType_QMdiArea, -1, 88},
        {sipName_QTextEdit, &sipType_QTextEdit, 99, 89},
        {sipName_QGraphicsView, &sipType_QGraphicsView, -1, -1},
        {sipName_QColumnView, &sipType_QColumnView, -1, 91},
        {sipName_QTreeView, &sipType_QTreeView, 95, 92},
        {sipName_QTableView, &sipType_QTableView, 96, 93},
        {sipName_QListView, &sipType_QListView, 97, 94},
        {sipName_QHeaderView, &sipType_QHeaderView, -1, -1},
        {sipName_QTreeWidget, &sipType_QTreeWidget, -1, -1},
        {sipName_QTableWidget, &sipType_QTableWidget, -1, -1},
        {sipName_QUndoView, &sipType_QUndoView, -1, 98},
        {sipName_QListWidget, &sipType_QListWidget, -1, -1},
        {sipName_QTextBrowser, &sipType_QTextBrowser, -1, -1},
        {sipName_QMessageBox, &sipType_QMessageBox, -1, 101},
    #if defined(SIP_FEATURE_PyQt_PrintDialog)
        {sipName_QPageSetupDialog, &sipType_QPageSetupDialog, -1, 102},
    #else
        {0, 0, -1, 102},
    #endif
        {sipName_QWizard, &sipType_QWizard, -1, 103},
        {sipName_QFileDialog, &sipType_QFileDialog, -1, 104},
        {sipName_QInputDialog, &sipType_QInputDialog, -1, 105},
    #if defined(SIP_FEATURE_PyQt_Printer)
        {sipName_QAbstractPrintDialog, &sipType_QAbstractPrintDialog, 111, 106},
    #else
        {0, 0, 111, 106},
    #endif
        {sipName_QFontDialog, &sipType_QFontDialog, -1, 107},
        {sipName_QProgressDialog, &sipType_QProgressDialog, -1, 108},
        {sipName_QColorDialog, &sipType_QColorDialog, -1, 109},
    #if defined(SIP_FEATURE_PyQt_PrintPreviewDialog)
        {sipName_QPrintPreviewDialog, &sipType_QPrintPreviewDialog, -1, 110},
    #else
        {0, 0, -1, 110},
    #endif
        {sipName_QErrorMessage, &sipType_QErrorMessage, -1, -1},
    #if defined(SIP_FEATURE_PyQt_PrintDialog)
        {sipName_QPrintDialog, &sipType_QPrintDialog, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QScrollBar, &sipType_QScrollBar, -1, 113},
        {sipName_QDial, &sipType_QDial, -1, 114},
        {sipName_QSlider, &sipType_QSlider, -1, -1},
        {sipName_QFontComboBox, &sipType_QFontComboBox, -1, -1},
        {sipName_QToolButton, &sipType_QToolButton, -1, 117},
        {sipName_QRadioButton, &sipType_QRadioButton, -1, 118},
        {sipName_QCheckBox, &sipType_QCheckBox, -1, 119},
        {sipName_QPushButton, &sipType_QPushButton, 120, -1},
        {sipName_QCommandLinkButton, &sipType_QCommandLinkButton, -1, -1},
        {sipName_QSpinBox, &sipType_QSpinBox, -1, 122},
        {sipName_QDoubleSpinBox, &sipType_QDoubleSpinBox, -1, 123},
        {sipName_QDateTimeEdit, &sipType_QDateTimeEdit, 124, -1},
        {sipName_QDateEdit, &sipType_QDateEdit, -1, 125},
        {sipName_QTimeEdit, &sipType_QTimeEdit, -1, -1},
        {sipName_QGraphicsColorizeEffect, &sipType_QGraphicsColorizeEffect, -1, 127},
        {sipName_QGraphicsDropShadowEffect, &sipType_QGraphicsDropShadowEffect, -1, 128},
        {sipName_QGraphicsBlurEffect, &sipType_QGraphicsBlurEffect, -1, 129},
        {sipName_QGraphicsOpacityEffect, &sipType_QGraphicsOpacityEffect, -1, -1},
        {sipName_QTextBlockGroup, &sipType_QTextBlockGroup, 132, 131},
        {sipName_QTextFrame, &sipType_QTextFrame, 133, -1},
        {sipName_QTextList, &sipType_QTextList, -1, -1},
        {sipName_QTextTable, &sipType_QTextTable, -1, -1},
        {sipName_QSortFilterProxyModel, &sipType_QSortFilterProxyModel, -1, 135},
        {sipName_QIdentityProxyModel, &sipType_QIdentityProxyModel, -1, -1},
        {sipName_QPlainTextDocumentLayout, &sipType_QPlainTextDocumentLayout, -1, -1},
        {sipName_QRegExpValidator, &sipType_QRegExpValidator, -1, 138},
        {sipName_QDoubleValidator, &sipType_QDoubleValidator, -1, 139},
        {sipName_QIntValidator, &sipType_QIntValidator, -1, -1},
        {sipName_QGraphicsWidget, &sipType_QGraphicsWidget, 142, 141},
        {sipName_QGraphicsTextItem, &sipType_QGraphicsTextItem, -1, -1},
        {sipName_QGraphicsProxyWidget, &sipType_QGraphicsProxyWidget, -1, -1},
        {sipName_QTapAndHoldGesture, &sipType_QTapAndHoldGesture, -1, 144},
        {sipName_QTapGesture, &sipType_QTapGesture, -1, 145},
        {sipName_QPanGesture, &sipType_QPanGesture, -1, 146},
        {sipName_QPinchGesture, &sipType_QPinchGesture, -1, 147},
        {sipName_QSwipeGesture, &sipType_QSwipeGesture, -1, -1},
        {sipName_QStyledItemDelegate, &sipType_QStyledItemDelegate, -1, 149},
        {sipName_QItemDelegate, &sipType_QItemDelegate, -1, -1},
        {sipName_QCommonStyle, &sipType_QCommonStyle, -1, -1},
    };
    
    int i = 0;
    
    sipType = NULL;
    
    do
    {
        struct class_graph *cg = &graph[i];
    
        if (cg->name != NULL && sipCpp->inherits(cg->name))
        {
            sipType = *cg->type;
            i = cg->yes;
        }
        else
            i = cg->no;
    }
    while (i >= 0);
%End

public:
    QApplication(SIP_PYLIST argv /DocType="list-of-str"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, int = ApplicationFlags)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpycore_ArgvToC(a0, argc)) == NULL)
            sipIsErr = 1;
        else
        {
            // Create it now the arguments are right.
            static int nargc;
            nargc = argc;
        
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipQApplication(nargc, argv, QCoreApplication::ApplicationFlags);
            Py_END_ALLOW_THREADS
        
            // Now modify the original list.
            qpycore_UpdatePyArgv(a0, argc, argv);
        }
%End

    virtual ~QApplication();
%MethodCode
        // Make sure all top level widgets are not owned by Python and so won't be
        // destroyed by the garbage collector after QApplication is destroyed.
        QWidgetList tlw = QApplication::topLevelWidgets();
        
        for (int i = 0; i < tlw.count(); ++i)
        {
            PyObject *sw = sipGetPyObject(tlw.at(i), sipType_QWidget);
        
            if (sw)
                sipTransferTo(sw, 0);
        }
        
        // Handle all other QObject instances that we want to make sure are deleted
        // before the QApplication is deleted.
        qtgui_delete_tracked();
%End

    static QStyle *style();
    static void setStyle(QStyle * /Transfer/);
    static QStyle *setStyle(const QString &);

    enum ColorSpec
    {
        NormalColor,
        CustomColor,
        ManyColor,
    };

    static int colorSpec();
    static void setColorSpec(int);
    static QPalette palette();
    static QPalette palette(const QWidget *);
    static QPalette palette(const char *className);
    static void setPalette(const QPalette &, const char *className = 0);
    static QFont font();
    static QFont font(const QWidget *);
    static QFont font(const char *className);
    static void setFont(const QFont &, const char *className = 0);
    static QFontMetrics fontMetrics();
    static void setWindowIcon(const QIcon &icon);
    static QIcon windowIcon();
    static QWidgetList allWidgets();
    static QWidgetList topLevelWidgets();
    static QDesktopWidget *desktop();
    static QWidget *activePopupWidget();
    static QWidget *activeModalWidget();
    static QWidget *focusWidget();
    static QWidget *activeWindow();
    static void setActiveWindow(QWidget *act);
    static QWidget *widgetAt(const QPoint &p);
    static QWidget *widgetAt(int x, int y);
    static QWidget *topLevelAt(const QPoint &p);
    static QWidget *topLevelAt(int x, int y);
    static void beep();
    static void alert(QWidget *widget, int msecs = 0) /ReleaseGIL/;
    static void setCursorFlashTime(int);
    static int cursorFlashTime();
    static void setDoubleClickInterval(int);
    static int doubleClickInterval();
    static void setKeyboardInputInterval(int);
    static int keyboardInputInterval();
    static void setWheelScrollLines(int);
    static int wheelScrollLines();
    static void setGlobalStrut(const QSize &);
    static QSize globalStrut();
    static void setStartDragTime(int ms);
    static int startDragTime();
    static void setStartDragDistance(int l);
    static int startDragDistance();
    static bool isEffectEnabled(Qt::UIEffect);
    static void setEffectEnabled(Qt::UIEffect, bool enabled = true);
    static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
%If (Py_v3)
    static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
%End
    virtual bool notify(QObject *, QEvent *) /ReleaseGIL/;
    bool autoSipEnabled() const;
    QString styleSheet() const;

signals:
    void focusChanged(QWidget *old, QWidget *now);

public slots:
    static void aboutQt();
    static void closeAllWindows();
    void setAutoSipEnabled(const bool enabled);
    void setStyleSheet(const QString &sheet);

protected:
    virtual bool event(QEvent *);

public:
%If (PyQt_Deprecated_5_0)
    static void setGraphicsSystem(const QString &);
%End
%If (PyQt_Deprecated_5_0)
    static void syncX();
%End
%If (PyQt_Deprecated_5_0)
    static QLocale keyboardInputLocale();
%End
%If (PyQt_Deprecated_5_0)
    static Qt::LayoutDirection keyboardInputDirection();
%End

private:
    QApplication(const QApplication &);
};

%End
%If (- Qt_5_0_0)

class QApplication : QCoreApplication
{
%TypeHeaderCode
#include <qapplication.h>
%End

%ConvertToSubClassCode
    static struct class_graph {
        const char *name;
        sipTypeDef **type;
        int yes, no;
    } graph[] = {
        {sipName_QAbstractProxyModel, &sipType_QAbstractProxyModel, 42, 1},
        {sipName_QStringListModel, &sipType_QStringListModel, -1, 2},
        {sipName_QDrag, &sipType_QDrag, -1, 3},
    #if QT_VERSION >= 0x040200
        {sipName_QUndoGroup, &sipType_QUndoGroup, -1, 4},
    #else
        {0, 0, -1, 4},
    #endif
    #if QT_VERSION >= 0x040200
        {sipName_QCompleter, &sipType_QCompleter, -1, 5},
    #else
        {0, 0, -1, 5},
    #endif
    #if defined(SIP_FEATURE_PyQt_SessionManager)
        {sipName_QSessionManager, &sipType_QSessionManager, -1, 6},
    #else
        {0, 0, -1, 6},
    #endif
        {sipName_QSyntaxHighlighter, &sipType_QSyntaxHighlighter, -1, 7},
    #if QT_VERSION >= 0x040200
        {sipName_QGraphicsScene, &sipType_QGraphicsScene, -1, 8},
    #else
        {0, 0, -1, 8},
    #endif
        {sipName_QSound, &sipType_QSound, -1, 9},
        {sipName_QItemSelectionModel, &sipType_QItemSelectionModel, -1, 10},
    #if QT_VERSION >= 0x040400
        {sipName_QFileSystemModel, &sipType_QFileSystemModel, -1, 11},
    #else
        {0, 0, -1, 11},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGesture, &sipType_QGesture, 44, 12},
    #else
        {0, 0, 44, 12},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsTransform, &sipType_QGraphicsTransform, 49, 13},
    #else
        {0, 0, 49, 13},
    #endif
        {sipName_QPyTextObject, &sipType_QPyTextObject, -1, 14},
        {sipName_QApplication, &sipType_QApplication, -1, 15},
        {sipName_QValidator, &sipType_QValidator, 51, 16},
        {sipName_QClipboard, &sipType_QClipboard, -1, 17},
    #if QT_VERSION >= 0x040200
        {sipName_QUndoStack, &sipType_QUndoStack, -1, 18},
    #else
        {0, 0, -1, 18},
    #endif
        {sipName_QActionGroup, &sipType_QActionGroup, -1, 19},
        {sipName_QLayout, &sipType_QLayout, 54, 20},
        {sipName_QTextObject, &sipType_QTextObject, 60, 21},
        {sipName_QAction, &sipType_QAction, 64, 22},
        {sipName_QStyle, &sipType_QStyle, 65, 23},
        {sipName_QButtonGroup, &sipType_QButtonGroup, -1, 24},
        {sipName_QInputContext, &sipType_QInputContext, -1, 25},
        {sipName_QMovie, &sipType_QMovie, -1, 26},
        {sipName_QTextDocument, &sipType_QTextDocument, -1, 27},
        {sipName_QWidget, &sipType_QWidget, 66, 28},
    #if QT_VERSION >= 0x040600
        {sipName_QKeyEventTransition, &sipType_QKeyEventTransition, -1, 29},
    #else
        {0, 0, -1, 29},
    #endif
        {sipName_QStandardItemModel, &sipType_QStandardItemModel, -1, 30},
        {sipName_QShortcut, &sipType_QShortcut, -1, 31},
    #if QT_VERSION >= 0x040200
        {sipName_QGraphicsItemAnimation, &sipType_QGraphicsItemAnimation, -1, 32},
    #else
        {0, 0, -1, 32},
    #endif
    #if QT_VERSION >= 0x040200 && defined(SIP_FEATURE_PyQt_SystemTrayIcon)
        {sipName_QSystemTrayIcon, &sipType_QSystemTrayIcon, -1, 33},
    #else
        {0, 0, -1, 33},
    #endif
    #if QT_VERSION >= 0x040200
        {sipName_QDataWidgetMapper, &sipType_QDataWidgetMapper, -1, 34},
    #else
        {0, 0, -1, 34},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsAnchor, &sipType_QGraphicsAnchor, -1, 35},
    #else
        {0, 0, -1, 35},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QMouseEventTransition, &sipType_QMouseEventTransition, -1, 36},
    #else
        {0, 0, -1, 36},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsObject, &sipType_QGraphicsObject, 146, 37},
    #else
        {0, 0, 146, 37},
    #endif
        {sipName_QDirModel, &sipType_QDirModel, -1, 38},
        {sipName_QAbstractItemDelegate, &sipType_QAbstractItemDelegate, 149, 39},
        {sipName_QAbstractTextDocumentLayout, &sipType_QAbstractTextDocumentLayout, 151, 40},
        {sipName_QProxyModel, &sipType_QProxyModel, -1, 41},
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsEffect, &sipType_QGraphicsEffect, 152, -1},
    #else
        {0, 0, 152, -1},
    #endif
    #if QT_VERSION >= 0x040800
        {sipName_QIdentityProxyModel, &sipType_QIdentityProxyModel, -1, 43},
    #else
        {0, 0, -1, 43},
    #endif
        {sipName_QSortFilterProxyModel, &sipType_QSortFilterProxyModel, -1, -1},
    #if QT_VERSION >= 0x040600
        {sipName_QTapGesture, &sipType_QTapGesture, -1, 45},
    #else
        {0, 0, -1, 45},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QTapAndHoldGesture, &sipType_QTapAndHoldGesture, -1, 46},
    #else
        {0, 0, -1, 46},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QPanGesture, &sipType_QPanGesture, -1, 47},
    #else
        {0, 0, -1, 47},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QPinchGesture, &sipType_QPinchGesture, -1, 48},
    #else
        {0, 0, -1, 48},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QSwipeGesture, &sipType_QSwipeGesture, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsRotation, &sipType_QGraphicsRotation, -1, 50},
    #else
        {0, 0, -1, 50},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsScale, &sipType_QGraphicsScale, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QIntValidator, &sipType_QIntValidator, -1, 52},
        {sipName_QDoubleValidator, &sipType_QDoubleValidator, -1, 53},
        {sipName_QRegExpValidator, &sipType_QRegExpValidator, -1, -1},
        {sipName_QGridLayout, &sipType_QGridLayout, -1, 55},
        {sipName_QStackedLayout, &sipType_QStackedLayout, -1, 56},
    #if QT_VERSION >= 0x040400
        {sipName_QFormLayout, &sipType_QFormLayout, -1, 57},
    #else
        {0, 0, -1, 57},
    #endif
        {sipName_QBoxLayout, &sipType_QBoxLayout, 58, -1},
        {sipName_QVBoxLayout, &sipType_QVBoxLayout, -1, 59},
        {sipName_QHBoxLayout, &sipType_QHBoxLayout, -1, -1},
        {sipName_QTextBlockGroup, &sipType_QTextBlockGroup, 62, 61},
        {sipName_QTextFrame, &sipType_QTextFrame, 63, -1},
        {sipName_QTextList, &sipType_QTextList, -1, -1},
        {sipName_QTextTable, &sipType_QTextTable, -1, -1},
    #if QT_VERSION >= 0x040200
        {sipName_QWidgetAction, &sipType_QWidgetAction, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QCommonStyle, &sipType_QCommonStyle, -1, -1},
        {sipName_QDockWidget, &sipType_QDockWidget, -1, 67},
        {sipName_QMenuBar, &sipType_QMenuBar, -1, 68},
        {sipName_QDialog, &sipType_QDialog, 98, 69},
        {sipName_QAbstractButton, &sipType_QAbstractButton, 110, 70},
        {sipName_QRubberBand, &sipType_QRubberBand, -1, 71},
    #if QT_VERSION >= 0x040200
        {sipName_QDialogButtonBox, &sipType_QDialogButtonBox, -1, 72},
    #else
        {0, 0, -1, 72},
    #endif
        {sipName_QComboBox, &sipType_QComboBox, 115, 73},
    #if defined(Q_WS_X11)
        {sipName_QX11EmbedContainer, &sipType_QX11EmbedContainer, -1, 74},
    #else
        {0, 0, -1, 74},
    #endif
        {sipName_QAbstractSpinBox, &sipType_QAbstractSpinBox, 116, 75},
        {sipName_QToolBar, &sipType_QToolBar, -1, 76},
        {sipName_QAbstractSlider, &sipType_QAbstractSlider, 121, 77},
        {sipName_QGroupBox, &sipType_QGroupBox, -1, 78},
        {sipName_QMainWindow, &sipType_QMainWindow, -1, 79},
    #if defined(Q_WS_X11)
        {sipName_QX11EmbedWidget, &sipType_QX11EmbedWidget, -1, 80},
    #else
        {0, 0, -1, 80},
    #endif
        {sipName_QSplitterHandle, &sipType_QSplitterHandle, -1, 81},
        {sipName_QFrame, &sipType_QFrame, 124, 82},
        {sipName_QFocusFrame, &sipType_QFocusFrame, -1, 83},
    #if QT_VERSION >= 0x040500 && defined(Q_OS_MAC)
        {sipName_QMacCocoaViewContainer, &sipType_QMacCocoaViewContainer, -1, 84},
    #else
        {0, 0, -1, 84},
    #endif
    #if QT_VERSION >= 0x040300
        {sipName_QWizardPage, &sipType_QWizardPage, -1, 85},
    #else
        {0, 0, -1, 85},
    #endif
        {sipName_QStatusBar, &sipType_QStatusBar, -1, 86},
    #if QT_VERSION >= 0x040300
        {sipName_QMdiSubWindow, &sipType_QMdiSubWindow, -1, 87},
    #else
        {0, 0, -1, 87},
    #endif
        {sipName_QWorkspace, &sipType_QWorkspace, -1, 88},
        {sipName_QTabWidget, &sipType_QTabWidget, -1, 89},
        {sipName_QSplashScreen, &sipType_QSplashScreen, -1, 90},
        {sipName_QProgressBar, &sipType_QProgressBar, -1, 91},
    #if QT_VERSION >= 0x040400 && defined(SIP_FEATURE_PyQt_PrintPreviewWidget)
        {sipName_QPrintPreviewWidget, &sipType_QPrintPreviewWidget, -1, 92},
    #else
        {0, 0, -1, 92},
    #endif
        {sipName_QTabBar, &sipType_QTabBar, -1, 93},
        {sipName_QLineEdit, &sipType_QLineEdit, -1, 94},
        {sipName_QDesktopWidget, &sipType_QDesktopWidget, -1, 95},
        {sipName_QMenu, &sipType_QMenu, -1, 96},
    #if defined(SIP_FEATURE_PyQt_SizeGrip)
        {sipName_QSizeGrip, &sipType_QSizeGrip, -1, 97},
    #else
        {0, 0, -1, 97},
    #endif
    #if QT_VERSION >= 0x040200
        {sipName_QCalendarWidget, &sipType_QCalendarWidget, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QColorDialog, &sipType_QColorDialog, -1, 99},
        {sipName_QProgressDialog, &sipType_QProgressDialog, -1, 100},
    #if QT_VERSION >= 0x040400 && defined(SIP_FEATURE_PyQt_PrintPreviewDialog)
        {sipName_QPrintPreviewDialog, &sipType_QPrintPreviewDialog, -1, 101},
    #else
        {0, 0, -1, 101},
    #endif
    #if QT_VERSION >= 0x040300
        {sipName_QWizard, &sipType_QWizard, -1, 102},
    #else
        {0, 0, -1, 102},
    #endif
    #if defined(SIP_FEATURE_PyQt_PrintDialog)
        {sipName_QPageSetupDialog, &sipType_QPageSetupDialog, -1, 103},
    #else
        {0, 0, -1, 103},
    #endif
        {sipName_QFileDialog, &sipType_QFileDialog, -1, 104},
        {sipName_QFontDialog, &sipType_QFontDialog, -1, 105},
        {sipName_QInputDialog, &sipType_QInputDialog, -1, 106},
    #if defined(SIP_FEATURE_PyQt_Printer)
        {sipName_QAbstractPrintDialog, &sipType_QAbstractPrintDialog, 109, 107},
    #else
        {0, 0, 109, 107},
    #endif
        {sipName_QErrorMessage, &sipType_QErrorMessage, -1, 108},
        {sipName_QMessageBox, &sipType_QMessageBox, -1, -1},
    #if defined(SIP_FEATURE_PyQt_PrintDialog)
        {sipName_QPrintDialog, &sipType_QPrintDialog, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QRadioButton, &sipType_QRadioButton, -1, 111},
        {sipName_QToolButton, &sipType_QToolButton, -1, 112},
        {sipName_QPushButton, &sipType_QPushButton, 114, 113},
        {sipName_QCheckBox, &sipType_QCheckBox, -1, -1},
    #if QT_VERSION >= 0x040400
        {sipName_QCommandLinkButton, &sipType_QCommandLinkButton, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
    #if QT_VERSION >= 0x040200
        {sipName_QFontComboBox, &sipType_QFontComboBox, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QSpinBox, &sipType_QSpinBox, -1, 117},
        {sipName_QDateTimeEdit, &sipType_QDateTimeEdit, 119, 118},
        {sipName_QDoubleSpinBox, &sipType_QDoubleSpinBox, -1, -1},
        {sipName_QTimeEdit, &sipType_QTimeEdit, -1, 120},
        {sipName_QDateEdit, &sipType_QDateEdit, -1, -1},
        {sipName_QDial, &sipType_QDial, -1, 122},
        {sipName_QSlider, &sipType_QSlider, -1, 123},
        {sipName_QScrollBar, &sipType_QScrollBar, -1, -1},
        {sipName_QStackedWidget, &sipType_QStackedWidget, -1, 125},
        {sipName_QToolBox, &sipType_QToolBox, -1, 126},
        {sipName_QLabel, &sipType_QLabel, -1, 127},
        {sipName_QSplitter, &sipType_QSplitter, -1, 128},
        {sipName_QAbstractScrollArea, &sipType_QAbstractScrollArea, 130, 129},
        {sipName_QLCDNumber, &sipType_QLCDNumber, -1, -1},
        {sipName_QAbstractItemView, &sipType_QAbstractItemView, 136, 131},
        {sipName_QTextEdit, &sipType_QTextEdit, 145, 132},
    #if QT_VERSION >= 0x040400
        {sipName_QPlainTextEdit, &sipType_QPlainTextEdit, -1, 133},
    #else
        {0, 0, -1, 133},
    #endif
    #if QT_VERSION >= 0x040200
        {sipName_QGraphicsView, &sipType_QGraphicsView, -1, 134},
    #else
        {0, 0, -1, 134},
    #endif
        {sipName_QScrollArea, &sipType_QScrollArea, -1, 135},
    #if QT_VERSION >= 0x040300
        {sipName_QMdiArea, &sipType_QMdiArea, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
        {sipName_QTableView, &sipType_QTableView, 141, 137},
        {sipName_QTreeView, &sipType_QTreeView, 142, 138},
    #if QT_VERSION >= 0x040300
        {sipName_QColumnView, &sipType_QColumnView, -1, 139},
    #else
        {0, 0, -1, 139},
    #endif
        {sipName_QHeaderView, &sipType_QHeaderView, -1, 140},
        {sipName_QListView, &sipType_QListView, 143, -1},
        {sipName_QTableWidget, &sipType_QTableWidget, -1, -1},
        {sipName_QTreeWidget, &sipType_QTreeWidget, -1, -1},
    #if QT_VERSION >= 0x040200
        {sipName_QUndoView, &sipType_QUndoView, -1, 144},
    #else
        {0, 0, -1, 144},
    #endif
        {sipName_QListWidget, &sipType_QListWidget, -1, -1},
        {sipName_QTextBrowser, &sipType_QTextBrowser, -1, -1},
    #if QT_VERSION >= 0x040200
        {sipName_QGraphicsTextItem, &sipType_QGraphicsTextItem, -1, 147},
    #else
        {0, 0, -1, 147},
    #endif
    #if QT_VERSION >= 0x040400
        {sipName_QGraphicsWidget, &sipType_QGraphicsWidget, 148, -1},
    #else
        {0, 0, 148, -1},
    #endif
    #if QT_VERSION >= 0x040400
        {sipName_QGraphicsProxyWidget, &sipType_QGraphicsProxyWidget, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
    #if QT_VERSION >= 0x040400
        {sipName_QStyledItemDelegate, &sipType_QStyledItemDelegate, -1, 150},
    #else
        {0, 0, -1, 150},
    #endif
        {sipName_QItemDelegate, &sipType_QItemDelegate, -1, -1},
    #if QT_VERSION >= 0x040400
        {sipName_QPlainTextDocumentLayout, &sipType_QPlainTextDocumentLayout, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsColorizeEffect, &sipType_QGraphicsColorizeEffect, -1, 153},
    #else
        {0, 0, -1, 153},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsOpacityEffect, &sipType_QGraphicsOpacityEffect, -1, 154},
    #else
        {0, 0, -1, 154},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsBlurEffect, &sipType_QGraphicsBlurEffect, -1, 155},
    #else
        {0, 0, -1, 155},
    #endif
    #if QT_VERSION >= 0x040600
        {sipName_QGraphicsDropShadowEffect, &sipType_QGraphicsDropShadowEffect, -1, -1},
    #else
        {0, 0, -1, -1},
    #endif
    };
    
    int i = 0;
    
    sipType = NULL;
    
    do
    {
        struct class_graph *cg = &graph[i];
    
        if (cg->name != NULL && sipCpp->inherits(cg->name))
        {
            sipType = *cg->type;
            i = cg->yes;
        }
        else
            i = cg->no;
    }
    while (i >= 0);
%End

public:
    QApplication(SIP_PYLIST argv /DocType="list-of-str"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpycore_ArgvToC(a0, argc)) == NULL)
            sipIsErr = 1;
        else
        {
            // Create it now the arguments are right.
            static int nargc;
            nargc = argc;
        
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipQApplication(nargc, argv);
            Py_END_ALLOW_THREADS
        
            // Now modify the original list.
            qpycore_UpdatePyArgv(a0, argc, argv);
        }
%End

    QApplication(SIP_PYLIST argv /DocType="list-of-str"/, bool GUIenabled) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, bool GUIenabled)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpycore_ArgvToC(a0, argc)) == NULL)
            sipIsErr = 1;
        else
        {
            // Create it now the arguments are right.
            static int nargc;
            nargc = argc;
        
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipQApplication(nargc, argv, a1);
            Py_END_ALLOW_THREADS
        
            // Now modify the original list.
            qpycore_UpdatePyArgv(a0, argc, argv);
        }
%End

    enum Type
    {
        Tty,
        GuiClient,
        GuiServer,
    };

    QApplication(SIP_PYLIST argv /DocType="list-of-str"/, QApplication::Type /Constrained/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, QApplication::Type)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpycore_ArgvToC(a0, argc)) == NULL)
            sipIsErr = 1;
        else
        {
            // Create it now the arguments are right.
            static int nargc;
            nargc = argc;
        
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipQApplication(nargc, argv, a1);
            Py_END_ALLOW_THREADS
        
            // Now modify the original list.
            qpycore_UpdatePyArgv(a0, argc, argv);
        }
%End

%If (WS_X11)
    QApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0) /PostHook=__pyQtQAppHook__/;
%End
%If (WS_X11)
    QApplication(Display *dpy, SIP_PYLIST argv /DocType="list-of-str"/, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0) /PostHook=__pyQtQAppHook__/ [(Display *display, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpycore_ArgvToC(a1, argc)) == NULL)
            sipIsErr = 1;
        else
        {
            // Create it now the arguments are right.
            static int nargc;
            nargc = argc;
        
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipQApplication(a0, nargc, argv, a2, a3);
            Py_END_ALLOW_THREADS
        
            // Now modify the original list.
            qpycore_UpdatePyArgv(a1, argc, argv);
        }
%End

%End
    virtual ~QApplication();
%MethodCode
        // Make sure all top level widgets are not owned by Python and so won't be
        // destroyed by the garbage collector after QApplication is destroyed.
        QWidgetList tlw = QApplication::topLevelWidgets();
        
        for (int i = 0; i < tlw.count(); ++i)
        {
            PyObject *sw = sipGetPyObject(tlw.at(i), sipType_QWidget);
        
            if (sw)
                sipTransferTo(sw, 0);
        }
        
        // Handle all other QObject instances that we want to make sure are deleted
        // before the QApplication is deleted.
        qtgui_delete_tracked();
%End

    static QApplication::Type type();
    static QStyle *style();
    static void setStyle(QStyle * /Transfer/);
    static QStyle *setStyle(const QString &);

    enum ColorSpec
    {
        NormalColor,
        CustomColor,
        ManyColor,
    };

    static int colorSpec();
    static void setColorSpec(int);
    static QCursor *overrideCursor();
    static void setOverrideCursor(const QCursor &);
    static void changeOverrideCursor(const QCursor &);
    static void restoreOverrideCursor();
    static QPalette palette();
    static QPalette palette(const QWidget *);
    static QPalette palette(const char *className);
    static void setPalette(const QPalette &palette, const char *className = 0);
%If (- Qt_4_2_0)
    static QFont font(const QWidget *widget = 0);
%End
    static void setFont(const QFont &font, const char *className = 0);
    static QFontMetrics fontMetrics();
    static void setWindowIcon(const QIcon &icon);
    static QIcon windowIcon();
    static QWidgetList allWidgets();
    static QWidgetList topLevelWidgets();
    static QDesktopWidget *desktop();
    static QWidget *activePopupWidget();
    static QWidget *activeModalWidget();
    static QClipboard *clipboard();
    static QWidget *focusWidget();
    static QWidget *activeWindow();
    static void setActiveWindow(QWidget *act);
    static QWidget *widgetAt(const QPoint &p);
    static QWidget *widgetAt(int x, int y);
    static QWidget *topLevelAt(const QPoint &p);
    static QWidget *topLevelAt(int x, int y);
    static void syncX();
    static void beep();
    static Qt::KeyboardModifiers keyboardModifiers();
    static Qt::MouseButtons mouseButtons();
    static void setDesktopSettingsAware(bool);
    static bool desktopSettingsAware();
    static void setCursorFlashTime(int);
    static int cursorFlashTime();
    static void setDoubleClickInterval(int);
    static int doubleClickInterval();
    static void setKeyboardInputInterval(int);
    static int keyboardInputInterval();
    static void setWheelScrollLines(int);
    static int wheelScrollLines();
    static void setGlobalStrut(const QSize &);
    static QSize globalStrut();
    static void setStartDragTime(int ms);
    static int startDragTime();
    static void setStartDragDistance(int l);
    static int startDragDistance();
    static void setLayoutDirection(Qt::LayoutDirection direction);
    static Qt::LayoutDirection layoutDirection();
    static bool isRightToLeft();
    static bool isLeftToRight();
    static bool isEffectEnabled(Qt::UIEffect);
    static void setEffectEnabled(Qt::UIEffect effect, bool enabled = true);
%If (WS_X11)
    virtual bool x11EventFilter(XEvent *);
%End
%If (WS_X11)
    int x11ProcessEvent(XEvent *);
%End
%If (PyQt_SessionManager)
    bool isSessionRestored() const;
%End
%If (PyQt_SessionManager)
    QString sessionId() const;
%End
%If (PyQt_SessionManager)
    QString sessionKey() const;
%End
%If (PyQt_SessionManager)
    virtual void commitData(QSessionManager &sm);
%End
%If (PyQt_SessionManager)
    virtual void saveState(QSessionManager &sm);
%End
    void setInputContext(QInputContext * /Transfer/);
    QInputContext *inputContext() const;
    static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
%If (Py_v3)
    static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
%End
    virtual bool notify(QObject *, QEvent *) /ReleaseGIL/;
    static void setQuitOnLastWindowClosed(bool quit);
    static bool quitOnLastWindowClosed();

signals:
%If (Qt_4_2_0 -)
%If (PyQt_SessionManager)
    void commitDataRequest(QSessionManager &sessionManager);
%End
%End
    void focusChanged(QWidget *old, QWidget *now);
    void lastWindowClosed();
%If (Qt_4_2_0 -)
%If (PyQt_SessionManager)
    void saveStateRequest(QSessionManager &sessionManager);
%End
%End
%If (Qt_4_5_0 -)
    void fontDatabaseChanged();
%End

public slots:
    static void aboutQt();
    static void closeAllWindows();
%If (Qt_4_2_0 -)
    void setStyleSheet(const QString &sheet);
%End

protected:
    virtual bool event(QEvent *);

public:
%If (Qt_4_2_0 -)
    static QFont font();
%End
%If (Qt_4_2_0 -)
    static QFont font(const QWidget *);
%End
%If (Qt_4_2_0 -)
    static QFont font(const char *className);
%End
%If (Qt_4_2_0 -)
    static QLocale keyboardInputLocale();
%End
%If (Qt_4_2_0 -)
    static Qt::LayoutDirection keyboardInputDirection();
%End
%If (Qt_4_2_0 -)
    QString styleSheet() const;
%End
%If (Qt_4_3_0 -)
    static void alert(QWidget *widget, int msecs = 0) /ReleaseGIL/;
%End
%If (Qt_4_5_0 -)
    static void setGraphicsSystem(const QString &);
%End

public slots:
%If (Qt_4_6_0 -)
    void setAutoSipEnabled(const bool enabled);
%End

public:
%If (Qt_4_6_0 -)
    bool autoSipEnabled() const;
%End
%If (Qt_4_8_0 -)
    static Qt::KeyboardModifiers queryKeyboardModifiers();
%End

private:
    QApplication(const QApplication &);
};

%End

%ModuleHeaderCode
// Used to track QObject instances that must be explicitly destroyed before the
// QApplication instance is destroyed.  Typically these are instances that
// sometimes don't have a parent (and are not QWidgets).
void qtgui_track(QObject *o);
void qtgui_untrack(QObject *o);
void qtgui_delete_tracked();

extern char **(*qpycore_ArgvToC)(PyObject *, int &);
extern void (*qpycore_UpdatePyArgv)(PyObject *, int, char **);
extern const char *(*qpycore_pyqtsignal_get_parts)(PyObject *, QObject **);

// This is needed for Qt v5.0.0.
#if defined(B0)
#undef B0
#endif
%End

%ModuleCode
// Symbols imported from the QtCore module.
char **(*qpycore_ArgvToC)(PyObject *, int &);
void (*qpycore_UpdatePyArgv)(PyObject *, int, char **);
const char *(*qpycore_pyqtsignal_get_parts)(PyObject *, QObject **);

// Forward declarations of the low level exported functions.
#if defined(Q_WS_X11) && QT_VERSION < 0x050000
void qt_x11_wait_for_window_manager(QWidget *widget);
#endif

#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
void qt_set_sequence_auto_mnemonic(bool enable);
void qt_mac_set_menubar_icons(bool enable);
void qt_mac_set_menubar_merge(bool enable);
void qt_mac_set_native_menubar(bool enable);
void qt_mac_secure_keyboard(bool enable);
void qt_mac_set_dock_menu(QMenu *menu);
void qt_mac_set_press_and_hold_context(bool enable);
#endif


// These are the implementations of the functions that handle object tracking.
#include <QObjectCleanupHandler>

QObjectCleanupHandler *qtgui_cleanup_handler = 0;

void qtgui_track(QObject *o)
{
    if (!qtgui_cleanup_handler)
        qtgui_cleanup_handler = new QObjectCleanupHandler;

    qtgui_cleanup_handler->add(o);
}

void qtgui_untrack(QObject *o)
{
    // Note that we specifically untrack a tracked object rather than let Qt
    // detect the object being destroyed and doing it itself.  This is done to
    // work around a problem in threaded applications.
    if (qtgui_cleanup_handler)
        qtgui_cleanup_handler->remove(o);
}

void qtgui_delete_tracked()
{
    if (qtgui_cleanup_handler)
    {
        // Watch out for recursive calls (which should never happen).
        QObjectCleanupHandler *hnd = qtgui_cleanup_handler;
        qtgui_cleanup_handler = 0;

        Py_BEGIN_ALLOW_THREADS
        delete hnd;
        Py_END_ALLOW_THREADS
    }
}
%End

%PostInitialisationCode
// Import helpers from the QtCore module.
qpycore_ArgvToC = (char **(*)(PyObject *, int &))sipImportSymbol("qpycore_ArgvToC");
qpycore_UpdatePyArgv = (void (*)(PyObject *, int, char **))sipImportSymbol("qpycore_UpdatePyArgv");
qpycore_pyqtsignal_get_parts = (const char *(*)(PyObject *, QObject **))sipImportSymbol("qpycore_pyqtsignal_get_parts");

// Export our own helpers.
sipExportSymbol("qtgui_wrap_ancestors", (void *)qtgui_wrap_ancestors);

#if QT_VERSION >= 0x050000
// These correspond to typedefs used to define compatibility synonyms for Qt4
// classes that no longer exist.  SIP's support for typedefs should be extended
// to do this automatically.

static const char *name_table[] = {
    "QStyleOptionFrame", "QStyleOptionFrameV2", "QStyleOptionFrameV3", 0,
    "QStyleOptionProgressBar", "QStyleOptionProgressBarV2", 0,
    "QStyleOptionTab", "QStyleOptionTabV2", "QStyleOptionTabV3", 0,
    "QStyleOptionTabBarBase", "QStyleOptionTabBarBaseV2", 0,
    "QStyleOptionTabWidgetFrame", "QStyleOptionTabWidgetFrameV2", 0,
    "QStyleOptionToolBox", "QStyleOptionToolBoxV2", 0,
    "QStyleOptionViewItem", "QStyleOptionViewItemV2", "QStyleOptionViewItemV3",
            "QStyleOptionViewItemV4", 0,
    0};

for (const char **names = name_table; *names; ++names)
{
    const char *name = *names;

    PyObject *type_obj = PyDict_GetItemString(sipModuleDict, name);
    Q_ASSERT(type_obj);

    while (const char *synonym = *++names)
        PyDict_SetItemString(sipModuleDict, synonym, type_obj);
}
#endif
%End
