[SOLVED] Set Scroll Per Item
I am trying to set the Scroll Mode to Scroll Per Item, as referenced here:
I am using a QScrollArea, and have tried setting the mode as follows:
@ QScrollArea *scrollArea = new QScrollArea (this);
scrollArea->viewport ()->setAutoFillBackground (false);
but I get a compiler error that QAbstractItemView is not a base of QScrollArea. I am pretty new to c++ and am unsure what to make of this. I also tried:
and get a compiler error that QScrollArea has no member names 'setHorizontalScrollMode'.
Any help would be much appreciated.
The errors say it all. Take a look at the doc page you posted, you will find that QScrollArea does not derive from QAbstractItemView (far from it actually) but it is a derivative of QAbstractScrollArea.
So how can I set the scrollArea to scroll per item?
Use a QAbstractItemView sub class. QScrollArea dose not work with items it works with widgets.
Consider reading a book "C++ GUI Programming with Qt-4 1st edition.":http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip
Reading a C++ book wouldn't hurt too, ass you are having problems understating simple compiler output.
Or at least use assistant.