QSqlDriverPlugin 類提供抽象基為自定義 QSqlDriver 插件。 更多...
| 頭: | #include <QSqlDriverPlugin> |
| qmake: | QT += sql |
| 繼承: | QObject |
| QSqlDriverPlugin (QObject * parent = nullptr) | |
| virtual | ~QSqlDriverPlugin () |
| virtual QSqlDriver * | create (const QString & key ) = 0 |
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 插件 .
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 插件 .