Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Running Qt app on phone vs desktop
Forum Updated to NodeBB v4.3 + New Features

Running Qt app on phone vs desktop

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 414 Views 2 Watching
  • 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.
  • P Offline
    P Offline
    Publicnamer
    wrote on last edited by Publicnamer
    #1

    How can I easily detect that I'm running on a smaller screen e.g. 5 to 7 inches, and therefore use the full screen area,
    versus running on a desktop where the display may be huge and the app window smaller? For instance, if I try to infer it by looking at the resolution e.g. 1920x1080, that could apply to both a desktop and to a phone. Even if I get qApp->desktop()->logicalDpiX(); to get the screen dimensions, or I use getenv("QT_SCALE_FACTOR") to try to guess the rough screen size, some desktops have smaller screens e.g. the Raspberry pi 7 inch display.

    1 Reply Last reply
    1
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      You can use QSysInfo

      P 1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        QRect rect = QGuiApplication::screens().at( 0 )->geometry();
        resize your app to the size of rect for full screen or compare the size to check if it is in the full screen mode

        1 Reply Last reply
        0
        • M mchinand

          You can use QSysInfo

          P Offline
          P Offline
          Publicnamer
          wrote on last edited by Publicnamer
          #4

          @mchinand I'm not sure that will work with the PinePhone which runs various Linuxes.

          Perhaps if the screen diagonal is less than 6.8 inches I could call it a phone.
          However I'm finding that when I use QGuiApplication::screens().at(0)->geometry(), combined with dpiX and dpiY,
          the diagonal screen measurement is not accurate, because the DPI values are obtained from the OS, not from the monitor.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bonnie
            wrote on last edited by Bonnie
            #5

            6.8 inches means physical size, right? So I think you shouldn't use any logicalDpi*() methods for that.
            Maybe try QScreen::physicalSize(), that should give you the physical screen size in millimeters.
            Or you can search for other physicalDotsPerInch*() / physicalDpi*() methods if you want DPI infomations.

            P 1 Reply Last reply
            1
            • B Bonnie

              6.8 inches means physical size, right? So I think you shouldn't use any logicalDpi*() methods for that.
              Maybe try QScreen::physicalSize(), that should give you the physical screen size in millimeters.
              Or you can search for other physicalDotsPerInch*() / physicalDpi*() methods if you want DPI infomations.

              P Offline
              P Offline
              Publicnamer
              wrote on last edited by
              #6

              @Bonnie The real problem here is that a screen of any size can be used like a desktop, or a phone screen.
              For instance the Raspberry Pi 7" is always used like a desktop UI.
              Thus it is a question of "user interface idiom" i.e. how the screen is meant to be used.

              1 Reply Last reply
              0

              • Login

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