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 540 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 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.HilkJ 1 Reply Last reply
    0
    • O ondrejandrej

      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.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on 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 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.HilkJ 1 Reply Last reply
        0
        • O ondrejandrej

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

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on 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 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.HilkJ 1 Reply Last reply
            0
            • O ondrejandrej

              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.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on 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

              • Login

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