QSqlDriverPlugin 类

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

头: #include <QSqlDriverPlugin>
继承: QObject

公共函数

QSqlDriverPlugin (QObject * parent = 0)
~QSqlDriverPlugin ()

重实现公共函数

virtual QSqlDriver * create (const QString & key ) = 0
virtual QStringList keys () const = 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 functions keys () 和 create (),和导出类采用 Q_EXPORT_PLUGIN2 () macro. See the SQL plugins that come with Qt for example implementations (in the plugins/src/sqldrivers subdirectory of the source distribution).

另请参阅 如何创建 Qt 插件 .

成员函数文档编制

QSqlDriverPlugin:: QSqlDriverPlugin ( QObject * parent = 0)

Constructs a SQL driver plugin and sets the parent to parent . This is invoked automatically by the Q_EXPORT_PLUGIN2 () 宏。

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.

另请参阅 keys ().

[pure virtual] QStringList QSqlDriverPlugin:: keys () const

Returns the list of drivers (keys) this plugin supports.

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

另请参阅 create ().