mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
refs #454 Improve hotkey settings component
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6644c73703
commit
5a82e2e6bf
70
src/blackgui/models/actionhotkeylistmodel.h
Normal file
70
src/blackgui/models/actionhotkeylistmodel.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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_ACTIONHOTKEYLISTMODEL_H
|
||||
#define BLACKGUI_ACTIONHOTKEYLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/input/actionhotkeylist.h"
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Hotkey list model
|
||||
class BLACKGUI_EXPORT CActionHotkeyListModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Item role
|
||||
enum ItemRole
|
||||
{
|
||||
ActionHotkeyRole = Qt::UserRole
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CActionHotkeyListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CActionHotkeyListModel() {}
|
||||
|
||||
//! \copydoc QAbstractTableModel::rowCount
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::columCount
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::data
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::setData
|
||||
bool setData(const QModelIndex &index, const QVariant &var, int role) override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::headerData
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::insertRows
|
||||
bool insertRows(int position, int rows, const QModelIndex &index) override;
|
||||
|
||||
//! \copydoc QAbstractTableModel::removeRows
|
||||
bool removeRows(int position, int rows, const QModelIndex &index) override;
|
||||
|
||||
//! Clear model
|
||||
void clear();
|
||||
|
||||
private:
|
||||
BlackMisc::Input::CActionHotkeyList m_actionHotkeys;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user