PDA

View Full Version : Two short questions about QWidgets



Computer Hater
21st July 2011, 06:10
Hi,
I've got two short questions that I couldn't find out how to do:

1.) Is there an edit widget for simply manually entering a numeric value, or do I have to use an indirect approach, such as using a QDoubleSpinBox and disabling the wheel or subclassing the QLineEdit to ignore non-numerical entries ?
Or is there a way to hide QDoubleSpinBox wheel ?

2.) Is there a way to directly set the size of a QList such as resize() in QVector ? I need a list/vector/array of elements and only need to size it once.

Thanks.

ChrisW67
21st July 2011, 07:43
1) You could use a QIntValidator or QDoubleValidator on a QLineEdit, or use the QLineEdit input mask directly.
2) QList::reserve() but this does not actually put "empty" elements in the list like sizing a std::vector will.

AlexSudnik
21st July 2011, 08:02
You can acess/control scrolling buttons state with a QAbstractSpinBox::buttonSymbols property and respective get/set methods.

Computer Hater
26th July 2011, 15:03
Thank you, guys !