diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-05 10:44:38 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-05 10:44:38 +0200 |
| commit | b917b6099ab8477488f0f352339aa6fca2235c36 (patch) | |
| tree | 1a29332613259a097dbbff2aa5fa78cdc05ab11d /tabbrowsinghistory.cpp | |
| parent | da305e17be24b9db1c2014c6125399147ec404d9 (diff) | |
| download | kristall-b917b6099ab8477488f0f352339aa6fca2235c36.tar.gz | |
Starts to implement navigation history.
Diffstat (limited to 'tabbrowsinghistory.cpp')
| -rw-r--r-- | tabbrowsinghistory.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tabbrowsinghistory.cpp b/tabbrowsinghistory.cpp new file mode 100644 index 0000000..1a2d07f --- /dev/null +++ b/tabbrowsinghistory.cpp @@ -0,0 +1,44 @@ +#include "tabbrowsinghistory.hpp" + +TabBrowsingHistory::TabBrowsingHistory() +{ + +} + +bool TabBrowsingHistory::canGoBack() const +{ + return this->history.size() > 0; +} + +bool TabBrowsingHistory::canGoForward() const +{ + return false; +} + +void TabBrowsingHistory::pushUrl(const QUrl &url) +{ + this->beginInsertRows(QModelIndex{}, this->history.length(),this->history.length() + 1); + + this->history.push_back(url); + + this->endInsertRows(); +} + +int TabBrowsingHistory::rowCount(const QModelIndex &parent) const +{ + return history.size(); +} + +bool TabBrowsingHistory::setData(const QModelIndex &index, const QVariant &value, int role) +{ + return false; +} + +QVariant TabBrowsingHistory::data(const QModelIndex &index, int role) const +{ + if(role != Qt::DisplayRole) { + return QVariant{}; + } + return history.at(index.row()).toString(); +} + |
