PDA

View Full Version : QScrollBar with quint64 value



ArkKup
17th January 2015, 15:17
I need to implement a QScrollBar control which should be able to process quint64 values as it's minimum & maximum values.
I should probably subclass QAbstractSlider but I'm not sure how to do it exactly. Perhaps someone already did that and can give me some hints ? Thanks in advance!

wysota
17th January 2015, 19:27
QAbstractSlider already defines minimum and maximum with int type so that won't do. You either have to subclass QWidget and implement everything yourself or live with int-ranged scroll bars. Why do you say you need a 64b range scroll bar?

ArkKup
17th January 2015, 20:09
bummer :( its for a 64-bit process memory view\dump app so I was hoping to have the range selectable from 0x00000000`00010000 to 0x000007FF`FFFEFFFF (process user space range)

d_stranz
18th January 2015, 01:58
Ummm, you might want to rethink that choice of interaction.

Even if you did have a quint64 range with a scrollbar, it would be impossible to actually position it with any precision to a desired offset into process memory. Your window might be, say 1024 pixels high, and at best you can move the scrollbar a single pixel. That means at best you can divide your memory space down by a factor of 1024, and that still leaves a huge memory range per pixel. Then what? How do you focus in any more finely?

wysota
18th January 2015, 08:06
I think showing 2^64 items in your model is not possible anyway and is impractical. Maybe you should have two levels of the model -- top level presents "windows" or "memory pages" and lower level shows memory contents for that window/page.

ChrisW67
18th January 2015, 20:02
The QAbstractItemModel and QModelIndex row numbers are declared int which gives a 32-bit value on most, if not all, Qt platforms. Negative row numbers are invalid so the maximum row count in these models is 2^31. I guess you could have a multi-level tree model presenting 2^64 leaf nodes.

d_stranz
19th January 2015, 18:31
Seems sort of recursive to need all of process memory to build a model by which you can observe all of process memory.

Reminds me of the time my friend saw a trash truck crash into a tree outside his house. There wasn't much damage, but a piece of the fiberglass door had broken off and was lying in the street. The driver got out, looked at it, and then tossed it into the back of the trash truck. We wondered how long that process could continue, feeding bits of the trash truck to itself, before it no longer was a trash truck.