Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
finalwidget.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#ifndef FINALWIDGET_H
5#define FINALWIDGET_H
6
7#include <QFrame>
8#include <QImage>
9#include <QPoint>
10#include <QSize>
11
12QT_BEGIN_NAMESPACE
13
14class QGridLayout;
15class QLabel;
16class QMouseEvent;
17class QWidget;
18
19class FinalWidget : public QFrame
20{
22
23public:
25 void setPixmap(const QPixmap &pixmap);
26 QPixmap pixmap() const;
27
28protected:
29 void mouseMoveEvent(QMouseEvent *event) override;
30 void mousePressEvent(QMouseEvent *event) override;
31
32private:
33 void createImage();
34
35 bool hasImage;
36 QImage originalImage;
37 QLabel *imageLabel;
38 QLabel *nameLabel;
39 QPoint dragStartPosition;
40};
41
42QT_END_NAMESPACE
43
44#endif
void mousePressEvent(QMouseEvent *event) override
Check for left mouse button presses in order to enable drag and drop.
void mouseMoveEvent(QMouseEvent *event) override
If the mouse moves far enough when the left mouse button is held down, start a drag and drop operatio...
QPixmap pixmap() const
void setPixmap(const QPixmap &pixmap)
friend class QWidget
Definition qpainter.h:431