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. How to put a QMainWindow on the top of the screen in Android?
Forum Update on Monday, May 27th 2025

How to put a QMainWindow on the top of the screen in Android?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 239 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.
  • D Offline
    D Offline
    Daniel Rush
    wrote on 25 Nov 2024, 08:26 last edited by
    #1

    Hi,

    I tried two methods to put QMainWindow on the top of the screen as follows, None of them work.

    1. I'm use Qt::WindowStaysOnTopHint not work in Qt Android. Do you have any good ideas?
    2. I'm tring to add the java code in onCreate of AppCompatActivity
      setContentView(R.layout.dream); - how to use Qt app layout?

    Thanks for your help.
    Daniel

    J 1 Reply Last reply 25 Nov 2024, 08:28
    0
    • D Daniel Rush
      25 Nov 2024, 08:26

      Hi,

      I tried two methods to put QMainWindow on the top of the screen as follows, None of them work.

      1. I'm use Qt::WindowStaysOnTopHint not work in Qt Android. Do you have any good ideas?
      2. I'm tring to add the java code in onCreate of AppCompatActivity
        setContentView(R.layout.dream); - how to use Qt app layout?

      Thanks for your help.
      Daniel

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 25 Nov 2024, 08:28 last edited by
      #2

      @Daniel-Rush It is not clear what you want to achieve. The application is automatically on the top of the screen when you start it. Or do you want the app to always stay on top even if other apps are started. If so I don't think it is possible on mobile platforms.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Daniel Rush
        wrote on 25 Nov 2024, 08:42 last edited by
        #3

        Hi, jsulm,

        Thanks for your reply.

        Yeap, I want the app to always stay on top.
        Because the Android system have a Activate Window always on the top of the screen.
        My program app must be in front of the Activate Window. And I must.
        I implemented a demo in Android Studio by using TYPE_SYSTEM_ALERT to on the top.
        But my full program is implemented using Qt.

        Need your advice.
        Daniel

        1 Reply Last reply
        0

        1/3

        25 Nov 2024, 08:26

        • Login

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