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. Android with qt widgets application error with pushbuttons

Android with qt widgets application error with pushbuttons

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 3 Posters 1.3k 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
    davidesalvetti
    wrote on 7 Feb 2019, 21:38 last edited by
    #1

    Hi,

    I need to develop an android app really fast and since I don't know well enough QML I'm trying to do it using c++ with Qt Widgets Application project.
    I simply make a dialog where there are some push buttons just to see if the ui is graphically nice for what I'm trying to do. Anyway when I click a push button it happens this:

    0_1549575076143_Cattura65.PNG

    the push button "indietro" behaviour is really annoying and it still remains until I click another button, but then the button clicked behaves like button "indietro" in the image above.

    What can I do about this problem? Can anyone help me?
    Thanks in advance.

    I'm using Qt Creator 4.7.2, Android for X86 (GCC 4.9 Qt 5.11.1).

    android kit config:
    SDK Version: 26.1.1
    NDK Version: 10.4.0

    Local Device: Nexus_5X_API_28

    J 1 Reply Last reply 7 Feb 2019, 22:02
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 7 Feb 2019, 21:48 last edited by
      #2

      Hi

      " behaviour is really annoying

      Im not really sure in what way :)
      Anyway, does it sort of stay down?
      Like a toggle?
      Or what is wrong with it?

      if yes to toogle, check if its
      "Checkable" property is on.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        davidesalvetti
        wrote on 7 Feb 2019, 22:00 last edited by
        #3

        You are right, I didn't make that clear :)

        so what I don't like is that when I press the QPushButton the background becomes light blue and that black outline appears. Moreover these two things stay there not just while I'm pressing the QPushButton, but also when I release the button, and they stay there until I click anothe button, but then they appear on the other button and so on.
        It's ok if the background becomes light blue while I'm pressing the button, but when I release it should go away and return at the initial state. And I'd also like to get rid of the black outline.

        I hope I was more clear now.

        1 Reply Last reply
        0
        • D davidesalvetti
          7 Feb 2019, 21:38

          Hi,

          I need to develop an android app really fast and since I don't know well enough QML I'm trying to do it using c++ with Qt Widgets Application project.
          I simply make a dialog where there are some push buttons just to see if the ui is graphically nice for what I'm trying to do. Anyway when I click a push button it happens this:

          0_1549575076143_Cattura65.PNG

          the push button "indietro" behaviour is really annoying and it still remains until I click another button, but then the button clicked behaves like button "indietro" in the image above.

          What can I do about this problem? Can anyone help me?
          Thanks in advance.

          I'm using Qt Creator 4.7.2, Android for X86 (GCC 4.9 Qt 5.11.1).

          android kit config:
          SDK Version: 26.1.1
          NDK Version: 10.4.0

          Local Device: Nexus_5X_API_28

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 7 Feb 2019, 22:02 last edited by
          #4

          @davidesalvetti
          I blieve you can takel that with the QStyleSheet

          QPushButton { outline: none; }
          

          should remove the focus rectangle


          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.

          D 1 Reply Last reply 7 Feb 2019, 22:07
          3
          • J J.Hilk
            7 Feb 2019, 22:02

            @davidesalvetti
            I blieve you can takel that with the QStyleSheet

            QPushButton { outline: none; }
            

            should remove the focus rectangle

            D Offline
            D Offline
            davidesalvetti
            wrote on 7 Feb 2019, 22:07 last edited by
            #5

            @J.Hilk Yes, it worked, thanks a lot.

            What about the background that remains also when I release the button? Do you have any hint?

            J 1 Reply Last reply 7 Feb 2019, 22:18
            0
            • D davidesalvetti
              7 Feb 2019, 22:07

              @J.Hilk Yes, it worked, thanks a lot.

              What about the background that remains also when I release the button? Do you have any hint?

              J Offline
              J Offline
              J.Hilk
              Moderators
              wrote on 7 Feb 2019, 22:18 last edited by
              #6

              @davidesalvetti
              äh, I think

              QPushButton:focus { background-color: green; }
              

              should get you on the right track. replace the background-color:green; with whatever the default normal behaviour is.

              I think there‘s a more elegant way, but I forgot.

              maybe

              connect(myButton, &QPushButton:clicked, myButton, &QPushButton:clearFocus);
              

              will also work.

              Can‘t test it right now, I‘m on my Tablet 🙈


              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
              3
              • D Offline
                D Offline
                davidesalvetti
                wrote on 7 Feb 2019, 22:35 last edited by
                #7

                @J.Hilk said in Android with qt widgets application error with pushbuttons:

                connect(myButton, &QPushButton:clicked, myButton, &QPushButton:clearFocus);

                It works perfectly, tested right now!
                Thanks a lot for your help, you solved all of my problems!

                1 Reply Last reply
                0

                1/7

                7 Feb 2019, 21:38

                • Login

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