diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-18 21:19:28 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-18 21:19:47 +0530 |
| commit | 4c762b2516bc664293c2aec072074f1e34dda8c3 (patch) | |
| tree | ebe441f7af8c1f4c49f04630538312d55f18f63b /src/completion/UrlModel.cpp | |
| parent | 056b0b16947ac19a0c425aa9d2ff8f589378d3bc (diff) | |
| download | null-browser-4c762b2516bc664293c2aec072074f1e34dda8c3.tar.gz null-browser-4c762b2516bc664293c2aec072074f1e34dda8c3.zip | |
Remove all the ui bits because screw it, lets unix a bit more
Diffstat (limited to 'src/completion/UrlModel.cpp')
| -rw-r--r-- | src/completion/UrlModel.cpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/completion/UrlModel.cpp b/src/completion/UrlModel.cpp deleted file mode 100644 index 8c5d75c..0000000 --- a/src/completion/UrlModel.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include <QAbstractListModel> -#include <QWidget> -#include <QtCore/qnamespace.h> -#include <QtCore> - -#include "completion/UrlModel.hpp" - -UrlModel::UrlModel(QObject *parent) : QAbstractListModel(parent) { - items = { - {.url = "https://google.com", .description = "Google"}, - {.url = "https://duckduckgo.com", .description = "DuckDuckGo"}, - {.url = "https://ediblemonad.dev", .description = "EdibleMonad website"}, - {.url = "https://lite.duckduckgo.com", .description = "DDG lite"}, - {.url = "https://github.com/trending", .description = "Github trending"}, - }; -} - -QVariant UrlModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= items.size()) - return QVariant(); - - const Url &item = items.at(index.row()); - - if (role == Qt::DisplayRole) - return item.url; - else if (role == Qt::UserRole) - return item.description; - else if (role == Qt::AccessibleDescriptionRole) - return item.url + " " + item.description; - - return QVariant(); -} - -QHash<int, QByteArray> UrlModel::roleNames() const { - QHash<int, QByteArray> roles; - roles[Qt::DisplayRole] = "url"; - roles[Qt::UserRole] = "description"; - roles[Qt::AccessibleDescriptionRole] = "full"; - return roles; -} - -int UrlModel::rowCount(const QModelIndex &parent) const { - Q_UNUSED(parent); - return items.size(); -} - -int UrlModel::columnCount(const QModelIndex &parent) const { - Q_UNUSED(parent); - return 2; // url + description -} |
