Compatibility Members for QApplication

The following members of class QApplicationare part of the Qt compatibility layer. We advise against using them in new code.

Public Types

typedef ColorMode

Static Public Members

const int CustomColors
const int NormalColors
ColorMode colorMode()
void flushX()
bool hasGlobalMouseTracking()
Qt::MacintoshVersion macVersion()
QWidget * mainWidget()
bool reverseLayout()
void setColorMode(ColorMode mode)
void setFont(const QFont & font, bool b, const char * className = 0)
void setGlobalMouseTracking(bool dummy)
void setMainWidget(QWidget * mainWidget)
void setOverrideCursor(const QCursor & cursor, bool replace)
void setPalette(const QPalette & pal, bool b, const char * className = 0)
void setReverseLayout(bool reverse)
void setWinStyleHighlightColor(const QColor & c)
QWidget * widgetAt(int x, int y, bool child)
QWidget * widgetAt(const QPoint & point, bool child)
const QColor & winStyleHighlightColor()
Qt::WindowsVersion winVersion()

Member Type Documentation

typedef QApplication::ColorMode

Use ColorSpec instead.

Member Function Documentation

[static] ColorMode QApplication::colorMode()

Use colorSpec() instead, and use ColorSpec as the enum type.

See also setColorMode().

[static] void QApplication::flushX()

Use flush() instead.

[static] bool QApplication::hasGlobalMouseTracking()

This feature does not exist anymore. This function always returns true in Qt 4.

[static] Qt::MacintoshVersion QApplication::macVersion()

Use QSysInfo::MacintoshVersion instead.

[static] QWidget * QApplication::mainWidget()

Returns the main application widget, or 0 if there is no main widget.

See also setMainWidget().

[static] bool QApplication::reverseLayout()

Use layoutDirection() instead.

See also setReverseLayout().

[static] void QApplication::setColorMode(ColorMode mode)

Use setColorSpec() instead, and pass a ColorSpec value instead.

See also colorMode().

[static] void QApplication::setFont(const QFont & font, bool b, const char * className = 0)

Use the two-argument overload instead.

[static] void QApplication::setGlobalMouseTracking(bool dummy)

This function does nothing in Qt 4. The dummy parameter is ignored.

See also hasGlobalMouseTracking().

[static] void QApplication::setMainWidget(QWidget * mainWidget)

Sets the application's main widget to mainWidget.

In most respects the main widget is like any other widget, except that if it is closed, the application exits. QApplication does not take ownership of the mainWidget, so if you create your main widget on the heap you must delete it yourself.

You need not have a main widget; connecting lastWindowClosed() to quit() is an alternative.

On X11, this function also resizes and moves the main widget according to the -geometry command-line option, so you should set the default geometry (using QWidget::setGeometry()) before calling setMainWidget().

See also mainWidget(), exec(), and quit().

[static] void QApplication::setOverrideCursor(const QCursor & cursor, bool replace)

Use changeOverrideCursor(cursor) (if replace is true) or setOverrideCursor(cursor) (if replace is false).

[static] void QApplication::setPalette(const QPalette & pal, bool b, const char * className = 0)

Use the two-argument overload instead.

[static] void QApplication::setReverseLayout(bool reverse)

Use setLayoutDirection() instead.

See also reverseLayout().

[static] void QApplication::setWinStyleHighlightColor(const QColor & c)

Use the palette instead.

For example, if you have code like

app.setWinStyleHighlightColor(color);

you can rewrite it as

QPalette palette(QApplication::palette());
palette.setColor(QPalette::Highlight, color);
QApplication::setPalette(palette);

See also winStyleHighlightColor().

[static] QWidget * QApplication::widgetAt(int x, int y, bool child)

Use the two-argument widgetAt() overload to get the child widget. To get the top-level widget do this:

QWidget *widget = qApp->widgetAt(x, y);
if (widget)
    widget = widget->window();

[static] QWidget * QApplication::widgetAt(const QPoint & point, bool child)

Use the single-argument widgetAt() overload to get the child widget. To get the top-level widget do this:

QWidget *widget = qApp->widgetAt(point);
if (widget)
    widget = widget->window();

[static] const QColor & QApplication::winStyleHighlightColor()

Use QApplication::palette().color(QPalette::Active, QPalette::Highlight) instead.

See also setWinStyleHighlightColor().

[static] Qt::WindowsVersion QApplication::winVersion()

Use QSysInfo::WindowsVersion instead.

Member Variable Documentation

const int QApplication::CustomColors

Use CustomColor instead.

const int QApplication::NormalColors

Use NormalColor instead.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.