Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Font on Desktop is ok, on Anroid is too Big
QtWS25 Last Chance

Font on Desktop is ok, on Anroid is too Big

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 5 Posters 991 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    athandev
    wrote on last edited by
    #1

    Hello, I'm new to QtQuick, I have this TableView

    Qtc1.TableView {
            width:parent.width
            height:parent.height*2/3
            id: products
           Qtc1.TableViewColumn {
                role: "title"
                title: "Title"
                width: parent.width/2
            }
            Qtc1.TableViewColumn {
                role: "cost"
                title: "Cost"
                width: parent.width/2
            }
                /*onPressAndHold: {
                    mediator.removeItem(currentRow)
                }*/
            model:mediator.myModel
    
        }
    

    This is the Desktop mode
    0_1528638707733_Screenshot_3.png

    And this is the Android Mode
    0_1528638733609_34879406_987284754773093_6305572599724244992_n.png

    1 Reply Last reply
    0
    • A Offline
      A Offline
      athandev
      wrote on last edited by
      #2

      Ok, I just add

      qputenv("QT_SCALE_FACTOR", "0.3");
      

      on my main.cpp

      1 Reply Last reply
      1
      • A Offline
        A Offline
        athandev
        wrote on last edited by
        #3

        Well now font's bad on Desktop, it's tiny, is there any way to know when app's running on Desktop or on Android, so I can run, or not run the command above?

        KillerSmathK 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you forgot to disable QT_SCALE_FACTOR for desktop ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          1
          • A athandev

            Well now font's bad on Desktop, it's tiny, is there any way to know when app's running on Desktop or on Android, so I can run, or not run the command above?

            KillerSmathK Offline
            KillerSmathK Offline
            KillerSmath
            wrote on last edited by KillerSmath
            #5

            @athandev
            Did you try to use a preprocessor macro ?

            // main function
            
            ...
            
            #if defined(Q_OS_ANDROID)
             // do something on Android
            #elif defined(Q_OS_LINUX)
             // do something on Linux
            #endif
            
            ...
            

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            1 Reply Last reply
            3
            • SGaistS SGaist

              Hi,

              Did you forgot to disable QT_SCALE_FACTOR for desktop ?

              A Offline
              A Offline
              athandev
              wrote on last edited by
              #6

              How to do it?

              mrjjM 1 Reply Last reply
              0
              • A athandev

                How to do it?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @athandev
                You could just use defines as @KillerSmath shows.
                and set QT_SCALE_FACTOR (or disable)
                pr platform.

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  igor_stravinsky
                  wrote on last edited by
                  #8

                  I have the same problem between desktops (Windows vs. Mac), so I use a set of dynamically defined constants, like this:

                  property int smallFontSize: (Qt.platform.os === "osx") ? 12 : 8;

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved