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 get QListWidget with focus ?

How to get QListWidget with focus ?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.1k 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.
  • S Offline
    S Offline
    SeedOfLife
    wrote on 23 Apr 2014, 09:01 last edited by
    #1

    Hi,

    The application that I am developing is based on a tabbed collection of pages. All tab pages are instances of a single widget. In such a widget there are 2 list widgets.

    The problem is that when I select between pages the selection within these list widgets are retained, along with the highlighted items (that is the last selection that was done). How can I get which list widget out of the two has a selected (highligted) item ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stevenceuppens
      wrote on 23 Apr 2014, 10:18 last edited by
      #2

      Hi,

      This what you mean?

      @QList<QListWidgetItem *> QListWidget::selectedItems() const@

      Steven CEUPPENS
      Developer &#x2F; Architect
      Mobile: +32 479 65 93 10

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SeedOfLife
        wrote on 23 Apr 2014, 11:32 last edited by
        #3

        No, there are two list widgets on a tab page. When page is selected, one of the list widgets has a highlighted item. User's think that this highlighted item is what has focus, but it is not so (QApplication::focusWidget() does not return either of the 2 list widgets as having focus).

        How do I know which of the 2 list items on the selected page has a highlighted item ? Both return their selected items. Yet only one has a highlighted item.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stevenceuppens
          wrote on 23 Apr 2014, 12:15 last edited by
          #4

          and what if your combine?

          @
          bool QListWidget::hasFocus() const
          QList<QListWidgetItem *> QListWidget::selectedItems() const
          @

          Steven CEUPPENS
          Developer &#x2F; Architect
          Mobile: +32 479 65 93 10

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zeljko
            wrote on 23 Apr 2014, 18:17 last edited by
            #5

            Maybe you should check focus against QListWidget viewport widget.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zeljko
              wrote on 23 Apr 2014, 18:22 last edited by
              #6

              ah, thought that you're about QListWidget focus check :)

              1 Reply Last reply
              0

              5/6

              23 Apr 2014, 18:17

              • Login

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