CopperSpice Overview  1.5.2
Platform Specific Functions

There are a few low level functions which can be used to fine tune your application on specific platforms. Most of these functions perform very specific tasks. In general, we recommend using the public API before using the functions mentioned here.

These functions are exported by CsCore and CsGui. Most of them are not declared in the CopperSpice header files. To use them in your application you must declare them before calling them.

These functions may not be present in future versions of CopperSpice.

For example:

1 #ifdef Q_WS_X11
2 void qt_x11_wait_for_window_manager(QWidget *widget);
3 #endif
5 int main(int argc, char *argv[])
6 {
7  QApplication app(argc, argv);
9  QWidget window;
12 #ifdef Q_WS_X11
13  qt_x11_wait_for_window_manager(&window);
14 #endif
16  // additional code
18  return app.exec();
19 }

void qt_set_library_config_file(const QString &fileName)

Specifies the location of the CopperSpice configuration file. This function must be called before constructing a QApplication or QCoreApplication object. If no location is specified, CopperSpice automatically finds an appropriate location.

void qt_set_sequence_auto_mnemonic(bool enable)

Specifies whether mnemonics for menu items, labels, etc, should be honored or not. On Windows and X11 this feature is on by default. On Mac OS X it is off by default. When this feature is off the QKeySequence::mnemonic() function always returns an empty string. This feature is enabled on embedded Linux.

void qt_x11_wait_for_window_manager(QWidget *widget)

Blocks until the X11 window manager has shown the widget after a call to QWidget::show().

void qt_mac_secure_keyboard(bool enable)

Turns the Mac OS X secure keyboard feature on or off. QLineEdit uses this when the echo mode is QLineEdit::Password or QLineEdit::NoEcho to guard the editor against keyboard sniffing. If you implement your own password editor, you might want to turn on this feature in your editor's QWidget::focusInEvent() and turn it off in QWidget::focusOutEvent().

void qt_mac_set_dock_menu(QMenu menu)

Sets the menu to display in the Mac OS X Dock for the application. This menu is shown when the user attempts a press-and-hold operation on the application's dock icon or Ctrl-clicks on it while the application is running.

The menu will be turned into a Mac OS X menu and the items added to the default Dock menu. There is no merging of the CS menu items with the items that are in the Dock menu (i.e., it is not recommended to include actions that duplicate functionality of items already in the Dock menu).

void qt_mac_set_menubar_icons(bool enable)

Specifies whether icons associated to menu items for the application's menu bar should be shown on Mac OS X. By default, icons are shown on Mac OS X just like on the other platforms.

void qt_mac_set_menubar_merge(bool enable)

Specifies whether CopperSpuice should attempt to relocate standard menu items such as Quit, Preferences, and About to the application menu on Mac OS X. This feature is on by default.

void qt_mac_set_native_menubar(bool enable)

Specifies whether the application should use the native menu bar on Mac OS X or be part of the main window. This feature is on by default.

void qt_mac_set_press_and_hold_context(bool enable)

Turns emulation of the right mouse button by clicking and holding the left mouse button on or off. This feature is off by default.