mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 15:25:34 +08:00
refs #454 Improve hotkey settings component
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6644c73703
commit
5a82e2e6bf
74
src/blackgui/models/actionmodel.h
Normal file
74
src/blackgui/models/actionmodel.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_ACTIONMODEL_H
|
||||
#define BLACKGUI_ACTIONMODEL_H
|
||||
|
||||
#include "blackcore/actionbind.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
class ActionItem;
|
||||
|
||||
/*!
|
||||
* Action tree model
|
||||
*/
|
||||
class CActionModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! User roles
|
||||
enum ItemRole
|
||||
{
|
||||
ActionRole = Qt::UserRole
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CActionModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CActionModel();
|
||||
|
||||
//! \copydoc QAbstractItemModel::data
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
//! \copydoc QAbstractItemModel::flags
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
//! \copydoc QAbstractItemModel::index
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
//! \copydoc QAbstractItemModel::parent
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
//! \copydoc QAbstractItemModel::rowCount
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
//! \copydoc QAbstractItemModel::columnCount
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
private:
|
||||
void setupModelData();
|
||||
|
||||
QScopedPointer<ActionItem> m_rootItem;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user