QT中的64位int自旋盒 [英] 64bit int Spin Box in QT

查看:142
本文介绍了QT中的64位int自旋盒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个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.

我发现了两个控件:
Spin Box(int32)和 Double Spin Box(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框吗?

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
thx

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自旋盒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