PDA

View Full Version : Custom DoubleSpinBox needed



jack249
13th June 2012, 05:12
I would like to have a Custom SpinBox which could able to increase/decrese the value based on the current cursor.
I know there might be some confusing on the statement above, I will show an example:

The spinbox is showing : 1.234
When i click on the point before number "3", the cursor is blinking infront of number "3".
After that, when I click on the up button on the SpinBox, the SpinBox value will show: 1.244.
For the same theory, when my pointer is infront of number "1", when i click button up, the value of SpinBox will become : 2.244.

This similar functionality is available in the DateTimeEdit, but the DateTimeEdit cannot change the display format from DateTime format to pure Number Format (correct me if i'm wrong in this view). And I could not get the source code of DateTimeEdit to understand how it work.

So, do any can help me to get the SpinBox with such functionality (either modify from QSpinBox or QDateTimeEdit)?

ChrisW67
13th June 2012, 06:26
And I could not get the source code of DateTimeEdit to understand how it work.
Assuming you mean QDateTimeEdit then the entire source to Qt is available for download here (http://qt-project.org/downloads#qt-lib) or you can browse the relevant files here (http://qt.gitorious.org/qt/qt/blobs/4.8/src/gui/widgets/):

http://qt.gitorious.org/qt/qt/blobs/4.8/src/gui/widgets/qdatetimeedit.h
http://qt.gitorious.org/qt/qt/blobs/4.8/src/gui/widgets/qdatetimeedit.cpp
http://qt.gitorious.org/qt/qt/blobs/4.8/src/gui/widgets/qdatetimeedit_p.h