• 6508阅读
  • 2回复

QLabel 自動換行 [复制链接]

上一主题 下一主题
离线xy4301109
 
只看楼主 倒序阅读 楼主  发表于: 2009-08-19
建立一個  QLabel  
我會將 一個很長的字串(abcdefghijklmnopqrstuvwxyz)
以變數方式  (字串內容會隨時改變 )  放入 QLabel 內

所以希望  需要  自動換行

請問 我該如何  做  ???????????????謝謝
离线guoyun_he

只看该作者 1楼 发表于: 2009-08-19
Qt::AlignmentFlags
This enum type is used to describe alignment. It contains four sets of flags: Horizontal, vertical and modifying flags. The horizontal flags are:
AlignLeft - Align with the left edge.
AlignRight - Align with the right edge.
AlignHCenter - Center horizontally in the available space.

The vertical flags are:
AlignTop - Align with the top.
AlignBottom - Align with the bottom.
AlignVCenter - Center vertically in the available space.

You can only use one of the horizontal flags at a time. There is one two-dimensional flag:
AlignCenter - Center in both dimensions.

This counts both as a horizontal and vertical flag: It cannot be combined with any other horizontal or vertical flags.
There are also some modifier flags. All of them apply only to printing:

SingleLine - Treat all white-space as space and print just one line.
DontClip - If it's impossible to stay within the given bounds, print outside.
ExpandTabs - Make the U+0009 (ascii tab) character move to the next tab stop.
ShowPrefix - Display the string "&P" as an underlined P (see QButton for an example). To get an ampersand, use "&&".
WordBreak - Do line breaking at at appropriate points.

You can only use one of the horizontal flags at a time, and one of the vertical flags. AlignCenter counts as both horizontal and vertical. You can use as many modifier flags as you want, except that SingleLine and WordBreak cannot be combined.
离线xy4301109
只看该作者 2楼 发表于: 2009-08-19
還是 不太懂  
有簡單的 例子 可以 表現出來嗎???
謝謝
快速回复
限100 字节
 
上一个 下一个