PDA

View Full Version : QT Creator Spin Box for hex values



JJ31069
20th April 2009, 18:19
I am new to C++ and QT. I am using QT Creator 1.0.0 to create a GUI. I have a hex value I need to lookup and display to the user and allow the user to change that value.

Basically, I am looking for the Microsoft Visual Studio NumericUpDown Hexadecimal properties equivelant in QT.

Ginsengelf
21st April 2009, 06:53
Hi, you can subclass QSpinBox and show your hex value with it.

Ginsengelf

jpn
21st April 2009, 09:41
See QxtBaseSpinBox (http://doc.libqxt.org/0.4.0/classQxtBaseSpinBox.html).

JJ31069
21st April 2009, 15:07
Thank you for your reply.

I do not see this property in the QT Creator Property table. Can it be set from QT Creator. As I mentioned, I am new to C++ and QT, so QT Creator is the simplest and fastest solution for me.

jpn
21st April 2009, 15:25
Don't expect to find any simple property in Qt Creator for this. Ginsengelf suggested that you subclass QSpinBox and reimplement textFromValue() and valueFromText() to show hexadecimal values. I pointed out that such class already exists in Qxt - an extension library for Qt (it is not part of Qt, but a separate community driven amateur project to provide most often requested features that are missing from Qt).

fnmblot
22nd April 2009, 14:15
There is an example of a Hex Spinbox in the C++ GUI Programming with Qt 4 book. Google has these pages here. (http://books.google.com/books?id=tSCR_4LH2KsC&pg=PA101&lpg=PA101&dq=qt+hex+spin&source=bl&ots=E6YWlP4byd&sig=i4bhS7bg2b8W3oaUN8fF740gpVE&hl=en&ei=ohfvSc_HBKK0NfqNiAU&sa=X&oi=book_result&ct=result&resnum=1#PPA103,M1)

JJ31069
30th April 2009, 14:06
Thanks for the information. I am new to C++ and OOP programming in general, so I am somewhat reliant on Qt Creator.

Is there a way to "promote" a spinbox on the toolbar in Qt Creator or to add a new hex spinbox widget to the toolbar in Qt Creator?