Compatibility Members for QApplication

以下成員源於類 QApplication are part of the Qt compatibility layer. We advise against using them in new code.

公共類型

typedef ColorMode

靜態公共成員

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 ()

成員類型文檔編製

typedef QApplication:: ColorMode

使用 ColorSpec 代替。

成員函數文檔編製

[static] ColorMode QApplication:: colorMode ()

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

另請參閱 setColorMode ().

[static] void QApplication:: flushX ()

使用 flush () 代替。

[static] bool QApplication:: hasGlobalMouseTracking ()

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

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

使用 QSysInfo::MacintoshVersion 代替。

[static] QWidget * QApplication:: mainWidget ()

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

另請參閱 setMainWidget ().

[static] bool QApplication:: reverseLayout ()

使用 layoutDirection () 代替。

另請參閱 setReverseLayout ().

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

使用 setColorSpec () instead, and pass a ColorSpec value instead.

另請參閱 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 參數被忽略。

另請參閱 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 擁有所有權對於 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 () 到 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().

另請參閱 mainWidget (), exec (),和 quit ().

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

使用 changeOverrideCursor ( cursor ) (if replace is true) or setOverrideCursor ( cursor ) (if replace 為 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 )

使用 setLayoutDirection () 代替。

另請參閱 reverseLayout ().

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

Use the palette instead.

例如,若有代碼像

app.setWinStyleHighlightColor(color);
					

可以把它重寫成

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

另請參閱 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 ()

使用 QApplication::palette ().color( QPalette::Active , QPalette::Highlight ) 代替。

另請參閱 setWinStyleHighlightColor ().

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

使用 QSysInfo::WindowsVersion 代替。

成員變量文檔編製

const int QApplication:: CustomColors

使用 CustomColor 代替。

const int QApplication:: NormalColors

使用 NormalColor 代替。