QSqlDriverPlugin 類

The QSqlDriverPlugin class provides an abstract base for custom QSqlDriver 插件。 更多...

頭: #include <QSqlDriverPlugin>
qmake: QT += sql
繼承: QObject

公共函數

QSqlDriverPlugin (QObject * parent = Q_NULLPTR)
~QSqlDriverPlugin ()
virtual QSqlDriver * create (const QString & key ) = 0

額外繼承成員

詳細描述

The QSqlDriverPlugin class provides an abstract base for custom QSqlDriver 插件。

The SQL driver plugin is a simple plugin interface that makes it easy to create your own SQL driver plugins that can be loaded dynamically by Qt.

Writing a SQL plugin is achieved by subclassing this base class, reimplementing the pure virtual function create (),和導齣類采用 Q_PLUGIN_METADATA () macro. See the SQL plugins that come with Qt for example implementations (in the plugins/src/sqldrivers subdirectory of the source distribution).

The json file containing the metadata for the plugin contains a list of keys indicating the supported sql drivers

{ "Keys": [ "mysqldriver" ] }
					

另請參閱 如何創建 Qt 插件 .

成員函數文檔編製

QSqlDriverPlugin:: QSqlDriverPlugin ( QObject * parent = Q_NULLPTR)

Constructs a SQL driver plugin and sets the parent to parent . This is invoked automatically by the moc generated code that exports the plugin.

QSqlDriverPlugin:: ~QSqlDriverPlugin ()

Destroys the SQL driver plugin.

從不需要明確調用這。Qt 自動銷毀插件當不再使用時。

[pure virtual] QSqlDriver *QSqlDriverPlugin:: create (const QString & key )

創建並返迴 QSqlDriver object for the driver called key . The driver key is usually the class name of the required driver. Keys are case sensitive.

另請參閱 如何創建 Qt 插件 .