mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Use QQuickWidget instead of QQuickView to avoid displacement bugs on Windows and Linux
This commit is contained in:
parent
663795d015
commit
02eda8eeb5
@ -262,7 +262,7 @@ TRANSLATIONS = yacreaderlibrary_es.ts \
|
|||||||
yacreaderlibrary_source.ts
|
yacreaderlibrary_source.ts
|
||||||
|
|
||||||
#QML/GridView
|
#QML/GridView
|
||||||
QT += quick qml
|
QT += quick qml quickwidgets
|
||||||
|
|
||||||
HEADERS += grid_comics_view.h \
|
HEADERS += grid_comics_view.h \
|
||||||
comics_view_transition.h
|
comics_view_transition.h
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
#include <QtQuick>
|
#include <QtQuick>
|
||||||
|
#include <QQuickWidget>
|
||||||
|
|
||||||
ComicsView::ComicsView(QWidget *parent) :
|
ComicsView::ComicsView(QWidget *parent) :
|
||||||
QWidget(parent),model(NULL),comicDB(nullptr)
|
QWidget(parent),model(NULL),comicDB(nullptr)
|
||||||
|
@ -10,7 +10,7 @@ class QSplitter;
|
|||||||
class ComicFlowWidget;
|
class ComicFlowWidget;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
class ComicModel;
|
class ComicModel;
|
||||||
class QQuickView;
|
class QQuickWidget;
|
||||||
|
|
||||||
class ComicsView : public QWidget
|
class ComicsView : public QWidget
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ protected:
|
|||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
QQuickView *view;
|
QQuickWidget *view;
|
||||||
QWidget *container;
|
QWidget *container;
|
||||||
|
|
||||||
ComicDB *comicDB;
|
ComicDB *comicDB;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "grid_comics_view.h"
|
#include "grid_comics_view.h"
|
||||||
|
|
||||||
#include <QtQuick>
|
#include <QtQuick>
|
||||||
|
#include <QQuickWidget>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "comic.h"
|
#include "comic.h"
|
||||||
@ -40,21 +41,20 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
|||||||
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
||||||
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
||||||
|
|
||||||
view = new QQuickView();
|
view = new QQuickWidget(this);
|
||||||
|
view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
connect(
|
connect(
|
||||||
view, &QQuickView::statusChanged,
|
view, &QQuickWidget::statusChanged,
|
||||||
[=] (QQuickView::Status status)
|
[=] (QQuickWidget::Status status)
|
||||||
{
|
{
|
||||||
if (status == QQuickView::Error)
|
if (status == QQuickWidget::Error)
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << view->errors();
|
QLOG_ERROR() << view->errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
container = QWidget::createWindowContainer(view, this);
|
|
||||||
|
|
||||||
container->setMinimumSize(200, 200);
|
//view->setFocusPolicy(Qt::TabFocus);
|
||||||
container->setFocusPolicy(Qt::TabFocus);
|
|
||||||
|
|
||||||
selectionHelper = new YACReaderComicsSelectionHelper(this);
|
selectionHelper = new YACReaderComicsSelectionHelper(this);
|
||||||
connect(selectionHelper, &YACReaderComicsSelectionHelper::selectionChanged, this, &GridComicsView::dummyUpdater);
|
connect(selectionHelper, &YACReaderComicsSelectionHelper::selectionChanged, this, &GridComicsView::dummyUpdater);
|
||||||
@ -183,7 +183,7 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
|||||||
setShowMarks(true);//TODO save this in settings
|
setShowMarks(true);//TODO save this in settings
|
||||||
|
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
l->addWidget(container);
|
l->addWidget(view);
|
||||||
this->setLayout(l);
|
this->setLayout(l);
|
||||||
|
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
class QAbstractListModel;
|
class QAbstractListModel;
|
||||||
class QItemSelectionModel;
|
class QItemSelectionModel;
|
||||||
class QQuickView;
|
class QQuickWidget;
|
||||||
class QQuickView;
|
|
||||||
|
|
||||||
class YACReaderToolBarStretch;
|
class YACReaderToolBarStretch;
|
||||||
class YACReaderComicsSelectionHelper;
|
class YACReaderComicsSelectionHelper;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "info_comics_view.h"
|
#include "info_comics_view.h"
|
||||||
|
|
||||||
#include <QtQuick>
|
#include <QtQuick>
|
||||||
|
#include <QQuickWidget>
|
||||||
|
|
||||||
#include "comic.h"
|
#include "comic.h"
|
||||||
#include "comic_files_manager.h"
|
#include "comic_files_manager.h"
|
||||||
@ -18,21 +19,20 @@ InfoComicsView::InfoComicsView(QWidget *parent)
|
|||||||
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
||||||
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
||||||
|
|
||||||
view = new QQuickView();
|
view = new QQuickWidget();
|
||||||
|
view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
connect(
|
connect(
|
||||||
view, &QQuickView::statusChanged,
|
view, &QQuickWidget::statusChanged,
|
||||||
[=] (QQuickView::Status status)
|
[=] (QQuickWidget::Status status)
|
||||||
{
|
{
|
||||||
if (status == QQuickView::Error)
|
if (status == QQuickWidget::Error)
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << view->errors();
|
QLOG_ERROR() << view->errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
container = QWidget::createWindowContainer(view, this);
|
//container->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
container->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
|
|
||||||
QQmlContext *ctxt = view->rootContext();
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ InfoComicsView::InfoComicsView(QWidget *parent)
|
|||||||
comicInfoHelper = new YACReaderComicInfoHelper(this);
|
comicInfoHelper = new YACReaderComicInfoHelper(this);
|
||||||
|
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
l->addWidget(container);
|
l->addWidget(view);
|
||||||
this->setLayout(l);
|
this->setLayout(l);
|
||||||
|
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
|
@ -12,7 +12,7 @@ import com.yacreader.ComicInfo 1.0
|
|||||||
import com.yacreader.ComicDB 1.0
|
import com.yacreader.ComicDB 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
anchors.fill: parent
|
//anchors.fill: parent
|
||||||
orientation: Qt.Horizontal
|
orientation: Qt.Horizontal
|
||||||
handleDelegate:Rectangle {
|
handleDelegate:Rectangle {
|
||||||
width: 1
|
width: 1
|
||||||
@ -827,5 +827,3 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ Rectangle {
|
|||||||
|
|
||||||
color: infoBackgroundColor
|
color: infoBackgroundColor
|
||||||
|
|
||||||
width: parent.width
|
//width: parent.width
|
||||||
height: parent.height
|
//height: parent.height
|
||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
|
|
||||||
FlowView {
|
FlowView {
|
||||||
|
Loading…
Reference in New Issue
Block a user