Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QListWidget expand height dynamically
QtWS25 Last Chance

QListWidget expand height dynamically

Scheduled Pinned Locked Moved Unsolved Qt for Python
pythonqt for python
4 Posts 2 Posters 840 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.
  • E Offline
    E Offline
    Emrecp
    wrote on 5 Aug 2023, 12:13 last edited by
    #1

    Hello, I want to make the design below in qt. I have a few questions.
    1-min.png
    1. question
    In this design, the mouse can be scrolled and scrolled down almost infinitely. I want to do this too but if I use QListWidget for the list in category "All Games" this qlistwidget doesn't expand. (Picture 2) (Scrollbar is visible in the bottom qlistwidget, it should not be visible and the height of the qlistwidget should expand dynamically )
    iamge2-min.png

    If I prefer QHBoxlayout instead of QListWidget I can get the look I want, but I want to use qlistwidget for ease of use.

    Code for QListWidget:

    item = QListWidgetItem()
    kart_oyun = GameWidget(mydata, item=item, liste=self.ui.listGames) # my custom widget
    item.setSizeHint(kart_oyun.size())
    myqlistwidget.addItem(item)
    myqlistwidget.setItemWidget(item, kart_oyun)
    

    Code for layout:

    kart_oyun = GameWidget(mydata, item=item, liste=self.ui.listGames) # my custom widget
    self.layGames.addWidget(kart_oyun)
    

    2. question
    I added animation when hovering over my custom widget (card) and the card expands, but sometimes when it doesn't fit, it goes to the bottom line and becomes unreadable (video is also clearer)

    VIDEO: STREAMABLE

    S 1 Reply Last reply 5 Aug 2023, 20:47
    0
    • S SGaist referenced this topic on 5 Aug 2023, 19:39
    • E Emrecp
      5 Aug 2023, 12:13

      Hello, I want to make the design below in qt. I have a few questions.
      1-min.png
      1. question
      In this design, the mouse can be scrolled and scrolled down almost infinitely. I want to do this too but if I use QListWidget for the list in category "All Games" this qlistwidget doesn't expand. (Picture 2) (Scrollbar is visible in the bottom qlistwidget, it should not be visible and the height of the qlistwidget should expand dynamically )
      iamge2-min.png

      If I prefer QHBoxlayout instead of QListWidget I can get the look I want, but I want to use qlistwidget for ease of use.

      Code for QListWidget:

      item = QListWidgetItem()
      kart_oyun = GameWidget(mydata, item=item, liste=self.ui.listGames) # my custom widget
      item.setSizeHint(kart_oyun.size())
      myqlistwidget.addItem(item)
      myqlistwidget.setItemWidget(item, kart_oyun)
      

      Code for layout:

      kart_oyun = GameWidget(mydata, item=item, liste=self.ui.listGames) # my custom widget
      self.layGames.addWidget(kart_oyun)
      

      2. question
      I added animation when hovering over my custom widget (card) and the card expands, but sometimes when it doesn't fit, it goes to the bottom line and becomes unreadable (video is also clearer)

      VIDEO: STREAMABLE

      S Offline
      S Offline
      StarterKit
      wrote on 5 Aug 2023, 20:47 last edited by
      #2

      @Emrecp, about your first question - I think it isn't about QListWidget itself but more about about data model underneath it. Probably fetchMore() and canFetchMore() methods of QAbstractItemModel are what you are looking for.

      E 1 Reply Last reply 6 Aug 2023, 17:17
      0
      • S StarterKit
        5 Aug 2023, 20:47

        @Emrecp, about your first question - I think it isn't about QListWidget itself but more about about data model underneath it. Probably fetchMore() and canFetchMore() methods of QAbstractItemModel are what you are looking for.

        E Offline
        E Offline
        Emrecp
        wrote on 6 Aug 2023, 17:17 last edited by
        #3

        @StarterKit First of all thank you very much for your reply. Can you write a short sample code?

        S 1 Reply Last reply 7 Aug 2023, 09:24
        0
        • E Emrecp
          6 Aug 2023, 17:17

          @StarterKit First of all thank you very much for your reply. Can you write a short sample code?

          S Offline
          S Offline
          StarterKit
          wrote on 7 Aug 2023, 09:24 last edited by
          #4

          @Emrecp, I don't think my code would be any better then "an official one".
          So I would propose you to review a Fetch More Example

          1 Reply Last reply
          0

          2/4

          5 Aug 2023, 20:47

          • Login

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