1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2020 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #pragma once 27 28 #include <QDialog> 29 30 QT_BEGIN_NAMESPACE 31 class QAbstractItemModel; 32 class QTableView; 33 QT_END_NAMESPACE 34 35 namespace Ui { 36 class ListModelEditorDialog; 37 } 38 39 namespace QmlDesigner { 40 41 class ListModelEditorModel; 42 43 class ListModelEditorDialog : public QDialog 44 { 45 Q_OBJECT 46 47 public: 48 explicit ListModelEditorDialog(QWidget *parent = nullptr); 49 ~ListModelEditorDialog(); 50 51 void setModel(ListModelEditorModel *model); 52 53 protected: 54 void keyPressEvent(QKeyEvent *) override; 55 56 private: 57 void addRow(); 58 void openColumnDialog(); 59 void removeRows(); 60 void removeColumns(); 61 void changeHeader(int column); 62 void moveRowsDown(); 63 void moveRowsUp(); 64 65 private: 66 ListModelEditorModel *m_model{}; 67 QAction *m_addRowAction{}; 68 QAction *m_removeRowsAction{}; 69 QAction *m_addColumnAction{}; 70 QAction *m_removeColumnsAction{}; 71 QAction *m_moveUpAction{}; 72 QAction *m_moveDownAction{}; 73 QTableView *m_tableView{}; 74 }; 75 76 } // namespace QmlDesigner 77