summaryrefslogtreecommitdiffstats
path: root/tests/manual/highdpi/dragwidget.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-12-03 06:55:21 +0100
committerLiang Qi <liang.qi@qt.io>2019-12-03 06:57:05 +0100
commite62d04b933a91c2bdd347aa97dc15ba210a04d2a (patch)
tree67c67af5f59d9b71522738da8a8d2d803e3ff44f /tests/manual/highdpi/dragwidget.cpp
parentf81f21151d30a37f955aa4af2398a96507626b15 (diff)
parent9ac156c90b92a981f70929e081c64083b14e9a57 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/corelib/serialization/qcborvalue.cpp Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
Diffstat (limited to 'tests/manual/highdpi/dragwidget.cpp')
-rw-r--r--tests/manual/highdpi/dragwidget.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/manual/highdpi/dragwidget.cpp b/tests/manual/highdpi/dragwidget.cpp
index 11bbc1d127c..8ad3d3ca471 100644
--- a/tests/manual/highdpi/dragwidget.cpp
+++ b/tests/manual/highdpi/dragwidget.cpp
@@ -42,7 +42,7 @@ public:
};
DragWidget::DragWidget(QString text, QWidget *parent)
- : QWidget(parent), otherWindow(nullptr)
+ : QWidget(parent)
{
int x = 5;
int y = 5;
@@ -52,9 +52,9 @@ DragWidget::DragWidget(QString text, QWidget *parent)
text = "You can drag from this window and drop text here";
QStringList words = text.split(' ');
- foreach (QString word, words) {
+ for (const QString &word : words) {
if (!word.isEmpty()) {
- FramedLabel *wordLabel = new FramedLabel(word, this);
+ auto wordLabel = new FramedLabel(word, this);
wordLabel->move(x, y);
wordLabel->show();
x += wordLabel->width() + 2;
@@ -105,7 +105,6 @@ void DragWidget::dragLeaveEvent(QDragLeaveEvent *)
update();
}
-
void DragWidget::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasText()) {
@@ -141,9 +140,9 @@ void DragWidget::dropEvent(QDropEvent *event)
} else {
event->ignore();
}
- foreach (QObject *child, children()) {
- if (child->inherits("QWidget")) {
- QWidget *widget = static_cast<QWidget *>(child);
+ for (QObject *child : children()) {
+ if (child->isWidgetType()) {
+ auto widget = static_cast<QWidget *>(child);
if (!widget->isVisible())
widget->deleteLater();
}
@@ -170,7 +169,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
pixmap.setDevicePixelRatio(dpr);
child->render(&pixmap);
- QDrag *drag = new QDrag(this);
+ auto drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(pixmap);
drag->setHotSpot(hotSpot);