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. Advice on Twitter like interface
Forum Updated to NodeBB v4.3 + New Features

Advice on Twitter like interface

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 452 Views 2 Watching
  • 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.
  • P Offline
    P Offline
    Pedro Vicente
    wrote on last edited by
    #1

    Thread

    I am implementing a Twitter like interface.

    Repository

    https://github.com/pedro-vicente/twitter_qt

    These 2 screenshots show the current implementation

    This is the "main feed" for a user, in this example user "Alice" , that posted 3 tweets, 1 of them with 2 responses

    Untitled.png

    The goal of the interface is to simulate the (real) Twitter interface.

    When we click on a tweet on the main feed, the main feed disappears and this tweet occupies a new feed, with the responses of the tweet

    this is what happens here

    Untitled1.png

    to help illustrate, responses are in green color, the selected tweet from the main feed is in red

    In the following posts I will be asking for suggestions regarding the best way to implement this behavior

    thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Don't use widgets and layouts. You are going to generate too many widgets quickly.

      Take a look at the model view paradigm. Create a model that will contain the timeline content, then a view to show them.

      You might want to check Qt Quick as well.

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

      P 3 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

        Don't use widgets and layouts. You are going to generate too many widgets quickly.

        Take a look at the model view paradigm. Create a model that will contain the timeline content, then a view to show them.

        You might want to check Qt Quick as well.

        P Offline
        P Offline
        Pedro Vicente
        wrote on last edited by
        #3

        @SGaist said in Advice on Twitter like interface:

        model view

        I was thinking of using the model view, but at a later stage, I started with the most simple case

        https://doc.qt.io/qt-6/model-view-programming.html

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Don't use widgets and layouts. You are going to generate too many widgets quickly.

          Take a look at the model view paradigm. Create a model that will contain the timeline content, then a view to show them.

          You might want to check Qt Quick as well.

          P Offline
          P Offline
          Pedro Vicente
          wrote on last edited by Pedro Vicente
          #4

          @SGaist

          Basically I am displaying items in a list ( each item is a "feed widget")
          In this simple repo, it only shows text strings,
          so I am using a QLabel

          in this another thread, I am adding images, media to the feed, and it also uses a QLabel for that

          https://forum.qt.io/topic/155780/qvideowidget-not-showing-on-qvboxlayout-with-qscrollarea?_=1712954221200

          Do you have any suggestion on which container should I use for this "feed widget" in the model view? Or can I use QLabel ?

          I also need a scroll bar.

          Another option is
          QListWidget ( a " item-based list widget" )

          https://doc.qt.io/qt-6/qlistwidget.html

          or

          QListView
          that seems to use the model view, but by the description, it looks it was meant to display simple things like icons

          "items stored in a model, either as a simple non-hierarchical list, or as a collection of icons. "

          https://doc.qt.io/qt-6/qlistview.html

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Don't use widgets and layouts. You are going to generate too many widgets quickly.

            Take a look at the model view paradigm. Create a model that will contain the timeline content, then a view to show them.

            You might want to check Qt Quick as well.

            P Offline
            P Offline
            Pedro Vicente
            wrote on last edited by
            #5

            @SGaist After reading about the models, it seems they are best for very large amounts of data, and it seems they require custom rendering (like Paint) (could be wrong on this) , but my case, I plan to show not many items at once , so probably without model will be ok for now and going for a QListWidget

            https://stackoverflow.com/questions/45389540/how-to-display-a-scrollable-list-with-a-substantial-amount-of-widgets-as-items-i

            https://stackoverflow.com/questions/53105343/is-it-possible-to-add-a-custom-widget-into-a-qlistview

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Friendly advice: become friend with QStyledItemDelegate. It's going to be worth it in the long run.

              Doing the painting yourself might seem complex at first but you'll learn useful skills doing that.

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

              P 1 Reply Last reply
              0
              • SGaistS SGaist

                Friendly advice: become friend with QStyledItemDelegate. It's going to be worth it in the long run.

                Doing the painting yourself might seem complex at first but you'll learn useful skills doing that.

                P Offline
                P Offline
                Pedro Vicente
                wrote on last edited by
                #7

                @SGaist Roger that 🫡

                One of the things that I want to use heavily are emojis, glad that Qt seems to render all of them just fine in QString

                https://emojipedia.org/saluting-face

                https://stackoverflow.com/questions/41617473/qt-application-shows-emoji-instead-of-unicode-character

                1 Reply Last reply
                0

                • Login

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