Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to select one widget in multipled widgets layout?
Forum Updated to NodeBB v4.3 + New Features

How to select one widget in multipled widgets layout?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.0k 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.
  • K Offline
    K Offline
    KangRoger
    wrote on last edited by
    #1

    !http://i46.tinypic.com/v6ntj4.png(Picture)!
    I put 3 widgets in the layout . I want to select one , then use the toolbar to operate on the selected one .

    I am new to Qt , if anybody can help me?
    Thank you!

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Wilk
      wrote on last edited by
      #2

      Hello.
      I guess you may try method hasFocus or something like this to find out, which widget is selected.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        noregister
        wrote on last edited by
        #3

        enum "the 3 widgets in the layout"

        use hasFocus to check which one

        bool "hasFocus":http://qt-project.org/doc/qt-4.8/qwidget.html#focus-prop () const

        bool hasEditFocus () const

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KangRoger
          wrote on last edited by
          #4

          thank you.
          If I select the widget,i want to highlight it to let the user he has selected it.
          I have tried setFocus and hasFocus,but it doesn't work.

          [quote author="noregister" date="1340257665"]
          enum "the 3 widgets in the layout"

          use hasFocus to check which one

          bool "hasFocus":http://qt-project.org/doc/qt-4.8/qwidget.html#focus-prop () const

          bool hasEditFocus () const

          [/quote]

          1 Reply Last reply
          0
          • K Offline
            K Offline
            KangRoger
            wrote on last edited by
            #5

            thank you.
            If I select the widget,i want to highlight it to let the user he has selected it.
            I have tried setFocus and hasFocus,but it doesn't work.

            [quote author="Wilk" date="1340248674"]Hello.
            I guess you may try method hasFocus or something like this to find out, which widget is selected.[/quote]

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              Hi, highlighting must be done by you.
              So, which types of widget do you use? Custom ones? Then just change the background color in focusInEvent and focusOutEvent.

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              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