Chracter wrapping in label widget



  • Hi ,
    Here as per given i have done wordwrapping by using wordwrap method.but der is not charwrap method for lablel and some of widgets except textedit.so please anyone give me idea how can fix this one .i have gone through diff options but its yet to get the result..

    Thanks
    sk



  • QLabel does have "a word wrap property":http://doc.qt.nokia.com/4.6/qlabel.html#wordWrap-prop.

    For anything else you will need to be more specific.



  • Thanks for reply.yes as per specific,here i need character wrapping not word wrapping .so for that what need to do?



  • there is no ready api available for character wrapping in a label. whereas QTextEdit supports this feature by wrapping on a fixed column width. Depending on your use case, you can use a disabled QTextEdit styled to look how you want and fake it as a label (of course no pixmaps by default)

    Else you can extend QLabel and build this capability in your custom label



  • To continue on the idea of chetankjain, a QTextEdit holds a QTextDocument and that one can have its wrapping mode set to much more complicated modes than a QLabel. One of them is QTextOption::WrapAnywhere which seems to be what you want.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.