NDEVR
API Documentation
FileDropFrame

A simple frame that allows the user to drag and drop a file into it. More...

Public Member Functions

 FileDropFrame (QWidget *parent=nullptr)
 Constructs a FileDropFrame.
void dragEnterEvent (QDragEnterEvent *event)
 Handles drag enter events, accepting the drop if the filter allows it.
void dropEvent (QDropEvent *event)
 Handles drop events by invoking the registered drop callback.
void setDropCallback (const std::function< void(QDropEvent *event)> &drop_callback)
 Sets the callback invoked when a file is dropped onto this frame.
void setDropFilter (std::function< bool(const QMimeData *event)> filter)
 Sets a filter function that determines whether a drag should be accepted.

Protected Attributes

std::function< void(QDropEvent *event)> m_drop_callback
 Callback invoked when a drop event occurs.
std::function< bool(const QMimeData *event)> m_drop_filter
 Filter function to accept or reject drag events.

Detailed Description

A simple frame that allows the user to drag and drop a file into it.


Definition at line 11 of file FileDropFrame.h.

Constructor & Destructor Documentation

◆ FileDropFrame()

FileDropFrame::FileDropFrame ( QWidget * parent = nullptr)
inline

Constructs a FileDropFrame.

Parameters
[in]parentThe parent widget.

Definition at line 18 of file FileDropFrame.h.

Member Function Documentation

◆ dragEnterEvent()

void FileDropFrame::dragEnterEvent ( QDragEnterEvent * event)
inline

Handles drag enter events, accepting the drop if the filter allows it.

Parameters
[in]eventThe drag enter event.

Definition at line 27 of file FileDropFrame.h.

References m_drop_filter.

◆ dropEvent()

void FileDropFrame::dropEvent ( QDropEvent * event)
inline

Handles drop events by invoking the registered drop callback.

Parameters
[in]eventThe drop event.

Definition at line 38 of file FileDropFrame.h.

References m_drop_callback.

◆ setDropCallback()

void FileDropFrame::setDropCallback ( const std::function< void(QDropEvent *event)> & drop_callback)
inline

Sets the callback invoked when a file is dropped onto this frame.

Parameters
[in]drop_callbackThe callback function to handle drop events.

Definition at line 47 of file FileDropFrame.h.

References m_drop_callback.

◆ setDropFilter()

void FileDropFrame::setDropFilter ( std::function< bool(const QMimeData *event)> filter)
inline

Sets a filter function that determines whether a drag should be accepted.

Parameters
[in]filterA function returning true if the mime data should be accepted.

Definition at line 55 of file FileDropFrame.h.

References m_drop_filter.


The documentation for this class was generated from the following file: