How to limit header text word wrap ?
-
Hi,
I used the following line of code in my custom class (which is subclassed from QHeaderView) to implement word wrap in headers.
this->setDefaultAlignment(Qt::AlignCenter | static_cast<Qt::Alignment>(Qt::TextWordWrap));
It works, however I want to limit it (no more than 2 lines)
However, at some point it starts vertical clipping of the text and it looks ugly, like below: Is there any way to stop word wrap when there are 2 lines of text ?
Another possible solution may be start elide with multiple lines, and I tried it but elide and word wrap cancel each other. Is it possible to have elide middle with multiple lines ?
Thank you,
-
Hi,
I used the following line of code in my custom class (which is subclassed from QHeaderView) to implement word wrap in headers.
this->setDefaultAlignment(Qt::AlignCenter | static_cast<Qt::Alignment>(Qt::TextWordWrap));
It works, however I want to limit it (no more than 2 lines)
However, at some point it starts vertical clipping of the text and it looks ugly, like below: Is there any way to stop word wrap when there are 2 lines of text ?
Another possible solution may be start elide with multiple lines, and I tried it but elide and word wrap cancel each other. Is it possible to have elide middle with multiple lines ?
Thank you,
@mehmety888 said in How to limit header text word wrap ?:
Is it possible to have elide middle with multiple lines ?
Not as far as I know. How should the framework know where to wrap and where to elide?
-
@mehmety888 said in How to limit header text word wrap ?:
Is it possible to have elide middle with multiple lines ?
Not as far as I know. How should the framework know where to wrap and where to elide?
@kshegunov As I understood, wordwrap and elide mode cannot be used at the same time.
However, is it possible to limit wordwrap line size? For eample in my project, it is only wanted that there should be maximum 3 or 4 lines. However, if I continue to shrink the column it becomes 5 lines of header name. I wanted to limit it to 4
-
@kshegunov As I understood, wordwrap and elide mode cannot be used at the same time.
However, is it possible to limit wordwrap line size? For eample in my project, it is only wanted that there should be maximum 3 or 4 lines. However, if I continue to shrink the column it becomes 5 lines of header name. I wanted to limit it to 4
@DzCode said in How to limit header text word wrap ?:
However, is it possible to limit wordwrap line size? For eample in my project, it is only wanted that there should be maximum 3 or 4 lines. However, if I continue to shrink the column it becomes 5 lines of header name. I wanted to limit it to 4
Not as far as I know, but what about using eliding and setting the header's size instead? Give it two rows of vertical space and elide on the right, should work, I think.
-
@DzCode said in How to limit header text word wrap ?:
However, is it possible to limit wordwrap line size? For eample in my project, it is only wanted that there should be maximum 3 or 4 lines. However, if I continue to shrink the column it becomes 5 lines of header name. I wanted to limit it to 4
Not as far as I know, but what about using eliding and setting the header's size instead? Give it two rows of vertical space and elide on the right, should work, I think.
@kshegunov It is very bad not to hve any feature to limit wordwrap size
-
@kshegunov It is very bad not to hve any feature to limit wordwrap size
@DzCode said in How to limit header text word wrap ?:
It is very bad not to hve any feature to limit wordwrap size
Feel free to provide a patch for it...