aboutsummaryrefslogtreecommitdiff
path: root/include/completion/CommandsModel.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/completion/CommandsModel.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/completion/CommandsModel.hpp b/include/completion/CommandsModel.hpp
new file mode 100644
index 0000000..6cb25f9
--- /dev/null
+++ b/include/completion/CommandsModel.hpp
@@ -0,0 +1,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 = "bnext", .description = "Go to next tab"},
+ {.name = "bprev", .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;
+};