How to make a comment bar in Qt?
-
I want make a comment bar where every review comes from the database. My idea is that i use Model/View to make it, Every review will be put in a view item.But i don't kow how to make each view item to adapt its height according to the number of review. Would anyone like to help me with the answer?
-
Hi
Im not sure how a comment bar looks like but
cant you just adjust each row's height ? -
@mrjj I can adjust ervery item's height in QTreeView, but ervery item can't switch row automatically. this is my project.
-
@Wgxzzzzzzc said in How to make a comment bar in Qt?:
- item can't switch row automatically
Im not sure what you mean ?
You mean if text is very long then it wont word break within the cell or what do you mean with
switch row ? -
So it's a simple QTextEdit?
-
@Wgxzzzzzzc
Hi
No problem with the English. i just ask a bit more to make sure i understand.Did you try to call view->resizeRowsToContents();
to have it expand the row ? It should do wordwrap by default. -
@Wgxzzzzzzc
Ah sorry its a treeView. I read table :)try
ui->mytreeview->header()->resizeSections(QHeaderView::ResizeToContents); -
@mrjj I think using QListWidget and customizing my item is a good way. but still thank you very much!