diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-15 19:17:03 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-15 20:08:30 +0530 |
| commit | 387cf24e389854ecc97f6236fdd6acbc2486dd52 (patch) | |
| tree | a51b51de0064fb10685d2da85d11748c4a32ce73 /src/completion/UrlModel.cpp | |
| parent | 05ae8976a8e1ab5411058de244c4e2fcc87ec369 (diff) | |
| download | null-browser-387cf24e389854ecc97f6236fdd6acbc2486dd52.tar.gz null-browser-387cf24e389854ecc97f6236fdd6acbc2486dd52.zip | |
Replaced QCompleter with custom implementation
Diffstat (limited to '')
| -rw-r--r-- | src/completion/UrlModel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/completion/UrlModel.cpp b/src/completion/UrlModel.cpp index 7671fc3..8c5d75c 100644 --- a/src/completion/UrlModel.cpp +++ b/src/completion/UrlModel.cpp @@ -1,5 +1,6 @@ #include <QAbstractListModel> #include <QWidget> +#include <QtCore/qnamespace.h> #include <QtCore> #include "completion/UrlModel.hpp" @@ -22,10 +23,10 @@ QVariant UrlModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) return item.url; - else if (role == Qt::ToolTipRole) - return item.description; else if (role == Qt::UserRole) return item.description; + else if (role == Qt::AccessibleDescriptionRole) + return item.url + " " + item.description; return QVariant(); } @@ -34,6 +35,7 @@ QHash<int, QByteArray> UrlModel::roleNames() const { QHash<int, QByteArray> roles; roles[Qt::DisplayRole] = "url"; roles[Qt::UserRole] = "description"; + roles[Qt::AccessibleDescriptionRole] = "full"; return roles; } @@ -44,5 +46,5 @@ int UrlModel::rowCount(const QModelIndex &parent) const { int UrlModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); - return 2; // name + description + return 2; // url + description } |
