The QtxPathListEdit class represents a widget for files or directories paths list preference items editing. More...
#include <QtxPathListEdit.h>

Classes | |
| class | Delegate |
| Custom item delegate for the paths list widget. More... | |
| class | Editor |
| Path editor widget. More... | |
Public Member Functions | |
| QtxPathListEdit (const Qtx::PathType, QWidget *=0) | |
| Constructor. More... | |
| QtxPathListEdit (QWidget *=0) | |
| Constructor. More... | |
| virtual | ~QtxPathListEdit () |
| Destructor. More... | |
| Qtx::PathType | pathType () const |
| Get widget mode. More... | |
| void | setPathType (const Qtx::PathType) |
| Set widget mode. More... | |
| QStringList | pathList () const |
| Get currently selected paths list. More... | |
| void | setPathList (const QStringList &) |
| Set paths list. More... | |
| bool | isDuplicateEnabled () const |
| Check if the duplication of paths is enabled. More... | |
| void | setDuplicateEnabled (const bool) |
| Enable/disable paths duplication. More... | |
| int | count () const |
| Get number of currently entered paths. More... | |
| bool | contains (const QString &) const |
| Check if the specified path already exists in the paths list. More... | |
| void | clear () |
| Clear paths list. More... | |
| void | remove (const int) |
| Remove path from the paths list. More... | |
| void | remove (const QString &) |
| Remove path from the paths list. More... | |
| void | insert (const QString &, const int=-1) |
| Add path to the list of paths. More... | |
| bool | eventFilter (QObject *, QEvent *) |
| Customize child widget events processing. More... | |
Protected Slots | |
| void | onUp (bool=false) |
| Called when <Up> button is clicked. More... | |
| void | onDown (bool=false) |
| Called when <Down> button is clicked. More... | |
| void | onInsert (bool=false) |
| Called when <Insert> button is clicked. More... | |
| void | onDelete (bool=false) |
| Called when <Delete> button is clicked. More... | |
Private Member Functions | |
| void | initialize () |
| Perform internal widget initialization. More... | |
| QWidget * | createEditor (QWidget *) |
| Create editor widget. More... | |
| void | setModelData (QWidget *, const QModelIndex &) |
| Set modified data from the editor to the list widget. More... | |
| void | setEditorData (QWidget *, const QModelIndex &) |
| Set data to the editor from the list widget when user starts path edition. More... | |
| bool | checkExistance (const QString &, const bool=true) |
| Check if path is correct (exists) and optionally show the question message box. More... | |
| bool | checkDuplicate (const QString &, const int, const bool=true) |
| Check if path already exists in the list and optionally show the warning message box. More... | |
Private Attributes | |
| QListView * | myList |
| Qtx::PathType | myType |
| QStringListModel * | myModel |
| QCompleter * | myCompleter |
| bool | myDuplicate |
Friends | |
| class | QtxPathListEdit::Delegate |
The QtxPathListEdit class represents a widget for files or directories paths list preference items editing.
The path list preference item is represented as the list box widget. It provides such operations like adding new file/directory path to the list, removing selected paths and modifying of already entered ones.
The widget can be used in two modes: list of files or list of directories. The mode defines the type of the standard browse dialog box which is invoked on the browse button clicking.
Initial path list value can be set with setPathList() method. Chosen path list can be retrieved with the pathList() method. The widget mode can be set with setPathType() and retrieved with pathType() method.
In addition, it is possible to add path items to the list with the insert() method, remove items with the remove() methods, clear all the widget contents with the clear() method. To get the number of entered paths can be retrieved with the count() method. To check if any path already exists in the paths list, use contains() method.
| QtxPathListEdit::QtxPathListEdit | ( | const Qtx::PathType | type, |
| QWidget * | parent = 0 |
||
| ) |
Constructor.
| type | widget mode (Qtx::PathType) |
| parent | parent widget |
References initialize().
| QtxPathListEdit::QtxPathListEdit | ( | QWidget * | parent = 0 | ) |
Constructor.
Qtx::PT_OpenFile mode is used by default.
| parent | parent widget |
References initialize().
|
virtual |
Destructor.
|
private |
Check if path already exists in the list and optionally show the warning message box.
| str | path to be checked |
| row | row corresponding to the path checked |
| msg | if true and path does not exist, warning message box is shown |
true if the user confirms the path adding References myModel.
|
private |
Check if path is correct (exists) and optionally show the question message box.
| str | path to be checked |
| msg | if true and path does not exist, question message box is shown |
true if the user confirms the path adding References Qtx::makeEnvVarSubst(), pathType(), Qtx::PT_Directory, Qtx::PT_OpenFile, and Qtx::PT_SaveFile.
| void QtxPathListEdit::clear | ( | ) |
Clear paths list.
References myModel.
| bool QtxPathListEdit::contains | ( | const QString & | path | ) | const |
Check if the specified path already exists in the paths list.
| path | path to be checked |
true if the path is already selected by the user or false otherwise References myModel.
| int QtxPathListEdit::count | ( | ) | const |
Create editor widget.
| parent | parent widget for the editor |
References pathType(), and QtxPathEdit::setPathType().
Customize child widget events processing.
| o | event receiver object |
| e | event |
true if the further event processing should be stopped. References onDelete(), onDown(), onInsert(), and onUp().
|
private |
Perform internal widget initialization.
References delete_icon, insert_icon, movedown_icon, moveup_icon, myList, myModel, onDelete(), onDown(), onInsert(), and onUp().
| void QtxPathListEdit::insert | ( | const QString & | path, |
| const int | idx = -1 |
||
| ) |
Add path to the list of paths.
If the specified index is out of range, the path is added to the end of the list.
| path | path to be added |
| idx | index in the list to which the path should be inserted. |
References myModel.
| bool QtxPathListEdit::isDuplicateEnabled | ( | ) | const |
Check if the duplication of paths is enabled.
true if the duplication is enabled References myDuplicate.
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
| QStringList QtxPathListEdit::pathList | ( | ) | const |
Get currently selected paths list.
References myModel.
| Qtx::PathType QtxPathListEdit::pathType | ( | ) | const |
Get widget mode.
References myType.
| void QtxPathListEdit::remove | ( | const int | idx | ) |
| void QtxPathListEdit::remove | ( | const QString & | path | ) |
| void QtxPathListEdit::setDuplicateEnabled | ( | const bool | on | ) |
|
private |
Set data to the editor from the list widget when user starts path edition.
| editor | editor widget |
| index | data model index |
References myModel, and QtxPathEdit::setPath().
|
private |
Set modified data from the editor to the list widget.
| editor | editor widget |
| index | data model index |
References checkDuplicate(), checkExistance(), isDuplicateEnabled(), myModel, and QtxPathEdit::path().
| void QtxPathListEdit::setPathList | ( | const QStringList & | lst | ) |
Set paths list.
| lst | files or directories paths list |
References myModel.
| void QtxPathListEdit::setPathType | ( | const Qtx::PathType | t | ) |
Set widget mode.
| t | new widget mode (Qtx::PathType) |
References myCompleter, and myType.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |