changed my mind, gonna implement the feed on qt instead of qml, first tries, nothing working yet

This commit is contained in:
Blue 2020-08-16 00:48:28 +03:00
parent 4e6bd04b02
commit e54cff0f0c
10 changed files with 200 additions and 100 deletions

65
ui/utils/feedview.h Normal file
View file

@ -0,0 +1,65 @@
/*
* Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FEEDVIEW_H
#define FEEDVIEW_H
#include <QAbstractItemView>
#include <deque>
#include <ui/models/messagefeed.h>
/**
* @todo write docs
*/
class FeedView : public QAbstractItemView
{
Q_OBJECT
public:
FeedView(QWidget* parent = nullptr);
~FeedView();
QModelIndex indexAt(const QPoint & point) const override;
void scrollTo(const QModelIndex & index, QAbstractItemView::ScrollHint hint) override;
QRect visualRect(const QModelIndex & index) const override;
bool isIndexHidden(const QModelIndex & index) const override;
QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command) override;
QRegion visualRegionForSelection(const QItemSelection & selection) const override;
protected slots:
void rowsInserted(const QModelIndex & parent, int start, int end) override;
protected:
int verticalOffset() const override;
int horizontalOffset() const override;
void paintEvent(QPaintEvent * event) override;
void updateGeometries() override;
private:
struct Hint {
bool dirty;
uint32_t offset;
uint32_t height;
};
std::deque<Hint> hints;
};
#endif //FEEDVIEW_H