Advice on Twitter like interface
-
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
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
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
-
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.
-
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.
@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
-
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.
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 QLabelin this another thread, I am adding images, media to the feed, and it also uses a QLabel for that
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. "
-
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.
@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/53105343/is-it-possible-to-add-a-custom-widget-into-a-qlistview
-
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.
-
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.
@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