QT 之 QLineEdit 类 的常用函数
2014-05-10 21:14
826 查看
在这里定义了一个QLineEdit(行编辑器) 类的对象 如: (想要用其类的函数,首先定义一个这个类的对象)
QLineEdit *display=new QLineEdit("0");
(1).setText() 填写要显示的字符串
void setText(const QString &) 注意参数的写法 const QString &
(2).setMaxLength() 设置line edit可以显示的最长字符串的个数
void setMaxLength(int) (3).maxLength() int maxLength() const 这个属性保存的是文本的最大允许长度。
(4).text() 取出line edit中的字符串
(5).clear() 清空line edit中的字符串
(6).isReadOnly() 这个属性保存的行编辑是否为只读。(有is的都是查询的 返回值是true或者false)
bool isReadOnly() const
(7).setReadOnly() 是否设置line edit为只读
void setReadOnly(bool)
(8).setAlignment() 这个属性保存的行编辑的对齐方式。 水平和垂直对齐方式在这里都允许
void setAlignment(Qt::Alignment flag)
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. 从可以空间开始
(9).setFont()
void setFont(const QFont &) 设置行编辑器的字体。
在设置自己之前 首先有定义一个QFont类
QFont font ;
然后再去设置 font.setPointSize(font.pointSize() + 8);
QFont类使用来绘制文本的字体
相关文章推荐
- QT 之 QStackedWidget 类 及常用的函数
- QtGui.QComboBox控件常用函数
- Qt常用函数 记录(update erase repaint 的区别)
- Qt开发中字符串、字节数组和变量常用的一些函数总结
- QT中线程常用的类,和进程的部分函数
- Qt常用的部件及相关函数
- QT 之 QAction类 的常用的函数
- qt常用函数在PYQT中的使用方法
- QT常用控件之QTimer,QDialog,QLabel,QLineEdit,QProgressBar,QComboBox,QPushButton,QGridLayout
- QT常用的类和函数总结
- Qt开发中字符串、字节数组和变量常用的一些函数总结
- Qt入门之常用qt控件认知之QLineEdit
- Qt 常用类 (16)—— QLineEdit
- Qt中一些常用时间显示的函数调用示例
- Qt常用窗口操作函数
- Qt常用函数 记录
- QtGui.QComboBox控件常用函数
- Qt入门之常用qt控件认知之QLineEdit
- QT 之 布局常用函数
- Qt 常用类 (16)—— QLineEdit