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 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().
|
virtual |
|
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.
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 | ( | ) |
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.
int QtxPathListEdit::count | ( | ) | const |
References myModel.
parent | parent widget for the editor |
References pathType(), and QtxPathEdit::setPathType().
o | event receiver object |
e | event |
true
if the further event processing should be stopped. References onDelete(), onDown(), onInsert(), and onUp().
|
private |
References delete_icon, insert_icon, movedown_icon, moveup_icon, myList, myModel, onDelete(), onDown(), onInsert(), and onUp().
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 |
true
if the duplication is enabled References myDuplicate.
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
QStringList QtxPathListEdit::pathList | ( | ) | const |
References myModel.
Qtx::PathType QtxPathListEdit::pathType | ( | ) | const |
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::setDuplicateEnabled | ( | const bool | on | ) |
on | new flag value |
References myDuplicate.
editor | editor widget |
index | data model index |
References myModel, and QtxPathEdit::setPath().
editor | editor widget |
index | data model index |
References checkDuplicate(), checkExistance(), isDuplicateEnabled(), myModel, and QtxPathEdit::path().
void QtxPathListEdit::setPathList | ( | const QStringList & | lst | ) |
void QtxPathListEdit::setPathType | ( | const Qtx::PathType | t | ) |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |