QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsimagedroptextedit.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2013 Jiří Procházka (Hobrasoft)
4** Contact: http://www.hobrasoft.cz/
5**
6** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
7** Contact: http://www.qt-project.org/legal
8**
9** This library is free software; you can redistribute it and/or
10** modify it under the terms of the GNU Lesser General Public
11** License as published by the Free Software Foundation; either
12** version 2.1 of the License, or (at your option) any later version.
13**
14** $QT_BEGIN_LICENSE:LGPL$
15** GNU Lesser General Public License Usage
16** This file is under the terms of the GNU Lesser General Public License
17** version 2.1 as published by the Free Software Foundation and appearing
18** in the file LICENSE.LGPL included in the packaging of this file.
19** Please review the following information to ensure the
20** GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Digia gives you certain additional
24** rights. These rights are described in the Digia Qt LGPL Exception
25** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
26**
27** $QT_END_LICENSE$
28**
29****************************************************************************/
30#ifndef QGSIMAGEDROPTEXTEDIT_H
31#define QGSIMAGEDROPTEXTEDIT_H
32
33#include "qgis_gui.h"
34#include "qgis_sip.h"
35#include <QTextEdit>
36#include <memory>
37
38#define SIP_NO_FILE
39
40class QImage;
42
43/*
44 * Originally ported from https://github.com/Anchakor/MRichTextEditor, courtesy of Hobrasoft.
45 */
46
48class GUI_EXPORT QgsImageDropTextEdit : public QTextEdit
49{
50 Q_OBJECT
51
52 public:
53 QgsImageDropTextEdit( QWidget *parent = nullptr );
54 ~QgsImageDropTextEdit() override;
55
56 void dropImage( const QImage &image, const QString &format );
57 void dropLink( const QUrl &url );
58
59 protected:
60 bool canInsertFromMimeData( const QMimeData *source ) const override;
61 void insertFromMimeData( const QMimeData *source ) override;
62 void mouseMoveEvent( QMouseEvent *e ) override;
63 void mouseReleaseEvent( QMouseEvent *e ) override;
64
65 private:
66 QString mActiveAnchor;
67 std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
68
69};
71
72
73#endif // QGSIMAGEDROPTEXTEDIT_H
Temporarily sets a cursor override for the QApplication for the lifetime of the object.