Seamly2D
Code documentation
VPE::VFileEditWidget Class Reference

#include <vfilepropertyeditor.h>

Inheritance diagram for VPE::VFileEditWidget:
Collaboration diagram for VPE::VFileEditWidget:

Public Slots

void setFile (const QString &value, bool emit_signal=false)
 Sets the current file, does not check if it is valid. More...
 
void setFilter (const QString &dialog_filter=QString(), const QStringList &filter_list=QStringList())
 Sets a filter for the file field. More...
 
void setDirectory (bool dir)
 Sets whether the property stores a directory or a file. More...
 

Signals

void dataChangedByUser (const QString &getFile, VFileEditWidget *editor)
 This signal is emitted when the user changed the curret file. Actions triggering this signal are either using the file dialog to select a new file or changing the file path in the line edit. More...
 
void commitData (QWidget *editor)
 This signal is emitted whenever dataChangedByUser() gets emmitted and is connected to the delegate's commitData() signal. More...
 

Public Member Functions

 VFileEditWidget (QWidget *parent, bool is_directory=false)
 
virtual ~VFileEditWidget () Q_DECL_OVERRIDE
 
QString getFile () const
 This function returns the file currently set to this editor. More...
 
virtual bool eventFilter (QObject *obj, QEvent *ev) Q_DECL_OVERRIDE
 Needed for proper event handling. More...
 
bool isDirectory ()
 Returns the directory/file setting. More...
 

Protected Member Functions

virtual void dragEnterEvent (QDragEnterEvent *event) Q_DECL_OVERRIDE
 
virtual void dragMoveEvent (QDragMoveEvent *event) Q_DECL_OVERRIDE
 
virtual void dragLeaveEvent (QDragLeaveEvent *event) Q_DECL_OVERRIDE
 
virtual void dropEvent (QDropEvent *event) Q_DECL_OVERRIDE
 
virtual bool checkMimeData (const QMimeData *data, QString &file) const
 This function checks the mime data, if it is compatible with the filters. More...
 
virtual bool checkFileFilter (const QString &file) const
 This checks, if a file is compatible with the filters. More...
 

Protected Attributes

QString CurrentFilePath
 
QToolButton * ToolButton
 
QLineEdit * FileLineEdit
 
QString FileDialogFilter
 
QStringList FilterList
 
bool Directory
 Specifies whether it is being looked for a directory (true) or a file (false, default) More...
 

Private Slots

void onToolButtonClicked ()
 This slot gets activated, when the "..." button gets clicked. More...
 

Detailed Description

Definition at line 39 of file vfilepropertyeditor.h.

Constructor & Destructor Documentation

◆ VFileEditWidget()

VPE::VFileEditWidget::VFileEditWidget ( QWidget *  parent,
bool  is_directory = false 
)
explicit

◆ ~VFileEditWidget()

VPE::VFileEditWidget::~VFileEditWidget ( )
virtual

Definition at line 73 of file vfilepropertyeditor.cpp.

Member Function Documentation

◆ checkFileFilter()

bool VPE::VFileEditWidget::checkFileFilter ( const QString &  file) const
protectedvirtual

This checks, if a file is compatible with the filters.

Definition at line 232 of file vfilepropertyeditor.cpp.

◆ checkMimeData()

bool VPE::VFileEditWidget::checkMimeData ( const QMimeData *  data,
QString &  file 
) const
protectedvirtual

This function checks the mime data, if it is compatible with the filters.

Definition at line 209 of file vfilepropertyeditor.cpp.

◆ commitData

void VPE::VFileEditWidget::commitData ( QWidget *  editor)
signal

This signal is emitted whenever dataChangedByUser() gets emmitted and is connected to the delegate's commitData() signal.

◆ dataChangedByUser

void VPE::VFileEditWidget::dataChangedByUser ( const QString &  getFile,
VFileEditWidget editor 
)
signal

This signal is emitted when the user changed the curret file. Actions triggering this signal are either using the file dialog to select a new file or changing the file path in the line edit.

◆ dragEnterEvent()

