blob: 28836fe961ed45e9f00c48808b9833a8b614d9a0 (
plain) (
blame)
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
|
#pragma once
#include <QAbstractListModel>
#include <QWidget>
#include <QtCore>
struct Command {
QString name;
QString description;
};
const QList<Command> commands = {
{.name = "open", .description = "Open a url in the current tab"},
{.name = "tabopen", .description = "Open a url in a new tab"},
{.name = "tabnext", .description = "Go to next tab"},
{.name = "tabbprev", .description = "Go to previous tab"},
};
class CommandsModel : public QAbstractListModel {
Q_OBJECT
public:
CommandsModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QHash<int, QByteArray> roleNames() const override;
QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const override;
private:
QList<Command> items;
};
|