1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef PATHLISTEDITOR_H
34 #define PATHLISTEDITOR_H
36 #include "utils_global.h"
38 #include <QtGui/QWidget>
39 #include <QtCore/QStringList>
47 struct PathListEditorPrivate;
49 class QTCREATOR_UTILS_EXPORT PathListEditor : public QWidget
51 Q_DISABLE_COPY(PathListEditor)
53 Q_PROPERTY(QStringList pathList READ pathList WRITE setPathList DESIGNABLE true)
54 Q_PROPERTY(QString fileDialogTitle READ fileDialogTitle WRITE setFileDialogTitle DESIGNABLE true)
57 explicit PathListEditor(QWidget *parent = 0);
58 virtual ~PathListEditor();
60 QString pathListString() const;
61 QStringList pathList() const;
62 QString fileDialogTitle() const;
64 static QChar separator();
66 // Add a convenience action "Import from 'Path'" (environment variable)
67 void addEnvVariableImportAction(const QString &var);
71 void setPathList(const QStringList &l);
72 void setPathList(const QString &pathString);
73 void setPathListFromEnvVariable(const QString &var);
74 void setFileDialogTitle(const QString &l);
77 // Index after which to insert further "Add" actions
78 static int lastAddActionIndex();
79 QAction *insertAction(int index /* -1 */, const QString &text, QObject * receiver, const char *slotFunc);
80 QAction *addAction(const QString &text, QObject * receiver, const char *slotFunc);
83 void setText(const QString &);
86 void insertPathAtCursor(const QString &);
87 void deletePathAtCursor();
88 void appendPath(const QString &);
95 PathListEditorPrivate *m_d;
100 #endif // PATHLISTEDITOR_H