Defines a component for choose a file. More...
#include <FileChooser.h>
Public Types | |
enum | ResourceType { FILE, FOLDER } |
Type of resource required. More... | |
Signals | |
void | resourceSelected (const QString &) |
Emit a qt signal to inform that a resource was selected or defined. More... | |
Public Member Functions | |
FileChooser (QWidget *parent=0, const ResourceType &type=FILE) | |
Constructor. More... | |
QString | getSelectedResource () const |
Returns the text presented in line edit. More... | |
void | setFilterPattern (const QString &filter) |
Defines the filter for files of interest. More... | |
void | setInitialPath (const QString &path) |
This will open the dialog of file selection in the given path. More... | |
void | setLabel (const QString &label) |
Sets the label to be presented. More... | |
void | setResourceType (const ResourceType &type) |
Updates the resource type of the search to be done. More... | |
~FileChooser () | |
Destructor. More... | |
Protected Slots | |
void | onChooseFileToolButtonClicked () |
Shows the file selection dialog. More... | |
void | onReturnPressed () |
Event on return pressed over the resource line edit. More... | |
Protected Attributes | |
QString | m_filter |
Files filter. More... | |
QFileSystemModel * | m_fp_model |
Model to show full path. More... | |
Private Member Functions | |
Copy methods. | |
No copy allowed. | |
FileChooser (const FileChooser &) | |
Copy constructor. More... | |
FileChooser & | operator= (const FileChooser &) |
Copy operator. More... | |
Private Attributes | |
Ui::FileChooser * | m_ui |
Qt ui pointer. More... | |
Defines a component for choose a file.
This class is used for choosing a file. Its also possible to inform the file extensions to be searched. This way the client can change the filter for the files to be listed when searching. The component is composed of a line edit containing the complete path of the file selected and a tool button used to open de choose file dialog.
Definition at line 60 of file FileChooser.h.
Type of resource required.
Enumerator | |
---|---|
FILE |
Search files. |
FOLDER |
Search folders. |
Definition at line 69 of file FileChooser.h.
te::qt::widgets::FileChooser::FileChooser | ( | QWidget * | parent = 0 , |
const ResourceType & | type = FILE |
||
) |
Constructor.
parent | The QWidget parent argumnt. |
te::qt::widgets::FileChooser::~FileChooser | ( | ) |
Destructor.
|
private |
Copy constructor.
QString te::qt::widgets::FileChooser::getSelectedResource | ( | ) | const |
Returns the text presented in line edit.
|
protectedslot |
Shows the file selection dialog.
|
protectedslot |
Event on return pressed over the resource line edit.
|
private |
Copy operator.
|
signal |
Emit a qt signal to inform that a resource was selected or defined.
s | Resource Name. |
void te::qt::widgets::FileChooser::setFilterPattern | ( | const QString & | filter | ) |
Defines the filter for files of interest.
This can be used to restrict the seach for different kinds of files. The client must use something like "Images(*.png *.bmp) Text files(*.txt)".
Example:
In the above example two filters are created, for images and text files.
filter | The filter pattern. For details of syntax, see QFileDialog documentation. |
void te::qt::widgets::FileChooser::setInitialPath | ( | const QString & | path | ) |
This will open the dialog of file selection in the given path.
path | Path to open when initing a file search. |
void te::qt::widgets::FileChooser::setLabel | ( | const QString & | label | ) |
Sets the label to be presented.
label | The new label. |
void te::qt::widgets::FileChooser::setResourceType | ( | const ResourceType & | type | ) |
Updates the resource type of the search to be done.
type | Resource type. |
|
protected |
Files filter.
Definition at line 151 of file FileChooser.h.
|
protected |
Model to show full path.
Definition at line 150 of file FileChooser.h.
|
private |
Qt ui pointer.
Definition at line 155 of file FileChooser.h.