当前位置: 代码迷 >> QT开发 >> QLineEdit如何设置靠右显示
  详细解决方案

QLineEdit如何设置靠右显示

热度:26   发布时间:2016-04-25 04:04:27.0
QLineEdit怎么设置靠右显示
在lineEdit框中怎么靠右显示啊?

------解决方案--------------------
方法:
setAlignment(Qt::AlignRight);



其实文档上都有说的,这种问题差文档最好不过了:
void setAlignment ( Qt::Alignment flag )
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.