Save the width of comic info view in the GridView.

This commit is contained in:
Luis Ángel San Martín 2016-04-19 21:56:05 +02:00
parent 0486e5eb5f
commit 6a06217f0a
3 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,11 @@ GridComicsView::GridComicsView(QWidget *parent) :
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
QObject *infoContainer = rootObject->findChild<QObject*>("infoContainer");
QQmlProperty(infoContainer, "width").write(settings->value(COMICS_GRID_INFO_WIDTH, 350));
showInfoAction = new QAction(tr("Show info"),this);
showInfoAction->setIcon(QIcon(":/images/comics_view_toolbar/show_comic_info.png"));
showInfoAction->setCheckable(true);
@ -440,6 +445,11 @@ void GridComicsView::closeEvent(QCloseEvent *event)
toolbar->removeAction(showInfoSeparatorAction);
toolbar->removeAction(coverSizeSliderAction);
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
QObject *infoContainer = rootObject->findChild<QObject*>("infoContainer");
int infoWidth = QQmlProperty(infoContainer, "width").read().toInt();
/*QObject *object = view->rootObject();
QMetaObject::invokeMethod(object, "exit");
container->close();
@ -451,4 +461,5 @@ void GridComicsView::closeEvent(QCloseEvent *event)
//save settings
settings->setValue(COMICS_GRID_COVER_SIZES, coverSizeSlider->value());
settings->setValue(COMICS_GRID_SHOW_INFO, showInfoAction->isChecked());
settings->setValue(COMICS_GRID_INFO_WIDTH, infoWidth);
}

View File

@ -581,6 +581,7 @@ Rectangle {
}
Rectangle {
id: info_container
objectName: "infoContainer"
Layout.preferredWidth: 350
Layout.minimumWidth: 350
Layout.maximumWidth: 960

View File

@ -54,6 +54,7 @@
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
#define COMICS_GRID_COVER_SIZES "COMICS_GRID_COVER_SIZES"
#define COMICS_GRID_SHOW_INFO "COMICS_GRID_SHOW_INFO"
#define COMICS_GRID_INFO_WIDTH "COMICS_GRID_INFO_WIDTH"
#define COMIC_VINE_API_KEY "COMIC_VINE_API_KEY"
#define COMIC_VINE_BASE_URL "COMIC_VINE_BASE_URL"