nodeguy/src/cpp/include/nodegui/QtGui/QDrag/qdrag_wrap.h
swittk 5c62cdcc8a
Implemented QDrag Class (#626)
* Added QWheelEvent

* removed x y

* Added QNativeGestureEvent

* Changed wrong type of QNativeGestureEventWrap value

* Added QTabletEvent

* Fixing build error for QTabletEvent

* adding dropaction

* fix typos

* Added more functions to QPainterPath

* Added more functions to QPainterPath

* Fixed multiple typos

* Fixed multiple typos

* Got QPainterPath additions working.

* Modified QPainterPath to use qreal instead

* Added QPointF, added a few missing methods to QPoint

* Added QRectF

* implemented QRectF

* Added acceptDrops and setAcceptDrops to QWidget, will be useful for addon implementation of Drag and Drop

* Added more methods to QUrl

* Added QMimeData, additional methods to QUrl, and Dropping should now be supported

* refactored

* Fixed more merge conflicts

* Is this my final merge conflict??

* All merge conflicts resolved

* All merge conflicts resolved

* Adds guide for drag and drop

* lint fix

* added preliminary stuff, will need to tweak to make compilable..

* Compile passed, let's see if it works...

* QDrag added, working

* pause a bit, QDrag causes delayed error of 'QPaintDevice: Cannot destroy paint device that is being painted'

* Revert "Implemented QDrag class"

* Disabled problematic functions

* pulling from origin

Co-authored-by: Switt Kongdachalert <switt1995@yahoo.com>
Co-authored-by: Atul R <atulanand94@gmail.com>
2020-07-04 19:58:40 +02:00

54 lines
1.9 KiB
C++

#pragma once
#include <napi.h>
#include <QDrag>
#include "Extras/Export/export.h"
#include "QtGui/QDrag/ndrag.hpp"
#include "core/Component/component_macro.h"
/*
- Note that setMimeData() assigns ownership of the QMimeData object to the QDrag
object.
- The QDrag must be constructed on the heap with a parent QObject to ensure that
Qt can clean up after the drag and drop operation has been completed
*/
class DLL_EXPORT QDragWrap : public Napi::ObjectWrap<QDragWrap> {
COMPONENT_WRAPPED_METHODS_DECLARATION
private:
// A guarded pointer, QPointer<T>, behaves like a normal C++ pointer T *,
// except that it is automatically cleared when the referenced object is
// destroyed (unlike normal C++ pointers, which become "dangling pointers" in
// such cases). T must be a subclass of QObject.
QPointer<NDrag> instance;
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
QDragWrap(const Napi::CallbackInfo& info);
~QDragWrap();
NDrag* getInternalInstance();
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
Napi::Value defaultAction(const Napi::CallbackInfo& info);
Napi::Value dragCursor(const Napi::CallbackInfo& info);
Napi::Value exec(const Napi::CallbackInfo& info);
Napi::Value hotSpot(const Napi::CallbackInfo& info);
Napi::Value pixmap(const Napi::CallbackInfo& info);
Napi::Value setDragCursor(const Napi::CallbackInfo& info);
Napi::Value setHotSpot(const Napi::CallbackInfo& info);
Napi::Value setPixmap(const Napi::CallbackInfo& info);
Napi::Value supportedActions(const Napi::CallbackInfo& info);
Napi::Value mimeData(const Napi::CallbackInfo& info);
Napi::Value setMimeData(const Napi::CallbackInfo& info);
Napi::Value source(const Napi::CallbackInfo& info);
Napi::Value target(const Napi::CallbackInfo& info);
};
namespace StaticQDragWrapMethods {
DLL_EXPORT Napi::Value cancel(const Napi::CallbackInfo& info);
}