Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickView not active before being clicked once
Forum Updated to NodeBB v4.3 + New Features

QQuickView not active before being clicked once

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 2 Posters 2.4k Views 1 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
    prtel
    wrote on last edited by
    #1

    Hi
    I have a QSystemTrayIcon based TrayIcon app with a QQuickView object (its source is a QML file) built in main() function.
    By clicking in the notification message at tray icon when it appears the view is shown, but I have to click the view once somewhere, and on second click its elements (buttons) work as expected. I mean, mouse click on a button inside the view does not trigger button actions if I haven't previously clicked on some other place in the view.

    If I launch the window directly from main(), buttons perfectly work , but not when is shown from the slot associated with the tray icon notification. I´ve tried several changes both in QML ( focus:true, FocusScope...) and C++ ( pView->requestActivate( ) ) but nothing works.

    Do you know why ?
    Thank you

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Can you try setting focus using setFocus for the root item (i.e QQuickItem) ?

      157

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

        Works.How easy it was!
        I was setting focus in a root inner element.
        Thank you

        1 Reply Last reply
        0
        • P Offline
          P Offline
          prtel
          wrote on last edited by
          #4

          Upsss....
          Does not work...Only works if window is previously maximize. Somehow, maximize operations set focus on it before show() .If I show window no maximized, still fails

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            So if the window is shown maximized then no need to click to activate it ?

            157

            1 Reply Last reply
            0
            • P Offline
              P Offline
              prtel
              wrote on last edited by
              #6

              Yes, that it is. Quite logical, if a widow is maximized, it must have focus.

              1 Reply Last reply
              0
              • p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #7

                Not sure but did you try raise() ?

                157

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  prtel
                  wrote on last edited by
                  #8

                  No, raise() does not help.
                  I´ve tried lots of things on QQuickItem , setFocus, forceActiveFocus, setAcceptedMouseButtons...and even sending MouseButtonPress/Release events. But nothing works...
                  Thans for your help.

                  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