问题描述
我正在构建一个 Windows 程序,该程序应具有 64 位数值的控件.这些控件应可切换为签名或未签名.
I'm building a windows program which shall have controls for 64bit numeric values. these controls shall be switchable to be signed or unsigned.
我找到了两个控件:旋转框"(int32) 和双旋转框"(double)使用 double 我可以覆盖范围,但无法处理精度.
I found two controls:"Spin Box"(int32) and "Double Spin Box"(double)with double I'd be able to cover the range but it can't handle the precision.
有没有办法改变这些控件的数据类型?
Is there a way to change the data type of these controls?
是否可以创建一个自己的控件来处理有符号和无符号的 64 位值?是否可以创建一个 128 位的 Spin box?
Is it possible to create an own control which can handle signed and unsigned 64bit values?Is it possible to create a 128bit Spin box?
我现在能看到的唯一解决方法是使用字符串控件并手动转换为 INT64 或 UINT64,但我对这个解决方案不是很满意
The only work around I can see right now is in using a string control and manually convert to an INT64 or UINT64 but I'm not very happy with this solution
还有其他想法吗?
我在使用 C++ 的 QT 4.7.4 和 VS2010谢谢
I'm on QT 4.7.4 and VS2010 with C++thx
推荐答案
您可以派生 QAbstractSpinBox
并至少重新实现虚函数 stepBy
, stepEnabled
和可能的 validate()
和 fixup()
用于输入验证.
You can derive QAbstractSpinBox
and reimplement at least the virtual functions stepBy
, stepEnabled
and possibly validate()
and fixup()
for the input validation.
这篇关于QT 中的 64 位 int Spin Box的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!