Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef QTXPATHLISTEDIT_H
00024 #define QTXPATHLISTEDIT_H
00025
00026 #include "Qtx.h"
00027
00028 #include <QFrame>
00029 #include <QPointer>
00030
00031 class QLineEdit;
00032 class QListView;
00033 class QCompleter;
00034 class QModelIndex;
00035 class QToolButton;
00036 class QStringListModel;
00037
00038 #ifdef WIN32
00039 #pragma warning( disable:4251 )
00040 #endif
00041
00042 class QTX_EXPORT QtxPathListEdit : public QFrame
00043 {
00044 Q_OBJECT
00045
00046 class Editor;
00047 class Delegate;
00048
00049 public:
00050 QtxPathListEdit( const Qtx::PathType, QWidget* = 0 );
00051 QtxPathListEdit( QWidget* = 0 );
00052 virtual ~QtxPathListEdit();
00053
00054 Qtx::PathType pathType() const;
00055 void setPathType( const Qtx::PathType );
00056
00057 QStringList pathList() const;
00058 void setPathList( const QStringList& );
00059
00060 bool isDuplicateEnabled() const;
00061 void setDuplicateEnabled( const bool );
00062
00063 int count() const;
00064 bool contains( const QString& ) const;
00065
00066 void clear();
00067 void remove( const int );
00068 void remove( const QString& );
00069 void insert( const QString&, const int = -1 );
00070
00071 bool eventFilter( QObject*, QEvent* );
00072
00073 protected slots:
00074 void onUp( bool = false );
00075 void onDown( bool = false );
00076 void onInsert( bool = false );
00077 void onDelete( bool = false );
00078
00079 private:
00080 void initialize();
00081 QWidget* createEditor( QWidget* );
00082 void setModelData( QWidget*, const QModelIndex& );
00083 void setEditorData( QWidget*, const QModelIndex& );
00084
00085 bool checkExistance( const QString&, const bool = true );
00086 bool checkDuplicate( const QString&, const int, const bool = true );
00087
00088 private:
00089 QListView* myList;
00090 Qtx::PathType myType;
00091 QStringListModel* myModel;
00092 QCompleter* myCompleter;
00093 bool myDuplicate;
00094
00095 friend class QtxPathListEdit::Delegate;
00096 };
00097
00098 #endif