Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Reimplement methods in UIViewController
Forum Updated to NodeBB v4.3 + New Features

Reimplement methods in UIViewController

Scheduled Pinned Locked Moved Solved Mobile and Embedded
6 Posts 2 Posters 521 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.
  • O Offline
    O Offline
    ondrejandrej
    wrote on 29 Jun 2021, 09:51 last edited by ondrejandrej
    #1

    Hi,
    I need to reimplement prefersHomeIndicatorAutoHidden getter function to return true in landscape mode because I want my application to use bigger part of the screen on iPhone X and later:
    https://developer.apple.com/documentation/uikit/uiviewcontroller/2887510-prefershomeindicatorautohidden

    So the question is how to reimplement UIViewController in a Qt Quick app. It appears that that all Qt apps are using QIOSViewController class whose source code is in /Library/Qt/5.12.10/Src/qtbase/src/plugins/platforms/ios/QIOSViewController.h (and .mm)
    The class is part of the Qt binaries and included in application bundle in binary form. That would mean I have to modify Qt code and use my recompiled Qt binaries. I don't want to do that.

    Is there a way to make my app use other view controller? Or other way to set the iOS autohide Home indicator feature without recompiling Qt?

    J 1 Reply Last reply 29 Jun 2021, 09:54
    0
    • O ondrejandrej
      29 Jun 2021, 09:51

      Hi,
      I need to reimplement prefersHomeIndicatorAutoHidden getter function to return true in landscape mode because I want my application to use bigger part of the screen on iPhone X and later:
      https://developer.apple.com/documentation/uikit/uiviewcontroller/2887510-prefershomeindicatorautohidden

      So the question is how to reimplement UIViewController in a Qt Quick app. It appears that that all Qt apps are using QIOSViewController class whose source code is in /Library/Qt/5.12.10/Src/qtbase/src/plugins/platforms/ios/QIOSViewController.h (and .mm)
      The class is part of the Qt binaries and included in application bundle in binary form. That would mean I have to modify Qt code and use my recompiled Qt binaries. I don't want to do that.

      Is there a way to make my app use other view controller? Or other way to set the iOS autohide Home indicator feature without recompiling Qt?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 29 Jun 2021, 09:54 last edited by
      #2

      @ondrejandrej
      take a look at my old project here:
      https://github.com/DeiVadder/iPhoneXworkarounds

      I think that is what you're looking for


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ondrejandrej
        wrote on 29 Jun 2021, 10:01 last edited by ondrejandrej
        #3

        I don't think so. Your project contains the QIOSViewController class which isn't instantiated anywhere. So its code is never executed.

        J 1 Reply Last reply 29 Jun 2021, 10:13
        0
        • O ondrejandrej
          29 Jun 2021, 10:01

          I don't think so. Your project contains the QIOSViewController class which isn't instantiated anywhere. So its code is never executed.

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 29 Jun 2021, 10:13 last edited by
          #4

          @ondrejandrej said in Reimplement methods in UIViewController:

          I don't think so

          you just assume.

          I just cloned it and rerun it, 3 years later and it still works just as intended.

          b9cf1936-33f9-43ae-9bb4-70ee090c851d-image.png

          the home bar fades out after a couple of seconds, just as intended


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • O Offline
            O Offline
            ondrejandrej
            wrote on 30 Jun 2021, 06:41 last edited by
            #5

            You are right. A qDebug() printout in prefersHomeIndicatorAutoHidden shows that the code is really executed. But I realized that it only does what its name suggests. So the Home indicator disappears, but application window doesn't get any bigger.

            I finally solved it by setting window flags like this:

            ApplicationWindow
            {
                flags: Qt.MaximizeUsingFullscreenGeometryHint
                ...
            }
            
            J 1 Reply Last reply 30 Jun 2021, 06:59
            0
            • O ondrejandrej
              30 Jun 2021, 06:41

              You are right. A qDebug() printout in prefersHomeIndicatorAutoHidden shows that the code is really executed. But I realized that it only does what its name suggests. So the Home indicator disappears, but application window doesn't get any bigger.

              I finally solved it by setting window flags like this:

              ApplicationWindow
              {
                  flags: Qt.MaximizeUsingFullscreenGeometryHint
                  ...
              }
              
              J Offline
              J Offline
              J.Hilk
              Moderators
              wrote on 30 Jun 2021, 06:59 last edited by
              #6

              @ondrejandrej up like mentioned in the readme of the repository :D

              keep in mind though, that you don't really get the real estate of that area for touch use, but only for visualisation.

              As soon as you touch there, the home bar will reappear.

              If you want that, for example to use in a game, than Xcode now have these settings here
              d710af47-437f-4b4b-8f2f-967870b5367a-image.png

              which I believe, don't nail me on it asI haven't tried it yet :D, would take care of that for you. I think those infos are stored in the info.plist file, but I'm unsure about the exact key.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              0

              1/6

              29 Jun 2021, 09:51

              • Login

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