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. Resize a QListWidgetItem with a custom QAbstractItemDelegate when it's clicked

Resize a QListWidgetItem with a custom QAbstractItemDelegate when it's clicked

Scheduled Pinned Locked Moved General and Desktop
resizeqlistwidgetitemqabstractitemdeqt 5.4.1
4 Posts 2 Posters 1.8k 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
    DaMaxx
    wrote on 30 Mar 2015, 17:11 last edited by
    #1

    Hello people,

    I created a custom delegate for my QListWidgetItems and it's working how it should be. But I'm looking for some additional tweaks on my code.

    Within the paint method of my custom delegate I was able to create a different style when the item is clicked within the QListWidget, but I want the whole item within the list to become "bigger", making me able to place a little QLineEdit and a QPushButton at the bottom of the item withing the list.

    I tried to put some if-statements within the sizeHint method of the delegation, but QStyleOptionViewItem seems to be unset when it's called by the program. I looked into the documentation but I've seen that there isn't even a "clicked()" signal. Is there a way to do it anyway, or is my solution just going in the wrong direction? I've also seen that I'm able to implement my own signals.

    So I guess I have to implement the clicked() signal into my delegation to call a function which would resize my item and add the additional content? Maybe someone with the same problem could provide me some code.

    I'm pretty new to Qt but so far very satisfied and I hope an more experienced Qt-user might be able to help me.

    Greetings

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 30 Mar 2015, 21:28 last edited by
      #2

      Hi and welcome to devnet,

      Do you mean you want the QLineEdit and QPushButton visible also when only selecting an item ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply 1 Apr 2015, 06:39
      0
      • S SGaist
        30 Mar 2015, 21:28

        Hi and welcome to devnet,

        Do you mean you want the QLineEdit and QPushButton visible also when only selecting an item ?

        D Offline
        D Offline
        DaMaxx
        wrote on 1 Apr 2015, 06:39 last edited by DaMaxx 4 Jan 2015, 13:52
        #3

        @SGaist Yes, and I want the element within the list to become slightly bigger to show the additional information.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 1 Apr 2015, 23:12 last edited by
          #4

          Then you should also implement the sizeHint method of your delegate

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          3/4

          1 Apr 2015, 06:39

          • Login

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