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:
parent
3903aee91b
commit
0f3323ce01
@ -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]
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class CustomStyle : public QProxyStyle
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomStyle()
|
||||
CustomStyle();
|
||||
~CustomStyle() {}
|
||||
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||
|
@ -1,2 +1,3 @@
|
||||
QT += widgets
|
||||
HEADERS += customstyle.h
|
||||
SOURCES += customstyle.cpp main.cpp
|
||||
|
@ -39,7 +39,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
//! [using a custom style]
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "customstyle.h"
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "customviewstyle.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user