[Qt-interest] Scrolling Contents in QScrollArea

Sujan Dasmahapatra sdh at lmwindpower.com
Wed Feb 2 08:01:49 CET 2011


Dear Friends

I am using a QScrollArea which I can see some contents  in it. By  using
the following  code snippet I am able to see both the vertical and
horizontal scrollbar. I am also implementing the virtual function 

 

////////////////////////////////////////////////////////////////////////
//////////////////////////////////

#include <QScrollArea>

 

Class PageForGraph : public QScrollArea

{

   Q_OBJECT

Public:

PageForGraph(QWidget  *parent=0);

                virtual ~PageForGraph();

};

 

PageForGraph::PageForGraph(QWidget *parent)

{

                verticalScrollBar()->setRange(0, 2 * desk->height());

                horizontalScrollBar()->setRange(0, 2 * desk->width());

 

}

void PageForGraph::scrollContentsBy(int dx, int dy)

{

                widget()->move(widget()->x() + dx, widget()->y() + dy);

                const int x = horizontalScrollBar()->value() + dx;

                horizontalScrollBar()->setValue( x );

                const int y = verticalScrollBar()->value() + dy;

                verticalScrollBar()->setValue( y );

                update();

}

But when I moving the scrollbar  my contents are not moving. Any help
would be highly appreciated. Thanks sujan

 

 

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////

 

Kind Regards,

 

 

Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group

Tel    +91 80 66470248
Mob  

sdh at lmwindpower.com <mailto:%25EMAIL%25> 

 

LM Wind Power Blades

lmwindpower.com

 

Together we capture the wind to power a cleaner world

________________________________

 

This e-mail and any attachments are confidential. If you are not the
named or intended recipient, please notify the sender immediately and do
not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Any unauthorized
disclosure, use or storage is prohibited and might be unlawful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110202/63d4567d/attachment.html 


More information about the Qt-interest-old mailing list