From 114f247773c2ba7d7a04dec5381be73841ff965a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 27 Nov 2012 00:27:32 +0100 Subject: Update the StylePlugin example QWindowsStyle will soon become an internal class, inherit SimpleStyle from QProxyStyle. The documentation has been updated accordingly. Change-Id: Ib55f59729e980b93276e9c2903f13b5e46612ac8 Reviewed-by: Jerome Pasion --- examples/tools/doc/styleplugin.qdoc | 28 ++++++++++++++----------- examples/tools/styleplugin/plugin/simplestyle.h | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'examples') diff --git a/examples/tools/doc/styleplugin.qdoc b/examples/tools/doc/styleplugin.qdoc index ea33aa1de7..088c660727 100644 --- a/examples/tools/doc/styleplugin.qdoc +++ b/examples/tools/doc/styleplugin.qdoc @@ -34,10 +34,6 @@ \image stylepluginexample.png - On some platforms, the native style will prevent the button - from having a red background. In this case, try to run the example - in another style (e.g., plastique). - A plugin in Qt is a class stored in a shared library that can be loaded by a QPluginLoader at run-time. When you create plugins in Qt, they either extend a Qt application or Qt itself. Writing a @@ -52,14 +48,22 @@ class. Style plugins are loaded by Qt and made available through QStyleFactory; we will look at this later. We have implemented \c SimpleStylePlugin, which provides \c SimpleStyle. The new style - inherits QWindowsStyle and contributes to widget styling by - drawing button backgrounds in red - not a major contribution, but - it still makes a new style. We test the plugin with \c - StyleWindow, in which we display a QPushButton. - - The \c SimpleStyle and \c StyleWindow classes do not contain any - plugin specific functionality and their implementations are - trivial; we will therefore leap past them and head on to the \c + contributes to widget styling by drawing button backgrounds in + red - not a major contribution, but it still makes a new style. + + The new style is platform agnostic in the sense that it is not + based on any specific style implementation, but uses QProxyStyle + to merely tweak the looks in the current application style that + defaults to the native system style. + + \note On some platforms, the native style will prevent the button + from having a red background. In this case, try to run the example + in another style (e.g., fusion). + + We test the plugin with \c StyleWindow, in which we display a + QPushButton. The \c SimpleStyle and \c StyleWindow classes do not + contain any plugin specific functionality and their implementations + are trivial; we will therefore leap past them and head on to the \c SimpleStylePlugin and the \c main() function. After we have looked at that, we examine the plugin's profile. diff --git a/examples/tools/styleplugin/plugin/simplestyle.h b/examples/tools/styleplugin/plugin/simplestyle.h index ab901cf710..15d5fb3b7f 100644 --- a/examples/tools/styleplugin/plugin/simplestyle.h +++ b/examples/tools/styleplugin/plugin/simplestyle.h @@ -41,13 +41,13 @@ #ifndef SIMPLESTYLE_H #define SIMPLESTYLE_H -#include +#include QT_BEGIN_NAMESPACE class QPalette; QT_END_NAMESPACE -class SimpleStyle : public QWindowsStyle +class SimpleStyle : public QProxyStyle { Q_OBJECT -- cgit v1.2.3