mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 11:04:25 -04:00
@ -262,7 +262,7 @@ TRANSLATIONS = yacreaderlibrary_es.ts \
|
||||
yacreaderlibrary_source.ts
|
||||
|
||||
#QML/GridView
|
||||
QT += quick qml
|
||||
QT += quick qml quickwidgets
|
||||
|
||||
HEADERS += grid_comics_view.h \
|
||||
comics_view_transition.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "QsLog.h"
|
||||
|
||||
#include <QtQuick>
|
||||
#include <QQuickWidget>
|
||||
|
||||
ComicsView::ComicsView(QWidget *parent) :
|
||||
QWidget(parent),model(NULL),comicDB(nullptr)
|
||||
|
@ -10,7 +10,7 @@ class QSplitter;
|
||||
class ComicFlowWidget;
|
||||
class QToolBar;
|
||||
class ComicModel;
|
||||
class QQuickView;
|
||||
class QQuickWidget;
|
||||
|
||||
class ComicsView : public QWidget
|
||||
{
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
||||
QQuickView *view;
|
||||
QQuickWidget *view;
|
||||
QWidget *container;
|
||||
|
||||
ComicDB *comicDB;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "grid_comics_view.h"
|
||||
|
||||
#include <QtQuick>
|
||||
#include <QQuickWidget>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "comic.h"
|
||||
@ -40,21 +41,20 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
||||
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
||||
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
||||
|
||||
view = new QQuickView();
|
||||
view = new QQuickWidget(this);
|
||||
view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
connect(
|
||||
view, &QQuickView::statusChanged,
|
||||
[=] (QQuickView::Status status)
|
||||
view, &QQuickWidget::statusChanged,
|
||||
[=] (QQuickWidget::Status status)
|
||||
{
|
||||
if (status == QQuickView::Error)
|
||||
if (status == QQuickWidget::Error)
|
||||
{
|
||||
QLOG_ERROR() << view->errors();
|
||||
}
|
||||
}
|
||||
);
|
||||
container = QWidget::createWindowContainer(view, this);
|
||||
|
||||
container->setMinimumSize(200, 200);
|
||||
container->setFocusPolicy(Qt::TabFocus);
|
||||
//view->setFocusPolicy(Qt::TabFocus);
|
||||
|
||||
selectionHelper = new YACReaderComicsSelectionHelper(this);
|
||||
connect(selectionHelper, &YACReaderComicsSelectionHelper::selectionChanged, this, &GridComicsView::dummyUpdater);
|
||||
@ -183,7 +183,7 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
||||
setShowMarks(true);//TODO save this in settings
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addWidget(container);
|
||||
l->addWidget(view);
|
||||
this->setLayout(l);
|
||||
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
@ -10,8 +10,7 @@
|
||||
|
||||
class QAbstractListModel;
|
||||
class QItemSelectionModel;
|
||||
class QQuickView;
|
||||
class QQuickView;
|
||||
class QQuickWidget;
|
||||
|
||||
class YACReaderToolBarStretch;
|
||||
class YACReaderComicsSelectionHelper;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "info_comics_view.h"
|
||||
|
||||
#include <QtQuick>
|
||||
#include <QQuickWidget>
|
||||
|
||||
#include "comic.h"
|
||||
#include "comic_files_manager.h"
|
||||
@ -18,21 +19,20 @@ InfoComicsView::InfoComicsView(QWidget *parent)
|
||||
qmlRegisterType<ComicDB>("com.yacreader.ComicDB",1,0,"ComicDB");
|
||||
qmlRegisterType<ComicInfo>("com.yacreader.ComicInfo",1,0,"ComicInfo");
|
||||
|
||||
view = new QQuickView();
|
||||
view = new QQuickWidget();
|
||||
view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
connect(
|
||||
view, &QQuickView::statusChanged,
|
||||
[=] (QQuickView::Status status)
|
||||
view, &QQuickWidget::statusChanged,
|
||||
[=] (QQuickWidget::Status status)
|
||||
{
|
||||
if (status == QQuickView::Error)
|
||||
if (status == QQuickWidget::Error)
|
||||
{
|
||||
QLOG_ERROR() << view->errors();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
container = QWidget::createWindowContainer(view, this);
|
||||
|
||||
container->setFocusPolicy(Qt::StrongFocus);
|
||||
//container->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
|
||||
@ -95,7 +95,7 @@ InfoComicsView::InfoComicsView(QWidget *parent)
|
||||
comicInfoHelper = new YACReaderComicInfoHelper(this);
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addWidget(container);
|
||||
l->addWidget(view);
|
||||
this->setLayout(l);
|
||||
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
@ -12,7 +12,7 @@ import com.yacreader.ComicInfo 1.0
|
||||
import com.yacreader.ComicDB 1.0
|
||||
|
||||
SplitView {
|
||||
anchors.fill: parent
|
||||
//anchors.fill: parent
|
||||
orientation: Qt.Horizontal
|
||||
handleDelegate:Rectangle {
|
||||
width: 1
|
||||
@ -345,14 +345,38 @@ Rectangle {
|
||||
}
|
||||
|
||||
//rating icon
|
||||
RatingContextMenu {
|
||||
id: ratingContextMenu
|
||||
Image {
|
||||
id: ratingImage
|
||||
anchors {bottom: realCell.bottom; right: pageImage.left; bottomMargin: 5; rightMargin: Math.floor(pages.width)+12}
|
||||
source: "star.png"
|
||||
width: 13
|
||||
height: 11
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
console.log("rating");
|
||||
comicsSelectionHelper.clear();
|
||||
comicsSelectionHelper.selectIndex(index);
|
||||
grid.currentIndex = index;
|
||||
ratingConextMenu.popup();
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: ratingConextMenu
|
||||
MenuItem { text: "1"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,1) }
|
||||
MenuItem { text: "2"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,2) }
|
||||
MenuItem { text: "3"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,3) }
|
||||
MenuItem { text: "4"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,4) }
|
||||
MenuItem { text: "5"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,5) }
|
||||
}
|
||||
}
|
||||
|
||||
//comic rating
|
||||
Text {
|
||||
id: comicRating
|
||||
anchors {bottom: realCell.bottom; right: ratingContextMenu.left; margins: 4}
|
||||
anchors {bottom: realCell.bottom; right: ratingImage.left; margins: 4}
|
||||
text: rating>0?rating:"-"
|
||||
color: textColor
|
||||
}
|
||||
@ -827,5 +851,3 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,8 @@ Rectangle {
|
||||
|
||||
color: infoBackgroundColor
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
//width: parent.width
|
||||
//height: parent.height
|
||||
anchors.margins: 0
|
||||
|
||||
FlowView {
|
||||
|
@ -1,32 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
Image {
|
||||
id: ratingImage
|
||||
anchors {bottom: realCell.bottom; right: pageImage.left; bottomMargin: 5; rightMargin: Math.floor(pages.width)+12}
|
||||
source: "star.png"
|
||||
width: 13
|
||||
height: 11
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
console.log("rating");
|
||||
comicsSelectionHelper.clear();
|
||||
comicsSelectionHelper.selectIndex(index);
|
||||
grid.currentIndex = index;
|
||||
ratingConextMenu.popup();
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: ratingConextMenu
|
||||
MenuItem { text: "1"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,1) }
|
||||
MenuItem { text: "2"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,2) }
|
||||
MenuItem { text: "3"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,3) }
|
||||
MenuItem { text: "4"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,4) }
|
||||
MenuItem { text: "5"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,5) }
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
Image {
|
||||
id: ratingImage
|
||||
anchors {bottom: realCell.bottom; right: pageImage.left; bottomMargin: 5; rightMargin: Math.floor(pages.width)+12}
|
||||
source: "star.png"
|
||||
width: 13
|
||||
height: 11
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
console.log("rating");
|
||||
comicsSelectionHelper.clear();
|
||||
comicsSelectionHelper.selectIndex(index);
|
||||
grid.currentIndex = index;
|
||||
ratingConextMenu.popup();
|
||||
}
|
||||
}
|
||||
|
||||
MenuBar
|
||||
{
|
||||
Menu {
|
||||
id: ratingConextMenu
|
||||
MenuItem { text: "1"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,1) }
|
||||
MenuItem { text: "2"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,2) }
|
||||
MenuItem { text: "3"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,3) }
|
||||
MenuItem { text: "4"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,4) }
|
||||
MenuItem { text: "5"; enabled: true; iconSource:"star_menu.png"; onTriggered: comicRatingHelper.rate(index,5) }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
<file alias="qml/page.png">qml/page-macosx@2x.png</file>
|
||||
<file alias="qml/star.png">qml/star-macosx.png</file>
|
||||
<file alias="qml/star.png">qml/star-macosx@2x.png</file>
|
||||
<file alias="qml/RatingContextMenu.qml">qml/RatingContextMenu-osx.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -2,6 +2,5 @@
|
||||
<qresource prefix="/">
|
||||
<file>qml/page.png</file>
|
||||
<file>qml/star.png</file>
|
||||
<file alias="qml/RatingContextMenu.qml">qml/RatingContextMenu-win.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Reference in New Issue
Block a user