The QLCDNumber widget displays a number with LCD-like digits.It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to connect to data sources using the display() slot, which is overloaded to take any of five argument types.
其实与QLabel类差不多,都是显示数字文本字符串等信息。
主要函数功能如下:
1 显示和设置数字位数:int digitCount() const: void setDigitCount(int numDigis)
2 显示和设置小数点:bool smallDecimalPoint() void setSmallDecimalPoint(bool) 当bool位真时,小数点在两个数之间,当位false时,小数点占一个数据位。
3 显示和设置模式:我们可以设置十进制, 十六进制,8进制,2进制格式, Mode mode() const; void setMode(Mode)
4 显示和设置控件风格, enum QLCDNumber:SegmentStyle { Outline, Filled, Flat}
SegmentStyle segmentSyle() const; void setSegmentStyle(SegmentStyle)
5 显示数字字符函数: void display(const QStirng &s) ; void display(int );void display(double); double value()
6 显示是否溢出, bool checkOverflow(int num) ;bool checkOverflow(double num)
7 信号函数: 当溢出时,会发出overflow()信号
QT学习之QLCDNumber类
最新推荐文章于 2024-08-20 20:30:00 发布