ListWidget with a lot of items
-
Picture: https://ibb.co/Hp4XCjT
Hello, I want to implement the thing that I will add a picture of in Qt. There are some things to consider here. First, there could be almost 300 games. The second thing is that when a game is hovered over, the card of the game should enlarge, and buttons with information about the game should appear below and these buttons should be clickable.I am thinking of doing this with QListWidget and a custom delegate, but I have not been very successful, maybe there is an easier and better way, I would also like to learn that from you. Thank you.
-
Given the choice, I would implement this in QML rather than with QListView.
ListView { orientation: ListView.Horizontal delegate: MouseArea { id: mouseArea width: containsMouse? 100 : 50 height: containsMouse ? 100 : 50 hoverEnabled: true Image { anchors.fill: parent } Button { anchors.bottom: parent.bottom visible: mouseArea.containsMouse } } }
300 items in the list should not be a problem with adequate hardware. The view will manage creating and destroying delegate instances as necessary.
-
QListWidget is QListView with a built-in model roughly equivalent to QStandardItemModel. I try to avoid the Q*Widget views because deeper control of the model is useful for my tasks. Much of the time, they work just as well for models without a more efficient representation or lifetime that doesn't match the view.
Is the decision to not use QML due to Qt widget use elsewhere in the project, lack of familiarity, concerns about performance, or something else? Guessing that lots of other people have attempted to implement this UI with QML, I did a search and found https://github.com/driskiou/netflix-clone
I have not watched the YouTube video linked in the project description. The claim of 3 hours of development time does not sound unreasonable.Widgets are great for creating a desktop application that looks like other desktop applications, particularly in the era that the widgets were created. That doesn't match the screen shot in the first post. It can be done, but it means writing the delegate from scratch. Perhaps if the nature of
not [...] very successful
is explained (including code), someone can provide some tips.