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 <venugopal.shivashankar@digia.com>
This commit is contained in:
Alexander Volkov 2014-10-24 13:19:08 +04:00
parent 3903aee91b
commit 0f3323ce01
5 changed files with 5 additions and 4 deletions

View File

@ -45,7 +45,7 @@
CustomStyle::CustomStyle()
{
//! [0]
QSpinBox *spinBox = qobject_cast<QSpinBox *>(widget);
const QSpinBox *spinBox = qobject_cast<const QSpinBox *>(widget);
if (spinBox) {
//! [0] //! [1]
}

View File

@ -49,7 +49,7 @@ class CustomStyle : public QProxyStyle
Q_OBJECT
public:
CustomStyle()
CustomStyle();
~CustomStyle() {}
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,

View File

@ -1,2 +1,3 @@
QT += widgets
HEADERS += customstyle.h
SOURCES += customstyle.cpp main.cpp

View File

@ -39,7 +39,7 @@
****************************************************************************/
//! [using a custom style]
#include <QtGui>
#include <QtWidgets>
#include "customstyle.h"

View File

@ -38,7 +38,7 @@
**
****************************************************************************/
#include <QtGui>
#include <QtWidgets>
#include "customviewstyle.h"