QApplication 過時成員

以下成員源於類 QApplication 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共類型

(obsolete) enum ColorSpec { NormalColor, CustomColor, ManyColor }

特性

靜態公共成員

(obsolete) int colorSpec ()
(obsolete) QDesktopWidget * desktop ()
(obsolete) QSize globalStrut ()
(obsolete) bool keypadNavigationEnabled ()
(obsolete) void setColorSpec (int spec )
(obsolete) void setGlobalStrut ( const QSize & )
(obsolete) void setKeypadNavigationEnabled (bool enable )

成員類型文檔編製

enum QApplication:: ColorSpec

This enum is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

常量 描述
QApplication::NormalColor 0 the default color allocation policy
QApplication::CustomColor 1 the same as NormalColor for X11; allocates colors to a palette on demand under Windows
QApplication::ManyColor 2 the right choice for applications that use thousands of colors

setColorSpec () for full details.

特性文檔編製

globalStrut : QSize

This property is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

此特性保持用戶可以與之交互的任何 GUI 元素應有的最小大小

例如,不應將按鈕大小重置成小於全局結構大小。應考慮結構大小,當重實現可以用於觸摸屏 (或類似 I/O 設備) 的 GUI 控件時。

範例:

QSize MyWidget::sizeHint() const
{
    return QSize(80, 25);
}
					

默認情況下,此特性包含 QSize 對象具有 0 寬度和高度。

訪問函數:

QSize globalStrut ()
void setGlobalStrut ( const QSize & )

成員函數文檔編製

[static] int QApplication:: colorSpec ()

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Returns the color specification.

另請參閱 QApplication::setColorSpec ().

[static] QDesktopWidget *QApplication:: desktop ()

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴桌麵 Widget (也稱根窗口)。

桌麵可能由多個屏幕組成,因此它將是不正確的,例如:試圖 center 某個 Widget 在桌麵幾何體中。 QDesktopWidget 擁有各種用於獲得桌麵上有用幾何體的函數,譬如 QDesktopWidget::screenGeometry () 和 QDesktopWidget::availableGeometry ().

[static] bool QApplication:: keypadNavigationEnabled ()

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴 true if Qt is set to use keypad navigation; otherwise returns false. The default value is false.

This feature is available in Qt for Embedded Linux, and Windows CE only.

注意: On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined.

另請參閱 setKeypadNavigationEnabled () 和 navigationMode ().

[static] void QApplication:: setColorSpec ( int spec )

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Sets the color specification for the application to spec .

This call has no effect.

The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color displays.

The color specification must be set before you create the QApplication 對象。

The options are:

  • QApplication::NormalColor . This is the default color allocation strategy. Use this option if your application uses buttons, menus, texts and pixmaps with few colors. With this option, the application uses system global colors. This works fine for most applications under X11, but on the Windows platform, it may cause dithering of non-standard colors.
  • QApplication::CustomColor . Use this option if your application needs a small number of custom colors. On X11, this option is the same as NormalColor . On Windows, Qt creates a Windows palette, and allocates colors to it on demand.
  • QApplication::ManyColor . Use this option if your application is very color hungry, e.g., it requires thousands of colors.
    Under X11 the effect is:
    • For 256-color displays which have at best a 256 color true color visual, the default visual is used, and colors are allocated from a color cube. The color cube is the 6x6x6 (216 color) "Web palette" (the red, green, and blue components always have one of the following values: 0x00, 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors can be changed by the -ncols option. The user can force the application to use the true color visual with the -visual 選項。
    • For 256-color displays which have a true color visual with more than 256 colors, use that visual. Silicon Graphics X servers this feature, for example. They provide an 8 bit visual by default but can deliver true color when asked.

    On Windows, Qt creates a Windows palette, and fills it with a color cube.

Be aware that the CustomColor and ManyColor choices may lead to colormap flashing: The foreground application gets (most) of the available colors, while the background windows will look less attractive.

範例:

int main(int argc, char *argv[])
{
    QApplication::setColorSpec(QApplication::ManyColor);
    QApplication app(argc, argv);
    ...
    return app.exec();
}
					

另請參閱 colorSpec ().

[static] void QApplication:: setKeypadNavigationEnabled ( bool enable )

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Sets whether Qt should use focus navigation suitable for use with a minimal keypad.

This feature is available in Qt for Embedded Linux, and Windows CE only.

注意: On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined.

另請參閱 keypadNavigationEnabled () 和 setNavigationMode ().