summaryrefslogtreecommitdiff
path: root/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.h
blob: 2cbab6c50d46cae35f1c369c8d24771f0eb100ee (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
// 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 <QListView>

QT_FORWARD_DECLARE_CLASS(QModelIndex)

namespace QmakeProjectManager {
namespace Internal {
class ClassModel;

// Class list for new Custom widget classes. Provides
// editable '<new class>' field and Delete/Insert key handling.
class ClassList : public QListView
{
    Q_OBJECT

public:
    explicit ClassList(QWidget *parent = nullptr);

    QString className(int row) const;

signals:
    void classAdded(const QString &name);
    void classRenamed(int index, const QString &newName);
    void classDeleted(int index);
    void currentRowChanged(int);

public:
    void removeCurrentClass();
    void startEditingNewClassItem();

private:
    void classEdited();
    void slotCurrentRowChanged(const QModelIndex &,const QModelIndex &);

protected:
    void keyPressEvent(QKeyEvent *event) override;

private:
    ClassModel *m_model;
};

} // namespace Internal
} // namespace QmakeProjectManager