1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Fix native text rendering

Fix reloading of installedlistmodel every time
This commit is contained in:
Elias 2019-01-31 18:13:52 +01:00
parent 38ba3c2700
commit 70fe34812e
2 changed files with 9 additions and 13 deletions

View File

@ -4,7 +4,6 @@
#include <QGuiApplication>
#include <QIcon>
#include <QLibrary>
#include <QModelIndex>
#include <QObject>
#include <QQmlApplicationEngine>
#include <QQmlContext>
@ -14,7 +13,6 @@
#include <QQuickView>
#include <QScreen>
#include <QStringList>
#include <QTransform>
#include <QUrl>
#include <QVariant>
#include <QWindow>
@ -49,8 +47,8 @@ int main(int argc, char* argv[])
app.setQuitOnLastWindowClosed(false);
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
// This gives us nice clickable output in QtCreator
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
qDebug() << QThread::currentThreadId();
QtWebEngine::initialize();
@ -134,14 +132,8 @@ int main(int argc, char* argv[])
profileListModel.loadProfiles();
settings.loadActiveProfiles();
QQmlApplicationEngine mainWindowEngine;
// Instead of setting "renderType: Text.NativeRendering" every time
// we can set it here once :)
auto* window = static_cast<QQuickWindow*>(mainWindowEngine.rootObjects().first());
window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
mainWindowEngine.rootContext()->setContextProperty("screenPlay", &screenPlay);
mainWindowEngine.rootContext()->setContextProperty("screenPlayCreate", &create);
mainWindowEngine.rootContext()->setContextProperty("utility", &qmlUtil);
@ -152,6 +144,13 @@ int main(int argc, char* argv[])
mainWindowEngine.rootContext()->setContextProperty("screenPlaySettings", &settings);
mainWindowEngine.load(QUrl(QStringLiteral("qrc:/main.qml")));
installedListFilter.sortByRoleType("All");
installedListModel.loadScreens();
// Instead of setting "renderType: Text.NativeRendering" every time
// we can set it here once :)
auto* window = static_cast<QQuickWindow*>(mainWindowEngine.rootObjects().first());
window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// Set visible if the -silent parameter was not set
QStringList argumentList = app.arguments();

View File

@ -1,5 +1,4 @@
import QtQuick 2.9
import QtQml.Models 2.2
import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
@ -16,9 +15,6 @@ Item {
property bool enabled: true
Component.onCompleted: {
installedListFilter.sortByRoleType("All")
installedListModel.reset()
installedListModel.loadScreens()
pageInstalled.state = "in"
}
@ -316,6 +312,7 @@ Item {
right: parent.right
rightMargin: 30
bottom: parent.bottom
bottomMargin: 5
}
onTextChanged: {
if (txtSearch.text.length === 0) {