QSint Library  0.2.2
Public Types | Signals | Public Member Functions | Protected Slots | List of all members
QSint::PathPicker Class Reference

Widget combining a line edit and a tool button used for selection of file system objects. More...

#include <pathpicker.h>

Inherits QWidget.

Public Types

enum  PickFlags { PF_EXISTING_FILE, PF_EXISTING_FILES, PF_EXISTING_DIR, PF_SAVE_FILE }
 Defines file system objects to pick. More...
 
enum  DialogFlags { DF_SYSTEM = 0, DF_DEFAULT }
 Defines pick dialog type. More...
 

Signals

void beforePicked ()
 
void picked (const QString &path)
 

Public Member Functions

 PathPicker (QWidget *parent=0)
 
void setEditorEnabled (bool set)
 
bool isEditorEnabled () const
 
void setObjectsToPick (int flags)
 
int objectsToPick () const
 
void setDialogType (int flags)
 
int dialogType () const
 
void setDefaultDirectory (const QString &dirName)
 
const QString & defaultDirectory () const
 
void setFilters (const QString &filters)
 
const QString & filters () const
 
void setCaption (const QString &text)
 
const QString & caption () const
 
QToolButton * button ()
 
QLineEdit * editor ()
 

Protected Slots

virtual void showPickDialog ()
 

Detailed Description

Widget combining a line edit and a tool button used for selection of file system objects.

Since
0.2.1
PathPicker.png
An example of PathPicker

Click on the tool button invokes a modal dialog where you can choose a file, a directory or a number of files to open (or a file to save). The selected path(es) will be then transferred to the line edit along with emitting the picked() signal.

Using setObjectsToPick() and setDialogType(), you can specify the style of the pick dialog and the file system objects (see PickFlags and DialogFlags enums).

Use setCaption() to modify the default caption of the pick dialog.

Method setDefaultDirectory() lets you set the initial directory where to point the pick dialog.

Via setFilters() you can specify additional file name wildcards (See Qt documentation on the QFileDialog class).

To customize the look of the tool button (i.e. icon, text, etc.), retrieve the pointer to the tool button via button() method. Use editor() method to get the line edit widget.

Member Enumeration Documentation

Defines pick dialog type.

Enumerator
DF_SYSTEM 

use system dialog

DF_DEFAULT 

use default Qt dialog

Defines file system objects to pick.

Enumerator
PF_EXISTING_FILE 

single existing file can be picked (default)

PF_EXISTING_FILES 

one or more existing files can be picked

PF_EXISTING_DIR 

single existing directory can be picked

PF_SAVE_FILE 

a file to save can be picked (non-existing as well)

Constructor & Destructor Documentation

QSint::PathPicker::PathPicker ( QWidget *  parent = 0)
explicit

Constructor.

Member Function Documentation

void QSint::PathPicker::beforePicked ( )
signal

Emitted when user is about to pick an object from the dialog or editor.

QToolButton* QSint::PathPicker::button ( )
inline

Returns the tool button widget.

const QString& QSint::PathPicker::caption ( ) const
inline

Returns the caption of the pick dialog, or empty string if the default one should be used.

const QString& QSint::PathPicker::defaultDirectory ( ) const
inline

Returns the default directory which is open when showing the dialog.

int QSint::PathPicker::dialogType ( ) const
inline

Returns DialogFlags defining dialog type.

QLineEdit* QSint::PathPicker::editor ( )
inline

Returns the line edit widget.

const QString& QSint::PathPicker::filters ( ) const
inline

Returns the active file name filters applied to the filenames.

bool QSint::PathPicker::isEditorEnabled ( ) const
inline

Returns true if manual path editor is enabled, false otherwise.

int QSint::PathPicker::objectsToPick ( ) const
inline

Returns PickFlags defining objects to pick.

void QSint::PathPicker::picked ( const QString &  path)
signal

Emitted when user picks an object from the dialog or editor. path

void QSint::PathPicker::setCaption ( const QString &  text)
inline

Defines the caption of the pick dialog. If no caption has been specified, then the default one will be shown.

void QSint::PathPicker::setDefaultDirectory ( const QString &  dirName)
inline

Defines the default directory to open when showing the dialog.

void QSint::PathPicker::setDialogType ( int  flags)
inline

Defines pick dialog type as DialogFlags.

void QSint::PathPicker::setEditorEnabled ( bool  set)

Enables (default) or disables manual path editor according to set parameter.

void QSint::PathPicker::setFilters ( const QString &  filters)
inline

Defines the file name filters applied to the filenames.

void QSint::PathPicker::setObjectsToPick ( int  flags)
inline

Defines objects being picked as PickFlags.

void QSint::PathPicker::showPickDialog ( )
protectedvirtualslot

Invokes file object pick dialog. When a valid object(s) has been picked from the filesystem, the implementation should set the content of the editor and emit picked() signal.


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

© Sintegrial Technologies 2011-2014
http://www.sintegrial.com