From 0f3323ce0194b271024d423bec861d51dc55063f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 24 Oct 2014 13:19:08 +0400 Subject: Doc: Fix CustomStyle snippet Add missing semicolon, include QtWidgets instead of QtGui and use cast for a const pointer because the example with casting relates to the code above where 'widget' is const. Task-number: QTBUG-31736 Change-Id: I5cb6d33ec692deaf41e9a1be9e36e752a8da8739 Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/snippets/customstyle/customstyle.cpp | 2 +- src/widgets/doc/snippets/customstyle/customstyle.h | 2 +- src/widgets/doc/snippets/customstyle/customstyle.pro | 1 + src/widgets/doc/snippets/customstyle/main.cpp | 2 +- src/widgets/doc/snippets/customviewstyle.cpp | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/widgets/doc/snippets/customstyle/customstyle.cpp b/src/widgets/doc/snippets/customstyle/customstyle.cpp index b5d44ebecd..16715929a8 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.cpp +++ b/src/widgets/doc/snippets/customstyle/customstyle.cpp @@ -45,7 +45,7 @@ CustomStyle::CustomStyle() { //! [0] - QSpinBox *spinBox = qobject_cast(widget); + const QSpinBox *spinBox = qobject_cast(widget); if (spinBox) { //! [0] //! [1] } diff --git a/src/widgets/doc/snippets/customstyle/customstyle.h b/src/widgets/doc/snippets/customstyle/customstyle.h index 0f23efc922..0782bdc09c 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.h +++ b/src/widgets/doc/snippets/customstyle/customstyle.h @@ -49,7 +49,7 @@ class CustomStyle : public QProxyStyle Q_OBJECT public: - CustomStyle() + CustomStyle(); ~CustomStyle() {} void drawPrimitive(PrimitiveElement element, const QStyleOption *option, diff --git a/src/widgets/doc/snippets/customstyle/customstyle.pro b/src/widgets/doc/snippets/customstyle/customstyle.pro index af0ee4e141..02b9b2791d 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.pro +++ b/src/widgets/doc/snippets/customstyle/customstyle.pro @@ -1,2 +1,3 @@ +QT += widgets HEADERS += customstyle.h SOURCES += customstyle.cpp main.cpp diff --git a/src/widgets/doc/snippets/customstyle/main.cpp b/src/widgets/doc/snippets/customstyle/main.cpp index 19fb6b2be9..8164a1e877 100644 --- a/src/widgets/doc/snippets/customstyle/main.cpp +++ b/src/widgets/doc/snippets/customstyle/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [using a custom style] -#include +#include #include "customstyle.h" diff --git a/src/widgets/doc/snippets/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle.cpp index cdb4ed1d77..0e641653aa 100644 --- a/src/widgets/doc/snippets/customviewstyle.cpp +++ b/src/widgets/doc/snippets/customviewstyle.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "customviewstyle.h" -- cgit v1.2.3