← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~mcintire-evan/ubuntu-terminal-app/window-font-size into lp:ubuntu-terminal-app

 

I replied to your question. :)

Diff comments:

> === modified file 'src/app/main.cpp'
> --- src/app/main.cpp	2016-01-25 12:37:14 +0000
> +++ src/app/main.cpp	2016-02-13 21:25:20 +0000
> @@ -53,7 +53,7 @@
>  {
>      QApplication a(argc, argv);
>      QQuickView view;
> -    view.setResizeMode(QQuickView::SizeRootObjectToView);
> +    view.setResizeMode(QQuickView::SizeViewToRootObject);

Legit! :)

>  
>      FileIO fileIO;
>      view.engine()->rootContext()->setContextProperty("fileIO", &fileIO);
> 
> === modified file 'src/app/qml/ubuntu-terminal-app.qml'
> --- src/app/qml/ubuntu-terminal-app.qml	2016-02-07 18:24:56 +0000
> +++ src/app/qml/ubuntu-terminal-app.qml	2016-02-13 21:25:20 +0000
> @@ -12,8 +12,8 @@
>      applicationName: "com.ubuntu.terminal"
>      automaticOrientation: true
>  
> -    width: units.gu(90)
> -    height: units.gu(55)
> +    width: 40 * settings.fontPixelSize()

Since Qt 5.4 there's a FontMetrics component that allows to do that (it returns width and height, so you have to make the division by yourself):
    http://doc.qt.io/qt-5/qml-qtquick-fontmetrics.html

If you were talking about the terminal plugin, a signal is automatically emitted when the font size changes[1], so any property that has a QML binding on terminal.fontMetrics is automatically updated according to the size of the new font (i.e. the width and the height of the terminal window, in this case).
No need for adding a TODO. :)

[1] http://bazaar.launchpad.net/~ubuntu-terminal-dev/ubuntu-terminal-app/reboot/view/head:/src/plugin/qmltermwidget/lib/TerminalDisplay.h#L97

> +    height: 24 * settings.fontPixelSize()
>  
>      AuthenticationService {
>          onDenied: Qt.quit();


-- 
https://code.launchpad.net/~mcintire-evan/ubuntu-terminal-app/window-font-size/+merge/285285
Your team Ubuntu Terminal Developers is subscribed to branch lp:ubuntu-terminal-app.


References