[Qt-interest] Horizontal scroll bar max value.

phil prentice philp.cheer at talktalk.net
Mon Apr 27 12:19:56 CEST 2009


Sorry
  I knocked this example up this morning and made a stupid mistake  
list->verticalScrollBar()->setMaximum(500);
should read list->horizontalScrollBar()->setMaximum(500);

Similar setPageStep(50);

To much beer last night!!

Phil


On Monday 27 April 2009 10:10, phil prentice wrote:
> Hi Everyone
>
>   I am having problems trying to make a scroll bar work the way I want it
> to in a QListView(). I need to be able to scroll the existing data right
> out of the view i.e.
>
>                                Display Area
>                              _____________
>
>
> <-------Items---------->|<....empty.....>|
>
>
>                              -----------------------
>
> I've tried various things, but failed. For example if I create a long file
> name say XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> and I run the following program I cant seem to change the maximum value or
> get the results that I need?
>
> #include <QtGui>
> int main(int argc, char *argv[])
> {
>   QApplication app(argc, argv);
>   QSplitter *splitter = new QSplitter;
>   QDirModel *model = new QDirModel;
>   QListView *list = new QListView(splitter);
>   list->setModel(model);
>   list->setRootIndex(model->index(QDir::currentPath()));
>   splitter->setWindowTitle("PLEASE HELP!!!");
>   list->verticalScrollBar()->setMaximum(500); /* Tryed various things. */
>   list->verticalScrollBar()->setPageStep(50);
>   splitter->show();
>   return app.exec();
> }
>
> I can play around with setMaximum() & setPageStep() to no avail???
> I've tryed sub-classing QScrollBar but again no luck.  How can I achieve my
> requirement.
>
> Thanks
> Any comments very welcome
>
> Phil
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list