qlabel怎么设置文本换行对齐
1个回答
展开全部
调用QLabel的成员函数setAlignment ( Qt::Alignment ),举例:
QLabel * label = new QLabel("Hello!");
label->setAlignment(Qt::AlignRight | Qt::AlignBottom);
Qt::Aligment列表如下:
The horizontal flags are:
Constant Value Description
Qt::AlignLeft 0x0001 Aligns with the left edge.
Qt::AlignRight 0x0002 Aligns with the right edge.
Qt::AlignHCenter 0x0004 Centers horizontally in the available space.
Qt::AlignJustify 0x0008 Justifies the text in the available space.
The vertical flags are:
Constant Value Description
Qt::AlignTop 0x0020 Aligns with the top.
Qt::AlignBottom 0x0040 Aligns with the bottom.
Qt::AlignVCenter 0x0080 Centers vertically in the available space.
You can use only one of the horizontal flags at a time. There is one two-dimensional flag:
Constant Value Description
Qt::AlignCenter AlignVCenter | AlignHCenter Centers in both dimensions.
QLabel * label = new QLabel("Hello!");
label->setAlignment(Qt::AlignRight | Qt::AlignBottom);
Qt::Aligment列表如下:
The horizontal flags are:
Constant Value Description
Qt::AlignLeft 0x0001 Aligns with the left edge.
Qt::AlignRight 0x0002 Aligns with the right edge.
Qt::AlignHCenter 0x0004 Centers horizontally in the available space.
Qt::AlignJustify 0x0008 Justifies the text in the available space.
The vertical flags are:
Constant Value Description
Qt::AlignTop 0x0020 Aligns with the top.
Qt::AlignBottom 0x0040 Aligns with the bottom.
Qt::AlignVCenter 0x0080 Centers vertically in the available space.
You can use only one of the horizontal flags at a time. There is one two-dimensional flag:
Constant Value Description
Qt::AlignCenter AlignVCenter | AlignHCenter Centers in both dimensions.
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询