Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Right approach to development of comlex UI



  • Right now I'm develop some Qt Widget application with talks to server and works with local devices. My app I need implement some list with messages with can have multiple text blocks, icons and some behavior (like reaction on hover, active buttons).
    I have struggle with selecting right technology for implementing this.
    As my app uses QWidgets I'd prefer us QListWidget with my widget as list item, because I know how to work with it. But as I know when there will be a lot of messages, it will become a problem, as it's inherited from QObject. Is it right? How many QObject childs can I create before it's become a problem? I see longscroll-qt library on github, can it solve that problem?

    I also looks at mvvm-approach and QListView with QAbstacrItems and QStyledItems, but I'm not sure, that item can be interactive outside editing (which I not need).
    My last think was make this part of UI in QGraphicsScene, it is most difficult solution but as I understand it can give we all I want from my list.

    So my question is what I should choose for this type of list?


  • Lifetime Qt Champion

    @Azska said in Right approach to development of comlex UI:

    How many QObject childs can I create before it's become a problem?

    How many elements is you list going to have?
    You should not present user too many many elements in lists as it is not really user friendly.



  • @jsulm

    How many elements is you list going to have?

    In regular use case it supposed to be about 50-100, but I believe there can be thousands of message in some cases.

    For better understanding what I try to achieve, you could remember any dialog UI in modern messenger app (Slack for example). That kind of UI is pretty close to my target.


  • Lifetime Qt Champion

    Hi
    A listView + a delegate would give the best performance.
    Since the delegate will only draw real widgets when in edit mode, the normal hover etc is
    not active. ( in non edit)
    However, its possible to add "interactions" via
    https://doc.qt.io/qt-5/qabstractitemdelegate.html#editorEvent
    but you would have to add a mini system for hit test and hover effects.

    Using real live widgets on top of ListWidget items becomes heavy at some point but on
    a desktop class pc with plenty of ram, it can be many.

    On a small board/phone on the other hand, its becomes too heavy very fast.

    You could have a look at telegram
    https://github.com/telegramdesktop/tdesktop
    Its written in Qt.

    That said.
    https://github.com/TripleWhy/longscroll-qt
    does look interresting. It says it uses real widgets so test it out. Could be useful.


Log in to reply