summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-05-03 14:26:01 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-03 14:50:22 +0200
commit60fefff22f7fa259a8bdb023d1ec9a57cfd34bfb (patch)
treeab33ab6eeb08f7a72e0196ee5025790aaa01b1dd /examples
parentb1e0a71997111fc296001bc94e0da8342cf0ac97 (diff)
parentda32360ffc3c7b677355c37ae54c89637c18047f (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.cpp2
-rw-r--r--examples/widgets/graphicsview/elasticnodes/node.cpp2
-rw-r--r--examples/widgets/graphicsview/elasticnodes/node.h2
-rw-r--r--examples/widgets/mainwindows/mainwindow/mainwindow.cpp12
-rw-r--r--examples/widgets/mainwindows/mainwindow/mainwindow.h2
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp4
6 files changed, 17 insertions, 7 deletions
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
index cfee96050d..81928a4ee1 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
@@ -174,7 +174,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
bool itemsMoved = false;
foreach (Node *node, nodes) {
- if (node->advanceNext())
+ if (node->advancePosition())
itemsMoved = true;
}
diff --git a/examples/widgets/graphicsview/elasticnodes/node.cpp b/examples/widgets/graphicsview/elasticnodes/node.cpp
index fb7f7b92da..71737c984b 100644
--- a/examples/widgets/graphicsview/elasticnodes/node.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/node.cpp
@@ -138,7 +138,7 @@ void Node::calculateForces()
//! [6]
//! [7]
-bool Node::advanceNext()
+bool Node::advancePosition()
{
if (newPos == pos())
return false;
diff --git a/examples/widgets/graphicsview/elasticnodes/node.h b/examples/widgets/graphicsview/elasticnodes/node.h
index cd2ca84194..43ea1fb24b 100644
--- a/examples/widgets/graphicsview/elasticnodes/node.h
+++ b/examples/widgets/graphicsview/elasticnodes/node.h
@@ -73,7 +73,7 @@ public:
int type() const override { return Type; }
void calculateForces();
- bool advanceNext();
+ bool advancePosition();
QRectF boundingRect() const override;
QPainterPath shape() const override;
diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
index 931bee2d31..4ba180f312 100644
--- a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
+++ b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
@@ -188,6 +188,13 @@ void MainWindow::setupMenuBar()
#endif
dockWidgetMenu = menuBar()->addMenu(tr("&Dock Widgets"));
+
+ QMenu *aboutMenu = menuBar()->addMenu(tr("About"));
+ QAction *aboutAct = aboutMenu->addAction(tr("&About"), this, &MainWindow::about);
+ aboutAct->setStatusTip(tr("Show the application's About box"));
+
+ QAction *aboutQtAct = aboutMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt);
+ aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
}
void MainWindow::setDockOptions()
@@ -477,3 +484,8 @@ void MainWindow::destroyDockWidget(QAction *action)
if (destroyDockWidgetMenu->isEmpty())
destroyDockWidgetMenu->setEnabled(false);
}
+
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About MainWindows"), message);
+}
diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.h b/examples/widgets/mainwindows/mainwindow/mainwindow.h
index 9b1af6df80..a2c9d30ded 100644
--- a/examples/widgets/mainwindows/mainwindow/mainwindow.h
+++ b/examples/widgets/mainwindows/mainwindow/mainwindow.h
@@ -77,6 +77,8 @@ public slots:
void createDockWidget();
void destroyDockWidget(QAction *action);
+ void about();
+
private:
void setupToolBar();
void setupMenuBar();
diff --git a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
index f33155375c..1016afba07 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
+++ b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
@@ -55,10 +55,6 @@
#include <QStandardItem>
#include "mainwindow.h"
-
-const int ROWS = 2;
-const int COLUMNS = 3;
-
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{