// qapplication.sip generated by MetaSIP on Mon Jul 27 19:09:13 2009
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2009 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.
// 
// Please review the following information to ensure GNU General
// Public Licensing requirements will be met:
// http://trolltech.com/products/qt/licenses/licensing/opensource/. If
// you are unsure which license is appropriate for your use, please
// review the following information:
// http://trolltech.com/products/qt/licenses/licensing/licensingoverview
// or contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
// INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
// granted herein.
// 
// 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 (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/
{
%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
void qt_set_sequence_auto_mnemonic(bool enable);
%If (WS_X11)
void qt_x11_wait_for_window_manager(QWidget *widget);
%End
%If (WS_MACX)
void qt_mac_secure_keyboard(bool enable);
%End
%If (WS_MACX)
void qt_mac_set_dock_menu(QMenu *menu);
%End
%If (WS_MACX)
void qt_mac_set_menubar_icons(bool enable);
%End
%If (WS_MACX)
void qt_mac_set_menubar_merge(bool enable);
%End
%If (WS_MACX)
void qt_mac_set_native_menubar(bool enable);
%End
%If (WS_MACX)
void qt_mac_set_press_and_hold_context(bool enable);
%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

class QApplication : QCoreApplication
{

%TypeHeaderCode
#include <qapplication.h>
%End

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

    QApplication(SIP_PYLIST argv, 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 = qpygui_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.
            qpygui_UpdatePyArgv(a0, argc, argv);
        }
%End

    enum Type
    {
        Tty,
        GuiClient,
        GuiServer,
    };

    QApplication(SIP_PYLIST argv, 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 = qpygui_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.
            qpygui_UpdatePyArgv(a0, argc, argv);
        }
%End

%If (WS_X11)
    QApplication(Display *dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0) /PostHook=__pyQtQAppHook__/;
%End
%If (WS_X11)
    QApplication(Display *dpy, SIP_PYLIST argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0) /PostHook=__pyQtQAppHook__/ [(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0)];
%MethodCode
        // The Python interface is a list of argument strings that is modified.
        
        int argc;
        char **argv;
        
        // Convert the list.
        if ((argv = qpygui_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.
            qpygui_UpdatePyArgv(a1, argc, argv);
        }
%End

%End
    virtual ~QApplication();
%MethodCode
        // Make sure all remaining top level widgets are not owned by Python.  When a
        // PyQt script terminates we have no control over the order in which the
        // QApplication instance and the top level widgets are destroyed.  If the
        // former happens first then we get a seg. fault.  We could take the approach
        // of only pretending to delete the QApplication instance, but Qt seems to
        // allow an application to delete the QApplication instance and then create
        // another one (and it's useful for unit testing).  The approach we take is to
        // transfer ownership of all top level widgets away from Python so that the C++
        // dtor is not called if they are destroyed after the QApplication instance.
        // This might be seen as a memory leak - but if we really are terminating
        // then it doesn't matter, and if we are just deleting the QApplication
        // instance then we should have already deleted the top level widgets manually.]
        // In any event, the X server resources will be freed.
        
        QWidgetList tlw = QApplication::topLevelWidgets();
        
        for (int i = 0; i < tlw.count(); ++i)
        {
            PyObject *sw;
        
            if ((sw = sipGetPyObject(tlw.at(i), sipType_QWidget)) != NULL)
                sipTransferTo(sw, NULL);
        }
        
        
        // Handle all 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 &, const char *className = 0);
%If (- Qt_4_2_0)
    static QFont font(const QWidget * = 0);
%End
    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 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, bool enable = 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 *);
    QInputContext *inputContext() const;
    static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
%If (Py_v3)
    static int exec() /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 duration = 0) /ReleaseGIL/;
%End
%If (Qt_4_5_0 -)
    static void setGraphicsSystem(const QString &);
%End

private:
    QApplication(const QApplication &);
};

%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).  (QGraphicsScene seems
// to be the most common, possibly only, example.)
void qtgui_track(QObject *o);
void qtgui_delete_tracked();

extern char **(*qpygui_ArgvToC)(PyObject *, int &);
extern void (*qpygui_UpdatePyArgv)(PyObject *, int, char **);
%End

%ModuleCode
// Symbols imported from the QtCore module.

char **(*qpygui_ArgvToC)(PyObject *, int &);
void (*qpygui_UpdatePyArgv)(PyObject *, int, char **);

// Forward declarations of the low level exported functions.

void qt_set_sequence_auto_mnemonic(bool enable);

#if defined(Q_WS_X11)
void qt_x11_wait_for_window_manager(QWidget *widget);
#endif

#if defined(Q_WS_MAC)
void qt_mac_secure_keyboard(bool enable);
void qt_mac_set_dock_menu(QMenu *menu);
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_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_delete_tracked()
{
    if (qtgui_cleanup_handler)
    {
        // Watch out for recursive calls (which should never happen).
        QObjectCleanupHandler *hnd = qtgui_cleanup_handler;
        qtgui_cleanup_handler = 0;

        delete hnd;
    }
}
%End

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