Skip to content

Commit

Permalink
[fingerterm] Set window size before showing it. Fixes JB#35253
Browse files Browse the repository at this point in the history
Main qml still gets first hard-coded pixel sizes but at least now
Jolla tablet doesn't get confused by changing window size.
  • Loading branch information
pvuorela committed May 17, 2016
1 parent b0a6b65 commit f3e0e86
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions main.cpp
Expand Up @@ -103,6 +103,17 @@ int main(int argc, char *argv[])
qmlRegisterType<TextRender>("TextRender",1,0,"TextRender");
QQuickView view;

bool fullscreen = !app.arguments().contains("-nofs");
QSize screenSize = QGuiApplication::primaryScreen()->size();

if (fullscreen) {
view.setWidth(screenSize.width());
view.setHeight(screenSize.height());
} else {
view.setWidth(screenSize.width() / 2);
view.setHeight(screenSize.height() / 2);
}

Terminal term;
Util util(settings);
term.setUtil(&util);
Expand Down Expand Up @@ -133,8 +144,8 @@ int main(int argc, char *argv[])
context->setContextProperty( "util", &util );
context->setContextProperty( "keyLoader", &keyLoader );

view.setSource(QUrl("qrc:/qml/Main.qml"));
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/qml/Main.qml"));

QObject *root = view.rootObject();
if(!root)
Expand All @@ -156,12 +167,9 @@ int main(int argc, char *argv[])

QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));

if (!app.arguments().contains("-nofs")) {
if (fullscreen) {
view.showFullScreen();
} else {
QSize screenSize = QGuiApplication::primaryScreen()->size();
view.setWidth(screenSize.width() / 2);
view.setHeight(screenSize.height() / 2);
view.show();
}

Expand Down

0 comments on commit f3e0e86

Please sign in to comment.