Solved ListWidget Text size fixed
-
@Prince_0912 Both links are not useful for me. they all are discussing the font size and I am asking about the text size managing
-
@amarism ,
You can try like this in your code,
setSizeHint(QSize((listWidget->width()),((listWidget->height())))); -
@Prince_0912
I don't know whether your code does what the OP wants, nor what widget you are callingsetSizeHint()
on, but it won't be right to be usingQListWidget::height()
in particular, if anything it will need to beQListWidgetItem::height()
. -
-
@Prince_0912
In that link the example is:QListWidgetItem->setSizeHint(QSize((listWidget->width()),(listWidget->height()/4)));
which is quite different because it divides the list widget's height by 4 to fit 4
QListWidgetItem
s vertically. If the OP uses your suggestion, it won't come out anything like he is asking for. Up to you & him. -
@JonB When I use this code it will convert the whole height into 4 part. But I need to just break the text whose extra than image and print just below the main original text.
For Example, my extra text size is this and I want to cut the red part text and print below the text. -
@amarism If I undesrand you correctly you need ward wrapping. I#M not sure QListWidget supports it, maybe you can do it via styles?
-
-
@VRonin
In that doc it states:Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode.
I wonder whether it will expand vertically given that statement?
-
@JonB said in ListWidget Text size fixed:
I wonder whether it will expand vertically given that statement?
Indeed it won't that's the job of the delegate's
sizeHint
method -
@JonB Wrapping is work for me. Thank you