source: trunk/doc/src/snippets/code/doc_src_plugins-howto.qdoc@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 1.1 KB
Line 
1//! [0]
2class MyStylePlugin : public QStylePlugin
3{
4public:
5 QStringList keys() const;
6 QStyle *create(const QString &key);
7};
8//! [0]
9
10
11//! [1]
12#include "mystyleplugin.h"
13
14QStringList MyStylePlugin::keys() const
15{
16 return QStringList() << "MyStyle";
17}
18
19QStyle *MyStylePlugin::create(const QString &key)
20{
21 if (key.toLower() == "mystyle")
22 return new MyStyle;
23 return 0;
24}
25
26Q_EXPORT_PLUGIN2(pnp_mystyleplugin, MyStylePlugin)
27//! [1]
28
29
30//! [2]
31QApplication::setStyle(QStyleFactory::create("MyStyle"));
32//! [2]
33
34
35//! [3]
36CONFIG += release
37//! [3]
38
39
40//! [4]
41#include <QApplication>
42#include <QtPlugin>
43
44Q_IMPORT_PLUGIN(qjpeg)
45Q_IMPORT_PLUGIN(qgif)
46Q_IMPORT_PLUGIN(qkrcodecs)
47
48int main(int argc, char *argv[])
49{
50 QApplication app(argc, argv);
51 ...
52 return app.exec();
53}
54//! [4]
55
56
57//! [5]
58QTPLUGIN += qjpeg \
59 qgif \
60 qkrcodecs
61//! [5]
62
63
64//! [6]
65HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.debug
66HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.false
67//! [6]
Note: See TracBrowser for help on using the repository browser.