Qt:Документация 4.3.2/qstyleplugin

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QStylePlugin Class Reference
[модуль QtGui ]

The QStylePlugin class provides an abstract base for custom QStyle plugins. Далее...

 #include <QStylePlugin>

Inherits QObject.

[править] Открытые функции

  • 29 открытых функций, унаследованных от QObject

[править] Дополнительные унаследованные члены

  • 1 свойство, унаследованное от QObject
  • 1 открытый слот, унаследованный от QObject
  • 1 сигнал, унаследованный от QObject
  • 5 статических открытых членов, унаследованных от QObject
  • 7 защищенных функций, унаследованных от QObject

[править] Подробное описание

The QStylePlugin class provides an abstract base for custom QStyle plugins.

QStylePlugin is a simple plugin interface that makes it easy to create custom styles that can be loaded dynamically into applications using the QStyleFactory class.

Writing a style plugin is achieved by subclassing this base class, reimplementing the pure virtual keys() and create() functions, and exporting the class using the Q_EXPORT_PLUGIN2() macro. See How to Create Qt Plugins for details.

See also QStyleFactory and QStyle.


[править] Описание функций-членов

[править]
QStylePlugin::QStylePlugin ( QObject * parent = 0 )

Constructs a style plugin with the given parent.

Note that this constructor is invoked automatically by the Q_EXPORT_PLUGIN2() macro, so there is no need for calling it explicitly.

[править]
QStylePlugin::~QStylePlugin ()

Destroys the style plugin.

Note that Qt destroys a plugin automatically when it is no longer used, so there is no need for calling the destructor explicitly.

[править]
QStyle * QStylePlugin::create ( const QString & key ) [pure virtual]

Creates and returns a QStyle object for the given style key.

The style key is usually the class name of the required style. Note that the keys are case insensitive. Пример:

 QStringList MyStylePlugin::keys() const
 {
     return QStringList() << "Rocket" << "StarBuster";
 }
 
 QStyle *MyStylePlugin::create(const QString &amp;key)
 {
     QString lcKey = key;
     if (lcKey == "rocket") {
         return new RocketStyle;
     } else if (lcKey == "starbuster") {
         return new StarBusterStyle;
     }
     return 0;
 }

See also keys().

[править]
QStringList QStylePlugin::keys () const [pure virtual]

Returns the list of style keys this plugin supports.

These keys are usually the class names of the custom styles that are implemented in the plugin.

See also create().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2