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

Data Structures | |
| 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. | |
| QtxPathListEdit (QWidget *=0) | |
| Constructor. | |
| virtual | ~QtxPathListEdit () |
| Destructor. | |
| Qtx::PathType | pathType () const |
| Get widget mode. | |
| void | setPathType (const Qtx::PathType) |
| Set widget mode. | |
| QStringList | pathList () const |
| Get currently selected paths list. | |
| void | setPathList (const QStringList &) |
| Set paths list. | |
| bool | isDuplicateEnabled () const |
| Check if the duplication of paths is enabled. | |
| void | setDuplicateEnabled (const bool) |
| Enable/disable paths duplication. | |
| int | count () const |
| Get number of currently entered paths. | |
| bool | contains (const QString &) const |
| Check if the specified path already exists in the paths list. | |
| void | clear () |
| Clear paths list. | |
| void | remove (const int) |
| Remove path from the paths list. | |
| void | remove (const QString &) |
| Remove path from the paths list. | |
| void | insert (const QString &, const int=-1) |
| Add path to the list of paths. | |
| bool | eventFilter (QObject *, QEvent *) |
| Customize child widget events processing. | |
Protected Slots | |
| void | onUp (bool=false) |
| Called when <Up> button is clicked. | |
| void | onDown (bool=false) |
| Called when <Down> button is clicked. | |
| void | onInsert (bool=false) |
| Called when <Insert> button is clicked. | |
| void | onDelete (bool=false) |
| Called when <Delete> button is clicked. | |
Private Member Functions | |
| void | initialize () |
| Perform internal widget initialization. | |
| QWidget * | createEditor (QWidget *) |
| Create editor widget. | |
| void | setModelData (QWidget *, const QModelIndex &) |
| Set modified data from the editor to the list widget. | |
| void | setEditorData (QWidget *, const QModelIndex &) |
| Set data to the editor from the list widget when user starts path edition. | |
| bool | checkExistance (const QString &, const bool=true) |
| Check if path is correct (exists) and optionally show the question message box. | |
| bool | checkDuplicate (const QString &, const int, const bool=true) |
| Check if path already exists in the list and optionally show the warning message box. | |
Private Attributes | |
| QListView * | myList |
| Qtx::PathType | myType |
| QStringListModel * | myModel |
| QCompleter * | myCompleter |
| bool | myDuplicate |
Friends | |
| class | QtxPathListEdit::Delegate |
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 |
||
| ) |
| type | widget mode (Qtx.PathType) |
| parent | parent widget |
References initialize().
| QtxPathListEdit::QtxPathListEdit | ( | QWidget * | parent = 0 | ) |
Qtx.PT_OpenFile mode is used by default.
| parent | parent widget |
References initialize().
| QtxPathListEdit::~QtxPathListEdit | ( | ) | [virtual] |
| Qtx::PathType QtxPathListEdit::pathType | ( | ) | const |
| void QtxPathListEdit::setPathType | ( | const Qtx::PathType | t | ) |
| QStringList QtxPathListEdit::pathList | ( | ) | const |
References myModel.
| void QtxPathListEdit::setPathList | ( | const QStringList & | lst | ) |
| bool QtxPathListEdit::isDuplicateEnabled | ( | ) | const |
true if the duplication is enabled References myDuplicate.
| void QtxPathListEdit::setDuplicateEnabled | ( | const bool | on | ) |
| on | new flag value |
References myDuplicate.
| int QtxPathListEdit::count | ( | ) | const |
References myModel.
| bool QtxPathListEdit::contains | ( | const QString & | path | ) | const |
| path | path to be checked |
true if the path is already selected by the user or false otherwise References myModel.
| void QtxPathListEdit::clear | ( | ) |
References myModel.
| void QtxPathListEdit::remove | ( | const int | idx | ) |
| idx | path index in the list |
References myModel.
| void QtxPathListEdit::remove | ( | const QString & | path | ) |
| path | path to be removed |
References myModel.
| void QtxPathListEdit::insert | ( | const QString & | path, |
| const int | idx = -1 |
||
| ) |
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.
| o | event receiver object |
| e | event |
true if the further event processing should be stopped. References onDelete(), onDown(), onInsert(), and onUp().
| void QtxPathListEdit::onUp | ( | bool | = false | ) | [protected, slot] |
| void QtxPathListEdit::onDown | ( | bool | = false | ) | [protected, slot] |
| void QtxPathListEdit::onInsert | ( | bool | = false | ) | [protected, slot] |
| void QtxPathListEdit::onDelete | ( | bool | = false | ) | [protected, slot] |
| void QtxPathListEdit::initialize | ( | ) | [private] |
References delete_icon, insert_icon, movedown_icon, moveup_icon, myList, myModel, onDelete(), onDown(), onInsert(), and onUp().
| parent | parent widget for the editor |
References pathType(), and QtxPathEdit.setPathType().
| void QtxPathListEdit::setModelData | ( | QWidget * | editor, |
| const QModelIndex & | index | ||
| ) | [private] |
| editor | editor widget |
| index | data model index |
References checkDuplicate(), checkExistance(), isDuplicateEnabled(), myModel, and QtxPathEdit.path().
| void QtxPathListEdit::setEditorData | ( | QWidget * | editor, |
| const QModelIndex & | index | ||
| ) | [private] |
| editor | editor widget |
| index | data model index |
References myModel, and QtxPathEdit.setPath().
| bool QtxPathListEdit::checkExistance | ( | const QString & | str, |
| const bool | msg = true |
||
| ) | [private] |
| 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.
| bool QtxPathListEdit::checkDuplicate | ( | const QString & | str, |
| const int | row, | ||
| const bool | msg = true |
||
| ) | [private] |
| 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.
friend class QtxPathListEdit::Delegate [friend] |
QListView* QtxPathListEdit.myList [private] |
Qtx::PathType QtxPathListEdit.myType [private] |
QStringListModel* QtxPathListEdit.myModel [private] |
QCompleter* QtxPathListEdit.myCompleter [private] |
bool QtxPathListEdit.myDuplicate [private] |