void VPE::VFileEditWidget::dragEnterEvent ( QDragEnterEvent *  event)
protectedvirtual

Definition at line 173 of file vfilepropertyeditor.cpp.

◆ dragLeaveEvent()

void VPE::VFileEditWidget::dragLeaveEvent ( QDragLeaveEvent *  event)
protectedvirtual

Definition at line 190 of file vfilepropertyeditor.cpp.

◆ dragMoveEvent()

void VPE::VFileEditWidget::dragMoveEvent ( QDragMoveEvent *  event)
protectedvirtual

Definition at line 184 of file vfilepropertyeditor.cpp.

◆ dropEvent()

void VPE::VFileEditWidget::dropEvent ( QDropEvent *  event)
protectedvirtual

Definition at line 195 of file vfilepropertyeditor.cpp.

◆ eventFilter()

bool VPE::VFileEditWidget::eventFilter ( QObject *  obj,
QEvent *  ev 
)
virtual

Needed for proper event handling.

Definition at line 127 of file vfilepropertyeditor.cpp.

◆ getFile()

QString VPE::VFileEditWidget::getFile ( ) const

This function returns the file currently set to this editor.

Definition at line 106 of file vfilepropertyeditor.cpp.

Referenced by VPE::VFileProperty::getEditorData().

◆ isDirectory()

bool VPE::VFileEditWidget::isDirectory ( )

Returns the directory/file setting.

Returns
True, if a directory dialog is being shown, false if a file dialog

Definition at line 167 of file vfilepropertyeditor.cpp.

◆ onToolButtonClicked

void VPE::VFileEditWidget::onToolButtonClicked ( )
privateslot

This slot gets activated, when the "..." button gets clicked.

Definition at line 112 of file vfilepropertyeditor.cpp.

Referenced by VFileEditWidget().

◆ setDirectory

void VPE::VFileEditWidget::setDirectory ( bool  dir)
slot

Sets whether the property stores a directory or a file.

Definition at line 101 of file vfilepropertyeditor.cpp.

Referenced by VPE::VFileProperty::createEditor().

◆ setFile

void VPE::VFileEditWidget::setFile ( const QString &  value,
bool  emit_signal = false 
)
slot

Sets the current file, does not check if it is valid.

Parameters
valueThe new filepath the widget should show
emit_signalIf true, this will emit the dataChangedByUser()-signal (if file differs from the current file)

Definition at line 79 of file vfilepropertyeditor.cpp.

Referenced by VPE::VFileProperty::createEditor(), and VPE::VFileProperty::setEditorData().

◆ setFilter

void VPE::VFileEditWidget::setFilter ( const QString &  dialog_filter = QString(),
const QStringList &  filter_list = QStringList() 
)
slot

Sets a filter for the file field.

Parameters
dialog_filterThe filter used for the File Dialog
filter_listThe list of file endings. The filters are being checked using regular expressions

Definition at line 95 of file vfilepropertyeditor.cpp.

Referenced by VPE::VFileProperty::createEditor().

Member Data Documentation

◆ CurrentFilePath

QString VPE::VFileEditWidget::CurrentFilePath
protected

Definition at line 101 of file vfilepropertyeditor.h.

Referenced by VFileEditWidget().

◆ Directory

bool VPE::VFileEditWidget::Directory
protected

Specifies whether it is being looked for a directory (true) or a file (false, default)

Definition at line 108 of file vfilepropertyeditor.h.

◆ FileDialogFilter

QString VPE::VFileEditWidget::FileDialogFilter
protected

Definition at line 104 of file vfilepropertyeditor.h.

◆ FileLineEdit

QLineEdit* VPE::VFileEditWidget::FileLineEdit
protected

Definition at line 103 of file vfilepropertyeditor.h.

Referenced by VFileEditWidget().

◆ FilterList

QStringList VPE::VFileEditWidget::FilterList
protected

Definition at line 105 of file vfilepropertyeditor.h.

◆ ToolButton

QToolButton* VPE::VFileEditWidget::ToolButton
protected

Definition at line 102 of file vfilepropertyeditor.h.

Referenced by VFileEditWidget().


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