summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/network/multistreamclient/chatconsumer.h4
-rw-r--r--examples/network/multistreamclient/movieconsumer.h6
-rw-r--r--examples/network/multistreamclient/timeconsumer.h6
-rw-r--r--examples/network/multistreamserver/chatprovider.h6
-rw-r--r--examples/network/multistreamserver/server.h2
-rw-r--r--examples/network/multistreamserver/timeprovider.h2
-rw-r--r--examples/opengl/computegles31/glwindow.h2
-rw-r--r--examples/opengl/qopenglwindow/background_renderer.cpp6
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp2
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.h4
-rw-r--r--examples/widgets/mainwindows/mainwindow/mainwindow.cpp2
-rw-r--r--examples/widgets/mainwindows/mainwindow/mainwindow.h2
-rw-r--r--examples/widgets/mainwindows/mainwindow/toolbar.cpp4
-rw-r--r--examples/widgets/mainwindows/sdi/main.cpp2
-rw-r--r--examples/widgets/tools/codecs/previewform.h2
-rw-r--r--examples/widgets/tools/settingseditor/mainwindow.cpp2
-rw-r--r--examples/widgets/widgets/charactermap/mainwindow.cpp2
-rw-r--r--examples/widgets/widgets/icons/iconpreviewarea.cpp2
-rw-r--r--examples/widgets/widgets/icons/iconpreviewarea.h2
-rw-r--r--examples/widgets/widgets/icons/iconsizespinbox.h2
-rw-r--r--examples/widgets/widgets/icons/imagedelegate.h2
-rw-r--r--examples/widgets/widgets/tablet/mainwindow.cpp2
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.cpp9
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.h2
-rw-r--r--examples/xml/dombookmarks/xbeltree.h2
25 files changed, 42 insertions, 37 deletions
diff --git a/examples/network/multistreamclient/chatconsumer.h b/examples/network/multistreamclient/chatconsumer.h
index 9e12f99359..e10c0d7850 100644
--- a/examples/network/multistreamclient/chatconsumer.h
+++ b/examples/network/multistreamclient/chatconsumer.h
@@ -64,8 +64,8 @@ class ChatConsumer : public Consumer
public:
explicit ChatConsumer(QObject *parent = nullptr);
- QWidget *widget() Q_DECL_OVERRIDE;
- void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
+ QWidget *widget() override;
+ void readDatagram(const QByteArray &ba) override;
private slots:
void returnPressed();
diff --git a/examples/network/multistreamclient/movieconsumer.h b/examples/network/multistreamclient/movieconsumer.h
index 74321a8505..3f78bf2060 100644
--- a/examples/network/multistreamclient/movieconsumer.h
+++ b/examples/network/multistreamclient/movieconsumer.h
@@ -63,9 +63,9 @@ class MovieConsumer : public Consumer
public:
explicit MovieConsumer(QObject *parent = nullptr);
- QWidget *widget() Q_DECL_OVERRIDE;
- void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
- void serverDisconnected() Q_DECL_OVERRIDE;
+ QWidget *widget() override;
+ void readDatagram(const QByteArray &ba) override;
+ void serverDisconnected() override;
private:
QLabel *label;
diff --git a/examples/network/multistreamclient/timeconsumer.h b/examples/network/multistreamclient/timeconsumer.h
index 3faa4a6b1a..84a7796699 100644
--- a/examples/network/multistreamclient/timeconsumer.h
+++ b/examples/network/multistreamclient/timeconsumer.h
@@ -64,9 +64,9 @@ class TimeConsumer : public Consumer
public:
explicit TimeConsumer(QObject *parent = nullptr);
- QWidget *widget() Q_DECL_OVERRIDE;
- void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
- void serverDisconnected() Q_DECL_OVERRIDE;
+ QWidget *widget() override;
+ void readDatagram(const QByteArray &ba) override;
+ void serverDisconnected() override;
private slots:
void timerTick();
diff --git a/examples/network/multistreamserver/chatprovider.h b/examples/network/multistreamserver/chatprovider.h
index b6ff61a917..c52fa89240 100644
--- a/examples/network/multistreamserver/chatprovider.h
+++ b/examples/network/multistreamserver/chatprovider.h
@@ -59,9 +59,9 @@ class ChatProvider : public Provider
public:
explicit ChatProvider(QObject *parent = nullptr);
- void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE;
- void newConnection(QSctpSocket &client) Q_DECL_OVERRIDE;
- void clientDisconnected(QSctpSocket &client) Q_DECL_OVERRIDE;
+ void readDatagram(QSctpSocket &from, const QByteArray &ba) override;
+ void newConnection(QSctpSocket &client) override;
+ void clientDisconnected(QSctpSocket &client) override;
};
#endif
diff --git a/examples/network/multistreamserver/server.h b/examples/network/multistreamserver/server.h
index d9a38e61a4..2380d6ffd6 100644
--- a/examples/network/multistreamserver/server.h
+++ b/examples/network/multistreamserver/server.h
@@ -72,7 +72,7 @@ public:
virtual ~Server();
public slots:
- int exec() Q_DECL_OVERRIDE;
+ int exec() override;
private slots:
void newConnection();
diff --git a/examples/network/multistreamserver/timeprovider.h b/examples/network/multistreamserver/timeprovider.h
index f99cdbc717..a4d08fd67c 100644
--- a/examples/network/multistreamserver/timeprovider.h
+++ b/examples/network/multistreamserver/timeprovider.h
@@ -59,7 +59,7 @@ class TimeProvider : public Provider
public:
explicit TimeProvider(QObject *parent = nullptr);
- void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE;
+ void readDatagram(QSctpSocket &from, const QByteArray &ba) override;
};
#endif
diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h
index 877f7b732e..f243858a45 100644
--- a/examples/opengl/computegles31/glwindow.h
+++ b/examples/opengl/computegles31/glwindow.h
@@ -86,7 +86,7 @@ public:
void setBlurRadius(float blurRadius);
protected:
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
void setAnimating(bool animate);
private:
diff --git a/examples/opengl/qopenglwindow/background_renderer.cpp b/examples/opengl/qopenglwindow/background_renderer.cpp
index d57198444e..cba4ae1f2f 100644
--- a/examples/opengl/qopenglwindow/background_renderer.cpp
+++ b/examples/opengl/qopenglwindow/background_renderer.cpp
@@ -146,7 +146,7 @@ void FragmentToy::draw(const QSize &windowSize)
m_fragment_shader.reset(new QOpenGLShader(QOpenGLShader::Fragment));
if (!m_fragment_shader->compileSourceCode(data)) {
qWarning() << "Failed to compile fragment shader:" << m_fragment_shader->log();
- m_fragment_shader.reset(Q_NULLPTR);
+ m_fragment_shader.reset(nullptr);
}
} else {
qWarning() << "Unknown error, no fragment shader";
@@ -198,14 +198,14 @@ void FragmentToy::fileChanged(const QString &path)
m_recompile_shaders = true;
if (m_program) {
m_program->removeShader(m_fragment_shader.data());
- m_fragment_shader.reset(Q_NULLPTR);
+ m_fragment_shader.reset(nullptr);
}
}
} else {
m_recompile_shaders = true;
if (m_program) {
m_program->removeShader(m_fragment_shader.data());
- m_fragment_shader.reset(Q_NULLPTR);
+ m_fragment_shader.reset(nullptr);
}
}
}
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index c47b80275f..720f9a2085 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -468,7 +468,7 @@ static ColorSwatch *findByName(const QMainWindow *mainWindow, const QString &nam
if (name == dock->objectName())
return dock;
}
- return Q_NULLPTR;
+ return nullptr;
}
void ColorSwatch::splitInto(QAction *action)
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.h b/examples/widgets/mainwindows/mainwindow/colorswatch.h
index ec9d9e7372..7f73e46f31 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.h
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.h
@@ -62,7 +62,7 @@ class ColorSwatch : public QDockWidget
Q_OBJECT
public:
- explicit ColorSwatch(const QString &colorName, QMainWindow *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
+ explicit ColorSwatch(const QString &colorName, QMainWindow *parent = nullptr, Qt::WindowFlags flags = 0);
void setCustomSizeHint(const QSize &size);
QMenu *colorSwatchMenu() const { return menu; }
@@ -128,7 +128,7 @@ class BlueTitleBar : public QWidget
{
Q_OBJECT
public:
- explicit BlueTitleBar(QWidget *parent = Q_NULLPTR);
+ explicit BlueTitleBar(QWidget *parent = nullptr);
QSize sizeHint() const override { return minimumSizeHint(); }
QSize minimumSizeHint() const override;
diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
index afceddfca1..b2c5ccc473 100644
--- a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
+++ b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
@@ -382,7 +382,7 @@ void MainWindow::switchLayoutDirection()
class CreateDockWidgetDialog : public QDialog
{
public:
- explicit CreateDockWidgetDialog(QWidget *parent = Q_NULLPTR);
+ explicit CreateDockWidgetDialog(QWidget *parent = nullptr);
QString enteredObjectName() const { return m_objectName->text(); }
Qt::DockWidgetArea location() const;
diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.h b/examples/widgets/mainwindows/mainwindow/mainwindow.h
index af4f1f5745..9b1af6df80 100644
--- a/examples/widgets/mainwindows/mainwindow/mainwindow.h
+++ b/examples/widgets/mainwindows/mainwindow/mainwindow.h
@@ -64,7 +64,7 @@ public:
typedef QMap<QString, QSize> CustomSizeHintMap;
explicit MainWindow(const CustomSizeHintMap &customSizeHints,
- QWidget *parent = Q_NULLPTR,
+ QWidget *parent = nullptr,
Qt::WindowFlags flags = 0);
public slots:
diff --git a/examples/widgets/mainwindows/mainwindow/toolbar.cpp b/examples/widgets/mainwindows/mainwindow/toolbar.cpp
index 97152a64a3..bb30b63b02 100644
--- a/examples/widgets/mainwindows/mainwindow/toolbar.cpp
+++ b/examples/widgets/mainwindows/mainwindow/toolbar.cpp
@@ -81,8 +81,8 @@ static QPixmap genIcon(const QSize &iconSize, int number, const QColor &color)
ToolBar::ToolBar(const QString &title, QWidget *parent)
: QToolBar(parent)
- , spinbox(Q_NULLPTR)
- , spinboxAction(Q_NULLPTR)
+ , spinbox(nullptr)
+ , spinboxAction(nullptr)
{
setWindowTitle(title);
setObjectName(title);
diff --git a/examples/widgets/mainwindows/sdi/main.cpp b/examples/widgets/mainwindows/sdi/main.cpp
index bed990d34d..6e29fafd6f 100644
--- a/examples/widgets/mainwindows/sdi/main.cpp
+++ b/examples/widgets/mainwindows/sdi/main.cpp
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
parser.addPositionalArgument("file", "The file(s) to open.");
parser.process(app);
- MainWindow *mainWin = Q_NULLPTR;
+ MainWindow *mainWin = nullptr;
foreach (const QString &file, parser.positionalArguments()) {
MainWindow *newWin = new MainWindow(file);
newWin->tile(mainWin);
diff --git a/examples/widgets/tools/codecs/previewform.h b/examples/widgets/tools/codecs/previewform.h
index 1846b976de..6335b6539f 100644
--- a/examples/widgets/tools/codecs/previewform.h
+++ b/examples/widgets/tools/codecs/previewform.h
@@ -69,7 +69,7 @@ class PreviewForm : public QDialog
Q_OBJECT
public:
- explicit PreviewForm(QWidget *parent = Q_NULLPTR);
+ explicit PreviewForm(QWidget *parent = nullptr);
void setCodecList(const QList<QTextCodec *> &list);
void setEncodedData(const QByteArray &data);
diff --git a/examples/widgets/tools/settingseditor/mainwindow.cpp b/examples/widgets/tools/settingseditor/mainwindow.cpp
index ab9837c513..a7a1e9b415 100644
--- a/examples/widgets/tools/settingseditor/mainwindow.cpp
+++ b/examples/widgets/tools/settingseditor/mainwindow.cpp
@@ -56,7 +56,7 @@
MainWindow::MainWindow()
: settingsTree(new SettingsTree)
- , locationDialog(Q_NULLPTR)
+ , locationDialog(nullptr)
{
setCentralWidget(settingsTree);
diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp
index 5f17128a2f..d3ac55483c 100644
--- a/examples/widgets/widgets/charactermap/mainwindow.cpp
+++ b/examples/widgets/widgets/charactermap/mainwindow.cpp
@@ -244,7 +244,7 @@ void MainWindow::updateClipboard()
class FontInfoDialog : public QDialog
{
public:
- explicit FontInfoDialog(QWidget *parent = Q_NULLPTR);
+ explicit FontInfoDialog(QWidget *parent = nullptr);
private:
QString text() const;
diff --git a/examples/widgets/widgets/icons/iconpreviewarea.cpp b/examples/widgets/widgets/icons/iconpreviewarea.cpp
index 35379610c5..9cb54c47f6 100644
--- a/examples/widgets/widgets/icons/iconpreviewarea.cpp
+++ b/examples/widgets/widgets/icons/iconpreviewarea.cpp
@@ -190,7 +190,7 @@ QLabel *IconPreviewArea::createPixmapLabel()
//! [5]
void IconPreviewArea::updatePixmapLabels()
{
- QWindow *window = Q_NULLPTR;
+ QWindow *window = nullptr;
if (const QWidget *nativeParent = nativeParentWidget())
window = nativeParent->windowHandle();
for (int column = 0; column < NumModes; ++column) {
diff --git a/examples/widgets/widgets/icons/iconpreviewarea.h b/examples/widgets/widgets/icons/iconpreviewarea.h
index 3ebb9ed3ce..6ea35a5230 100644
--- a/examples/widgets/widgets/icons/iconpreviewarea.h
+++ b/examples/widgets/widgets/icons/iconpreviewarea.h
@@ -66,7 +66,7 @@ class IconPreviewArea : public QWidget
Q_OBJECT
public:
- explicit IconPreviewArea(QWidget *parent = Q_NULLPTR);
+ explicit IconPreviewArea(QWidget *parent = nullptr);
void setIcon(const QIcon &icon);
void setSize(const QSize &size);
diff --git a/examples/widgets/widgets/icons/iconsizespinbox.h b/examples/widgets/widgets/icons/iconsizespinbox.h
index 96a56e75c9..87415ac5d6 100644
--- a/examples/widgets/widgets/icons/iconsizespinbox.h
+++ b/examples/widgets/widgets/icons/iconsizespinbox.h
@@ -59,7 +59,7 @@ class IconSizeSpinBox : public QSpinBox
Q_OBJECT
public:
- explicit IconSizeSpinBox(QWidget *parent = Q_NULLPTR);
+ explicit IconSizeSpinBox(QWidget *parent = nullptr);
int valueFromText(const QString &text) const override;
QString textFromValue(int value) const override;
diff --git a/examples/widgets/widgets/icons/imagedelegate.h b/examples/widgets/widgets/icons/imagedelegate.h
index 928085d85b..3b76b78339 100644
--- a/examples/widgets/widgets/icons/imagedelegate.h
+++ b/examples/widgets/widgets/icons/imagedelegate.h
@@ -59,7 +59,7 @@ class ImageDelegate : public QItemDelegate
Q_OBJECT
public:
- explicit ImageDelegate(QObject *parent = Q_NULLPTR);
+ explicit ImageDelegate(QObject *parent = nullptr);
//! [0]
//! [1]
diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp
index 0d63ac316b..c02e02f0a4 100644
--- a/examples/widgets/widgets/tablet/mainwindow.cpp
+++ b/examples/widgets/widgets/tablet/mainwindow.cpp
@@ -55,7 +55,7 @@
//! [0]
MainWindow::MainWindow(TabletCanvas *canvas)
- : m_canvas(canvas), m_colorDialog(Q_NULLPTR)
+ : m_canvas(canvas), m_colorDialog(nullptr)
{
createMenus();
setWindowTitle(tr("Tablet Example"));
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp
index 4b11568dfe..73678ab754 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp
@@ -55,7 +55,7 @@
//! [0]
TabletCanvas::TabletCanvas()
- : QWidget(Q_NULLPTR)
+ : QWidget(nullptr)
, m_alphaChannelValuator(TangentialPressureValuator)
, m_colorSaturationValuator(NoValuator)
, m_lineWidthValuator(PressureValuator)
@@ -119,12 +119,12 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
case QEvent::TabletRelease:
if (m_deviceDown && event->buttons() == Qt::NoButton)
m_deviceDown = false;
+ update();
break;
default:
break;
}
event->accept();
- update();
}
//! [3]
@@ -154,6 +154,7 @@ void TabletCanvas::paintEvent(QPaintEvent *)
//! [5]
void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
{
+ static qreal maxPenRadius = pressureToWidth(1.0);
painter.setRenderHint(QPainter::Antialiasing);
switch (event->device()) {
@@ -169,6 +170,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
painter.setBrush(grad);
qreal radius = grad.radius();
painter.drawEllipse(event->posF(), radius, radius);
+ update(QRect(event->pos() - QPoint(radius, radius), QSize(radius * 2, radius * 2)));
}
break;
case QTabletEvent::RotationStylus:
@@ -188,6 +190,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
poly << event->posF() - brushAdjust;
poly << event->posF() + brushAdjust;
painter.drawConvexPolygon(poly);
+ update(poly.boundingRect().toRect());
}
break;
//! [6]
@@ -217,6 +220,8 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
case QTabletEvent::Stylus:
painter.setPen(m_pen);
painter.drawLine(lastPoint.pos, event->posF());
+ update(QRect(lastPoint.pos.toPoint(), event->pos()).normalized()
+ .adjusted(-maxPenRadius, -maxPenRadius, maxPenRadius, maxPenRadius));
break;
}
}
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.h b/examples/widgets/widgets/tablet/tabletcanvas.h
index a1b31c65bf..671d5376f8 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.h
+++ b/examples/widgets/widgets/tablet/tabletcanvas.h
@@ -103,7 +103,7 @@ private:
void initPixmap();
void paintPixmap(QPainter &painter, QTabletEvent *event);
Qt::BrushStyle brushPattern(qreal value);
- qreal pressureToWidth(qreal pressure);
+ static qreal pressureToWidth(qreal pressure);
void updateBrush(const QTabletEvent *event);
void updateCursor(const QTabletEvent *event);
diff --git a/examples/xml/dombookmarks/xbeltree.h b/examples/xml/dombookmarks/xbeltree.h
index f6c7ef8bfe..c58e1148ff 100644
--- a/examples/xml/dombookmarks/xbeltree.h
+++ b/examples/xml/dombookmarks/xbeltree.h
@@ -67,7 +67,7 @@ public:
protected:
#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif
private slots: