blob: 492b699860504f9ad3eae969e9b5053926cd33ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "utils_global.h"
#include <QWidget>
#include <functional>
QT_BEGIN_NAMESPACE
class QPushButton;
QT_END_NAMESPACE
namespace Utils {
struct PathListEditorPrivate;
class QTCREATOR_UTILS_EXPORT PathListEditor : public QWidget
{
Q_OBJECT
Q_PROPERTY(QStringList pathList READ pathList WRITE setPathList DESIGNABLE true)
Q_PROPERTY(QString fileDialogTitle READ fileDialogTitle WRITE setFileDialogTitle DESIGNABLE true)
public:
explicit PathListEditor(QWidget *parent = nullptr);
~PathListEditor() override;
QString pathListString() const;
QStringList pathList() const;
QString fileDialogTitle() const;
void clear();
void setPathList(const QStringList &l);
void setPathList(const QString &pathString);
void setFileDialogTitle(const QString &l);
void setPlaceholderText(const QString &placeholder);
signals:
void changed();
protected:
// Index after which to insert further "Add" buttons
static const int lastInsertButtonIndex;
QPushButton *addButton(const QString &text, QObject *parent, std::function<void()> slotFunc);
QPushButton *insertButton(int index /* -1 */, const QString &text, QObject *parent,
std::function<void()> slotFunc);
QString text() const;
void setText(const QString &);
void insertPathAtCursor(const QString &);
void deletePathAtCursor();
private:
PathListEditorPrivate *d;
};
} // namespace Utils
|