summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
blob: 9455cacf1c8a9eafc64396e7da30aa2d2ee6aac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include <QStyleFactory>
#include <QWidget>


namespace src_gui_kernel_qapplication {
struct MyWidget
{
    QSize sizeHint() const;

    int foo = 0;
    MyWidget operator- (MyWidget& other)
    {
        MyWidget tmp = other;
        return tmp;
    };
    int manhattanLength() { return 0; }
};

void startTheDrag() {};
void wrapper1() {
MyWidget startPos;
MyWidget currentPos;
int x = 0;
int y = 0;

//! [6]
if ((startPos - currentPos).manhattanLength() >=
        QApplication::startDragDistance())
    startTheDrag();
//! [6]

} // wrapper1

} // src_gui_kernel_qapplication