mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Added new info comcis view skeleton + setting the comics model. So far it can loads the list of covers from the model. FlowView.qml will be a FlowGL replacement that will be the default in the ANGLE version and an option in the main version.
This commit is contained in:
@ -1,9 +1,32 @@
|
||||
#include "info_comics_view.h"
|
||||
|
||||
#include <QtQuick>
|
||||
|
||||
#include "comic_model.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
InfoComicsView::InfoComicsView(QWidget *parent)
|
||||
:ComicsView(parent)
|
||||
{
|
||||
int FIXME;
|
||||
qmlRegisterType<ComicModel>("com.yacreader.ComicModel",1,0,"ComicModel");
|
||||
|
||||
view = new QQuickView();
|
||||
container = QWidget::createWindowContainer(view, this);
|
||||
|
||||
container->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
view->setSource(QUrl("qrc:/qml/InfoComicsView.qml"));
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addWidget(container);
|
||||
this->setLayout(l);
|
||||
|
||||
setContentsMargins(0,0,0,0);
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
l->setSpacing(0);
|
||||
|
||||
QLOG_TRACE() << "GridComicsView";
|
||||
}
|
||||
|
||||
void InfoComicsView::setToolBar(QToolBar *toolBar)
|
||||
@ -15,7 +38,36 @@ void InfoComicsView::setToolBar(QToolBar *toolBar)
|
||||
|
||||
void InfoComicsView::setModel(ComicModel *model)
|
||||
{
|
||||
int FIXME;
|
||||
if(model == NULL)
|
||||
return;
|
||||
|
||||
ComicsView::setModel(model);
|
||||
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
|
||||
/*if(_selectionModel != NULL)
|
||||
delete _selectionModel;
|
||||
|
||||
_selectionModel = new QItemSelectionModel(model);*/
|
||||
|
||||
//TODO fix crash in the following line on comics views switch
|
||||
|
||||
int row = currentIndex().row();
|
||||
ctxt->setContextProperty("comicsList", model);
|
||||
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
|
||||
|
||||
/*ctxt->setContextProperty("comicsSelection", _selectionModel);
|
||||
ctxt->setContextProperty("contextMenuHelper",this);
|
||||
ctxt->setContextProperty("comicsSelectionHelper", this);
|
||||
ctxt->setContextProperty("comicRatingHelper", this);
|
||||
ctxt->setContextProperty("dummyValue", true);
|
||||
ctxt->setContextProperty("dragManager", this);
|
||||
ctxt->setContextProperty("dropManager", this);
|
||||
|
||||
updateBackgroundConfig();*/
|
||||
|
||||
if(model->rowCount()>0)
|
||||
setCurrentIndex(model->index(0,0));
|
||||
}
|
||||
|
||||
void InfoComicsView::setCurrentIndex(const QModelIndex &index)
|
||||
|
Reference in New Issue
Block a user