src/hbcore/gui/hbscrollarea.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    31 #include <hbwidgetfeedback.h>
    31 #include <hbwidgetfeedback.h>
    32 #include <hbevent.h>
    32 #include <hbevent.h>
    33 #include "hbglobal_p.h"
    33 #include "hbglobal_p.h"
    34 #include <hbtapgesture.h>
    34 #include <hbtapgesture.h>
    35 #include <hbnamespace_p.h>
    35 #include <hbnamespace_p.h>
       
    36 #include <hbstyleframeprimitivedata.h>
       
    37 #include <QGraphicsSceneResizeEvent>
    36 
    38 
    37 #include <QGesture>
    39 #include <QGesture>
    38 
    40 
    39 #include <QDebug>
    41 #include <QDebug>
    40 
    42 
    41 /*!
    43 /*!
    42  @beta
    44     @beta
    43  @hbcore
    45     @hbcore
    44  \class HbScrollArea
    46     \class HbScrollArea
    45  \brief HbScrollArea provides a finger-touch enabled scrollable container class.  
    47     \brief The HbScrollArea class provides a touch-enabled scrolling view onto another
    46  
    48     widget.
    47  HbScrollArea handles the events need to scroll the contents placed inside it.  It also
    49 
    48  handles the display of scrollbar while scrolling is occurring.
    50     A scroll area displays the contents of another widget within a frame. If the size of
    49  
    51     this widget exceeds the size of the frame, the user can scroll so that the entire
    50  HbScrollArea is used by constructing a QGraphicsWidget that contains the content to be
    52     contents can be viewed. The user scrolls through the contents by using a dragging
    51  displayed, then calling the setContentWidget() method.  The content widget must have its size
    53     gesture. If scroll bars are enabled and the scroll bar is interactive, the user can
    52  set appropriately either by associating a layout with the widget or by explicitly setting
    54     also scroll through the contents using the scroll bar (HbScrollBar class).
    53  the size (e.g. by calling QGraphicsWidget::setGeometry()).
    55 
    54  
    56     %HbScrollArea is a concrete class that you can use directly in your applications to
    55  The class can be used by itself to provide default scrolling behavior or can be
    57     provide default scrolling behavior. %HbScrollArea is also a base class for
    56  subclassed to add touch feedback, selection feedback, etc.
    58     HbAbstractItemView and the item view classes that derive from it. If necessary, you
    57  
    59     can subclass %HbScrollArea to add additional features, such as touch and selection
    58  By default, the class provides dragging, flicking with animated follow-on, a
    60     feedback.
    59  simple inertia algorithm for slowing the animated follow-on scrolling and
    61 
    60  a bounce-back algorithm for animating the content back to its bounding
    62     \image html hbscrollarea.png A scroll area containing a large image and showing scrollbars
    61  limits at the end of a drag or flick action.
    63 
    62  */
    64     %HbScrollArea provides properties that you can use to customize the following aspects
    63 
    65     of the scroll area:
    64 /*!
    66 
    65  Here are the main properties of the class:
    67     - <b>Scrolling style</b>. The user scrolls through the contents by using a dragging
    66 
    68          movement. This property controls what happens when the user releases the pressure.
    67  \li HbScrollArea::scrollDirections     : 
    69          The default is that a follow-on animation continues the scrolling if the dragging
    68  \li HbScrollArea::clampingStyle        : 
    70          was fast. Alternatively, the scrolling can stop as soon as the user releases the
    69  \li HbScrollArea::scrollingStyle       : 
    71          pressure, regardless of the dragging speed. Call setScrollingStyle() to set this
    70  \li HbScrollArea::showScrollBars       : 
    72          property.
    71  \li HbScrollArea::scrollBarWidth       :  
    73 
    72  \li HbScrollArea::scrollBarMargin      : 
    74     - <b>Friction effect</b>. This property controls the speed of the follow-on scrolling
    73  \li HbScrollArea::frictionEnabled      :
    75          animation. When the friction effect is enabled, it slows the animation and causes
    74  \li HbScrollArea::handleLongPress      :  
    76          it to stop more quickly than when the effect is not enabled. Call setFrictionEnabled()
    75  */
    77          to set this property.
    76 
    78 
    77 /*!
    79     - <b>Clamping style</b>. This property controls how scrolling is constrained relative
    78     \property HbScrollArea::showScrollBars
    80          to the contents of the scrolling area. Scrolling can be limited to the bounding
    79     \brief
    81          rectangle of the contents or it can go beyond the bounding rectangle and bounce
    80 */
    82          back to its limits (this is the default). Call setClampingStyle() to set this
    81 
    83          property.
    82 /*!
    84 
    83     \property HbScrollArea::scrollBarWidth
    85     - <b>Scroll direction</b>. This property controls the scrolling direction. The default is
    84     \brief
    86          vertical scrolling, but this can be changed to horizontal or bi-directional scrolling.
    85 */
    87          Call setScrollDirections() to set this property.
    86 
    88 
    87 /*!
    89     - <b>Scrollbar policy</b>. There is a separate scrollbar policy property for both scrollbars.
    88     \property HbScrollArea::scrollBarMargin
    90          You can set these so that the scrollbar is always shown, never shown, only shown when
    89     \brief
    91          needed or for short periods (autohide), which is the default behavior. Call
    90 */
    92          setVerticalScrollBarPolicy() and setHorizontalScrollBarPolicy() to set these properties.
    91 
    93 
    92 /*!
    94     - <b>Continuation indicators</b>. This property controls whether visual feedback is provided
    93     \property HbScrollArea::scrollDirections
    95          to indicate when scrolling is possible. The default value is false. Call
    94     \brief 
    96          setContinuationIndicators() to set this property.
    95 */
    97 
    96 
    98     The contents widget must be an object of a class derived from QGraphicsWidget. After
    97 /*!
    99     constructing this widget, you set it into the scroll area by calling setContentWidget().
    98     \property HbScrollArea::clampingStyle
   100     The scroll area uses QGraphicsWidget::sizeHint() to resize the content widget to fit,
    99     \brief 
   101     taking into account the scroll direction. For example, when the scrolling direction is
   100 */
   102     vertical, the scroll area resizes the contents widget to fit the width of the scroll area.
   101 
   103 
   102 /*!
   104     \section _usecases_hbscrollarea Using the HbScrollArea class
   103     \property HbScrollArea::scrollingStyle
   105 
   104     \brief 
   106     This example creates an HbScrollArea widget and sets a large photo as its contents.
   105 */
   107 
   106 
   108     \code
   107 /*!
   109 int main(int argc, char *argv[])
   108     \property HbScrollArea::frictionEnabled
   110 {
   109     \brief
   111     HbApplication app(argc, argv);
   110 */
   112     app.setApplicationName( "Scroll Area" );
   111 
   113 
   112 /*!
   114     HbMainWindow window;
   113     \property HbScrollArea::handleLongPress
   115     HbView* view = new HbView();
   114     \brief 
   116 
   115 */
   117     // Create the scroll area object.
   116 
   118     HbScrollArea* scrollArea = new HbScrollArea();
   117 /*!
   119 
   118     \property HbScrollArea::verticalScrollBarPolicy
   120     // Create the content widget.
   119     \brief
   121     QGraphicsWidget* content = new QGraphicsWidget();
   120 */
   122 
   121 
   123     // Create a pixmap as a child of the content widget.
   122 /*!
   124     QString string(":/gfx/beach.jpg");
   123     \property HbScrollArea::horizontalScrollBarPolicy
   125     QGraphicsPixmapItem* pixmapItem = new QGraphicsPixmapItem(string, content);
   124     \brief
   126 
   125 */
   127     // Set the preferred size of the content widget to match the full size of the photo.
       
   128     content->setPreferredSize(pixmapItem->boundingRect().size());
       
   129 
       
   130     // Load the content widget into the scrolling area.
       
   131     scrollArea->setContentWidget(content);
       
   132 
       
   133     // Set the scroll area to scroll in both directions.
       
   134     scrollArea->setScrollDirections(Qt::Vertical | Qt::Horizontal);
       
   135 
       
   136     view->setWidget(scrollArea);
       
   137     window.addView(view);
       
   138     window.show();
       
   139     return app.exec();
       
   140 }
       
   141     \endcode
       
   142 
       
   143     \sa HbScrollBar
       
   144  */
   126 
   145 
   127 /*!
   146 /*!
   128     \fn void HbScrollArea::scrollDirectionsChanged(Qt::Orientations newValue)
   147     \fn void HbScrollArea::scrollDirectionsChanged(Qt::Orientations newValue)
   129 
   148 
   130     This signal is emitted when scrolling direction is changed.
   149     This signal is emitted when the scrolling direction changes.
   131 */
   150 */
   132 
   151 
   133 /*!
   152 /*!
   134     \fn void HbScrollArea::scrollingStarted()
   153     \fn void HbScrollArea::scrollingStarted()
   135 
   154 
   136     This signal is emitted whenever a scrolling action begins.
   155     This signal is emitted when a scrolling action begins.
   137 */
   156 */
   138 
   157 
   139 /*!
   158 /*!
   140     \fn void HbScrollArea::scrollingEnded()
   159     \fn void HbScrollArea::scrollingEnded()
   141 
   160 
   142     This signal is emitted whenever a scrolling action ends.
   161     This signal is emitted when a scrolling action ends.
   143 */
   162 */
   144 
   163 
   145 /*!
   164 /*!
   146     \fn void HbScrollArea::scrollPositionChanged(QPointF newposition)
   165     \fn void HbScrollArea::scrollPositionChanged(const QPointF &newPosition)
   147     This signal is emitted when scroll position is changed and someone is connected to the signal.
   166 
       
   167     This signal is emitted when the scroll position is changed, but only if this signal
       
   168     is connected to a slot.
   148 */
   169 */
   149 
   170 
   150 /*!
   171 /*!
   151     \enum HbScrollArea::ClampingStyle
   172     \enum HbScrollArea::ClampingStyle
   152 
   173 
   153     Clamping styles supported by HbScrollArea.
   174     Defines the clamping styles supported by HbScrollArea. The clamping style
   154 
   175     controls the behavior when scrolling to the edge of the contents of the scrolling
   155     This enum describes how scrolling is behaving when reaching boundaries of the content item.
   176     area.
   156 */
   177 
       
   178     \sa setClampingStyle(), clampingStyle()
       
   179 */
       
   180 
   157 /*!
   181 /*!
   158     \var HbScrollArea::StrictClamping
   182     \var HbScrollArea::StrictClamping
   159 
   183     Scrolling is limited to the bounding rectangle of the contents.
   160     Scrolling is limited to the bounding rectangle of the content item.
   184 */
   161 */
   185 
   162 /*!
   186 /*!
   163     \var HbScrollArea::BounceBackClamping
   187     \var HbScrollArea::BounceBackClamping
   164 
   188     Scrolling can go beyond the bounding rectangle of the contents, but bounces
   165     Scrolling can go beyond the bounding rectangle of the content item, but bounces back to the
   189     back to the limits of the bounding rectangle when released or when the follow-on
   166     limits of the bounding rectangle when released or when inertia scrolling stops.
   190     scrolling animation stops. This is the default clamping style.
   167 */
   191 */
       
   192 
   168 /*!
   193 /*!
   169     \var HbScrollArea::NoClamping
   194     \var HbScrollArea::NoClamping
   170 
   195     Scrolling is unclamped. Typically you use this only in a subclass that implements
   171     Scrolling is completely unclamped (this is usually used when the subclass implements its own).
   196     its own custom clamping behavior.
   172 */
   197 */
       
   198 
   173 /*!
   199 /*!
   174     \enum HbScrollArea::ScrollingStyle
   200     \enum HbScrollArea::ScrollingStyle
   175 
   201 
   176     Different scrolling styles supported by HbScrollArea.
   202     Defines the scrolling styles supported by HbScrollArea. The scrolling style
   177 
   203     controls which gestures the user can use to scroll the contents and how the scrolling
   178     This enum describes how scroll area can be scrolled.
   204     responds to those gestures.
   179 */
   205 
       
   206     \sa setScrollingStyle(), scrollingStyle()
       
   207 */
       
   208 
   180 /*!
   209 /*!
   181     \var HbScrollArea::Pan
   210     \var HbScrollArea::Pan
   182 
   211 
   183     Dragging motion pans the view with no follow-on scrolling animation.
   212     The user can scroll through the contents by using a dragging motion. The scrolling
   184 */
   213     stops as soon as the user stops the dragging motion.
       
   214 */
       
   215 
   185 /*!
   216 /*!
   186     \var HbScrollArea::PanOrFlick
   217     \var HbScrollArea::PanOrFlick
   187 
   218 
   188     Dragging motion pans the view with no follow-on scrolling animation,
   219     \deprecated
   189     quick flicking motion triggers scrolling animation.
   220     The user can scroll through the contents by using a dragging motion and a quick
   190 */
   221     flicking motion triggers a follow-on scrolling animation.
       
   222 */
       
   223 
   191 /*!
   224 /*!
   192     \var HbScrollArea::PanWithFollowOn
   225     \var HbScrollArea::PanWithFollowOn
   193 
   226 
   194     Dragging motion pans the view, velocity at end of drag motion triggers follow-on animated scrolling.
   227     The user can scroll through the contents by using a dragging motion. In addition
       
   228     a fast dragging motion triggers a follow-on scrolling animation when the user
       
   229     stops dragging and releases the pressure. This is the default scrolling style.
   195 */
   230 */
   196 
   231 
   197 /*!
   232 /*!
   198     \enum HbScrollArea::ScrollBarPolicy
   233     \enum HbScrollArea::ScrollBarPolicy
   199 
   234 
   200     This enum type describes the various visibility modes of HbScrollArea's scroll bars.
   235     Defines the scroll bar visibility modes supported by  HbScrollArea.
       
   236 
       
   237     \sa setVerticalScrollBarPolicy(), verticalScrollBarPolicy(),
       
   238     setHorizontalScrollBarPolicy(), horizontalScrollBarPolicy()
   201 */
   239 */
   202 
   240 
   203 /*!
   241 /*!
   204     \var HbScrollArea::ScrollBarAsNeeded
   242     \var HbScrollArea::ScrollBarAsNeeded
   205 
   243 
   206     HbScrollArea shows a scroll bar when the content is too large to fit and not otherwise.
   244     Show the scroll bar only when the contents are too large to fit.
   207 */
   245 */
   208 /*!
   246 /*!
   209     \var HbScrollArea::ScrollBarAlwaysOff
   247     \var HbScrollArea::ScrollBarAlwaysOff
   210 
   248 
   211     HbScrollArea never shows a scroll bar.
   249     Never show the scroll bar.
   212 */
   250 */
   213 /*!
   251 /*!
   214     \var HbScrollArea::ScrollBarAlwaysOn
   252     \var HbScrollArea::ScrollBarAlwaysOn
   215 
   253 
   216     HbScrollArea always shows a scroll bar.
   254     Always show the scroll bar.
   217 */
   255 */
   218 /*!
   256 /*!
   219     \var HbScrollArea::ScrollBarAutoHide
   257     \var HbScrollArea::ScrollBarAutoHide
   220 
   258 
   221     HbScrollArea shows scroll bar for short period of time when the content is displayed or scrolled. Scroll bar is not shown if not needed.
   259     Show the scroll bar for a short period when the contents are first displayed or
   222 
   260     when the user scrolls the contents. This is the default behavior.
   223     This is the default behavior.
       
   224 */
   261 */
   225 
   262 
   226 /*!
   263 /*!
   227     \primitives
   264     \primitives
   228     \primitives{continuation-indicator-bottom} HbFrameItem representing the scrollarea continuation indicator on the bottom of the scrollarea.
   265     \primitives{continuation-indicator-bottom} HbFrameItem representing the scrollarea continuation indicator on the bottom of the scrollarea.
   230     \primitives{continuation-indicator-left} HbFrameItem representing the scrollarea continuation indicator on the left side of the scrollarea.
   267     \primitives{continuation-indicator-left} HbFrameItem representing the scrollarea continuation indicator on the left side of the scrollarea.
   231     \primitives{continuation-indicator-right} HbFrameItem representing the scrollarea continuation indicator on the right side of the scrollarea.
   268     \primitives{continuation-indicator-right} HbFrameItem representing the scrollarea continuation indicator on the right side of the scrollarea.
   232   */
   269   */
   233 
   270 
   234 /*!
   271 /*!
   235   Constructor
   272     Constructs an HbScrollArea object with the given \a parent.
   236  
   273  */
   237   \sa HbScrollArea::HbScrollArea
   274 HbScrollArea::HbScrollArea(QGraphicsItem* parent) :
   238  */
       
   239 HbScrollArea::HbScrollArea(QGraphicsItem* parent) : 
       
   240         HbWidget( *new HbScrollAreaPrivate, parent )
   275         HbWidget( *new HbScrollAreaPrivate, parent )
   241 {
   276 {
   242     Q_D( HbScrollArea );
   277     Q_D( HbScrollArea );
   243     d->q_ptr = this;
   278     d->q_ptr = this;
   244     d->init();
   279     d->init();
   245 }
   280 }
   246 
   281 
   247 /*!
   282 /*!
   248   Protected constructor.
   283     Protected constructor.
   249   */
   284   */
   250 HbScrollArea::HbScrollArea(HbScrollAreaPrivate &dd, QGraphicsItem *parent):
   285 HbScrollArea::HbScrollArea(HbScrollAreaPrivate &dd, QGraphicsItem *parent):
   251         HbWidget( dd, parent  )
   286         HbWidget( dd, parent  )
   252 {
   287 {
   253     Q_D( HbScrollArea );
   288     Q_D( HbScrollArea );
   254     d->q_ptr = this;
   289     d->q_ptr = this;
   255     d->init();
   290     d->init();
   256 }
   291 }
   257    
   292    
   258 /*!
   293 /*!
   259  Destructor
   294     Destructor
   260  
       
   261  \sa HbScrollArea::~HbScrollArea
       
   262  */
   295  */
   263 HbScrollArea::~HbScrollArea()
   296 HbScrollArea::~HbScrollArea()
   264 {
   297 {
   265     Q_D( HbScrollArea );
   298     Q_D( HbScrollArea );
   266     if (d && d->mContents) {
   299     if (d && d->mContents) {
   267         d->mContents->setParentLayoutItem(0);
   300         d->mContents->setParentLayoutItem(0);
   268     }
   301     }
   269 }
   302 }
   270 
   303 
   271 /*!
   304 /*!
   272  Returns a pointer to the QGraphicsWidget,which is the content of scrollable area.
   305     Returns a pointer to the widget that is contained within the scroll area
   273  
   306     and that defines the contents to be scrolled.
   274  \sa HbScrollArea::setContentWidget()
   307 
       
   308     \sa setContentWidget()
   275  */
   309  */
   276 QGraphicsWidget* HbScrollArea::contentWidget() const
   310 QGraphicsWidget* HbScrollArea::contentWidget() const
   277 {
   311 {
   278     Q_D( const HbScrollArea );
   312     Q_D( const HbScrollArea );
   279 
   313 
   280     return d->mContents;
   314     return d->mContents;
   281 }
   315 }
   282 
   316 
   283 /*!
   317 /*!
   284  Assigns the QGraphicsWidget that is to be scrolled.  The HbScrollArea widget takes ownership of
   318    Assigns a widget (QGraphicsWidget object) to the scroll area. This widget defines
   285  the QGraphicsWidget.
   319    the contents of the scroll area. The HbScrollArea object takes ownership of the
   286  
   320    contents widget.
   287  \sa HbScrollArea::contentWidget()
   321 
       
   322    \sa contentWidget()
   288  */
   323  */
   289 void HbScrollArea::setContentWidget(QGraphicsWidget* contents)
   324 void HbScrollArea::setContentWidget(QGraphicsWidget* contents)
   290 {
   325 {
   291     Q_D( HbScrollArea );
   326     Q_D( HbScrollArea );
   292 
   327 
   314         d->hideChildComponents();
   349         d->hideChildComponents();
   315     }
   350     }
   316 }
   351 }
   317 
   352 
   318 /*!
   353 /*!
   319 Removes the content widget, which is set to the scrollarea and returns it.
   354     Removes the scroll area's content widget from the scroll area, returns it, and
   320 The ownership of the \a QGraphicsWidget is transferred to the caller.
   355     transfers ownership of the content widget to the caller. This is useful when you
   321 
   356     need to switch the contents without deleting previous contents.
   322 \note This function is particularly useful if one wants to switch between
       
   323 different contents without deleting previous content.
       
   324 
   357 
   325     \sa setContentWidget()
   358     \sa setContentWidget()
   326 */
   359  */
   327 QGraphicsWidget *HbScrollArea::takeContentWidget()
   360 QGraphicsWidget *HbScrollArea::takeContentWidget()
   328 {
   361 {
   329     Q_D(HbScrollArea);
   362     Q_D(HbScrollArea);
   330     QGraphicsWidget* content = d->mContents;
   363     QGraphicsWidget* content = d->mContents;
   331     d->mContents = 0;
   364     d->mContents = 0;
   340     d->hideChildComponents();
   373     d->hideChildComponents();
   341     return content;
   374     return content;
   342 }
   375 }
   343 
   376 
   344 /*!
   377 /*!
   345  Returns the value of the clampingStyle property
   378     Returns the value of the \c clampingStyle property.
   346  
   379 
   347  \sa HbScrollArea::setClampingStyle()
   380     \sa setClampingStyle(), HbScrollArea::ClampingStyle
   348  */
   381  */
   349 HbScrollArea::ClampingStyle HbScrollArea::clampingStyle() const
   382 HbScrollArea::ClampingStyle HbScrollArea::clampingStyle() const
   350 {
   383 {
   351     Q_D( const HbScrollArea );
   384     Q_D( const HbScrollArea );
   352 
   385 
   353     return d->mClampingStyle;
   386     return d->mClampingStyle;
   354 }
   387 }
   355 
   388 
   356 /*!
   389 /*!
   357  Sets the clampingStyle property that controls how the scrolling is constrained
   390     Sets the \c clampingStyle property, which controls how scrolling is constrained
   358  relative to the contents of the scrolling area.
   391     relative to the contents of the scrolling area. The possible values are defined
   359  
   392     by the HbScrollArea::ClampingStyle enum. The default is
   360  Possible values for the clamping style include:
   393     HbScrollArea::BounceBackClamping.
   361  
   394 
   362  	StrictClamping - scrolling is limited to the bounding rectangle of the content item
   395     \sa clampingStyle()
   363  	BounceBackClamping - scrolling can go beyond the bounding rectangle of the content item, but bounces back to the
       
   364  					limits of the bounding rectangle when released or when inertia scrolling stops
       
   365  	NoClamping - scrolling is completely unclamped (this is usually used when the subclass implements its own
       
   366  					custom clamping behavior)
       
   367  
       
   368  The default value is BounceBackClamping.
       
   369  
       
   370  \sa HbScrollArea::clampingStyle()
       
   371  */
   396  */
   372 void HbScrollArea::setClampingStyle(ClampingStyle value)
   397 void HbScrollArea::setClampingStyle(ClampingStyle value)
   373 {
   398 {
   374     Q_D( HbScrollArea );
   399     Q_D( HbScrollArea );
   375 
   400 
   376     d->mClampingStyle = value;
   401     d->mClampingStyle = value;
   377 }
   402 }
   378 
   403 
   379 /*!
   404 /*!
   380   Returns the value of the scrollingStyle property
   405     Returns the value of the \c scrollingStyle property.
   381  
   406 
   382   \sa HbScrollArea::setScrollingStyle()
   407     \sa setScrollingStyle()
   383  */
   408  */
   384 HbScrollArea::ScrollingStyle HbScrollArea::scrollingStyle() const
   409 HbScrollArea::ScrollingStyle HbScrollArea::scrollingStyle() const
   385 {
   410 {
   386     Q_D( const HbScrollArea );
   411     Q_D( const HbScrollArea );
   387 
   412 
   388     return d->mScrollingStyle;
   413     return d->mScrollingStyle;
   389 }
   414 }
   390 
   415 
   391 /*!
   416 /*!
   392   Sets the scrollingStyle property that controls how the style of scrolling interaction
   417     Sets the \c scrollingStyle property, which controls which gestures the user can
   393   provided by the widget
   418     use to scroll the contents and how the scrolling responds to those gestures. The
   394  
   419     possible values are defined by the HbScrollArea::ScrollingStyle enum. The default
   395   Possible values for the clamping style include:
   420     value is HbScrollArea::PanWithFollowOn.
   396  
   421 
   397  		Pan - dragging motion pans the view with no follow-on scrolling animation
   422     \sa scrollingStyle()
   398                \deprecated PanOrFlick
       
   399                     is deprecated.
       
   400  		PanWithFollowOn - dragging motion pans the view, velocity at end of drag motion triggers follow-on animated scrolling
       
   401  
       
   402   The default value is PanWithFollowOn.
       
   403  
       
   404   \sa HbScrollArea::scrollingStyle()
       
   405  */
   423  */
   406 void HbScrollArea::setScrollingStyle(ScrollingStyle value)
   424 void HbScrollArea::setScrollingStyle(ScrollingStyle value)
   407 {
   425 {
   408     Q_D( HbScrollArea );
   426     Q_D( HbScrollArea );
   409 
   427 
   414         d->mScrollingStyle = value;
   432         d->mScrollingStyle = value;
   415     }
   433     }
   416 }
   434 }
   417 
   435 
   418 /*!
   436 /*!
   419   Returns the value of the scrollDirections property.
   437     Returns the value of the \c scrollDirections property.
   420  
   438  
   421   \sa HbScrollArea::setScrollDirections()
   439     \sa setScrollDirections()
   422  */
   440  */
   423 Qt::Orientations HbScrollArea::scrollDirections() const
   441 Qt::Orientations HbScrollArea::scrollDirections() const
   424 {
   442 {
   425     Q_D( const HbScrollArea );
   443     Q_D( const HbScrollArea );
   426 
   444 
   427     return d->mScrollDirections;
   445     return d->mScrollDirections;
   428 }
   446 }
   429 
   447 
   430 /*!
   448 /*!
   431   Sets the value of the scrollDirections property.  This value is of
   449     Sets the \c scrollDirections property, which controls the scrolling direction. The
   432   type Qt::Orientations and can set to either Qt::Horizontal to enable horizontal scrolling,
   450     possible values are defined by the Qt::Orientations enum, as shown in the following
   433   Qt::Vertical to enable vertical scrolling or (Qt::Horizontal | Qt::Vertical) to enable
   451     table. The default value is Qt::Vertical.
   434   scrolling in both directions.
   452 
   435  
   453     <table border="1" style="border-collapse: collapse; border: solid;">
   436   The default value is Qt::Vertical.
   454     <tr><th>To enable:</th><th>Set to:</th></tr>
   437  
   455     <tr><td>Horizontal scrolling</td><td>Qt::Horizontal</td></tr>
   438   \sa HbScrollArea::scrollDirections()
   456     <tr><td>Vertical scrolling</td><td>Qt::Vertical</td></tr>
       
   457     <tr><td>Scrolling in both directions</td><td>Qt::Horizontal | Qt::Vertical</td></tr>
       
   458     </table>
       
   459 
       
   460     \sa scrollDirections()
   439  */
   461  */
   440 void HbScrollArea::setScrollDirections(Qt::Orientations value)
   462 void HbScrollArea::setScrollDirections(Qt::Orientations value)
   441 {
   463 {
   442     Q_D( HbScrollArea );
   464     Q_D( HbScrollArea );
   443 
   465 
   455         emit scrollDirectionsChanged( value );
   477         emit scrollDirectionsChanged( value );
   456     }
   478     }
   457 }
   479 }
   458 
   480 
   459 /*!
   481 /*!
   460   Returns true if the inertia scrolling effect is enabled, false otherwise.
   482     Returns true if the friction effect is enabled, false otherwise.
   461  
   483  
   462   \sa HbScrollArea::setFrictionEnabled()
   484     \sa setFrictionEnabled()
   463  */
   485  */
   464 bool HbScrollArea::frictionEnabled() const
   486 bool HbScrollArea::frictionEnabled() const
   465 {
   487 {
   466     Q_D( const HbScrollArea );
   488     Q_D( const HbScrollArea );
   467 
   489 
   468     return d->mFrictionEnabled;
   490     return d->mFrictionEnabled;
   469 }
   491 }
   470 
   492 
   471 /*!
   493 /*!
   472   Enables/disables the inertia scrolling effect.
   494     Sets the \c frictionEnabled property. The default value is true, which
   473   By default, the inertia effect is enabled.
   495     indicates that the friction effect is enabled.
   474  
   496 
   475   \sa HbScrollArea::frictionEnabled()
   497     When the HbScrollArea::PanWithFollowOn scrolling style is in use, the
       
   498     \c frictionEnabled property controls the speed of the follow-on scrolling
       
   499     animation. When the friction effect is enabled (the default), it slows the
       
   500     animation and causes it to stop earlier than when the friction effect is not
       
   501     in use.
       
   502 
       
   503     \sa frictionEnabled()
   476  */
   504  */
   477 void HbScrollArea::setFrictionEnabled(bool value)
   505 void HbScrollArea::setFrictionEnabled(bool value)
   478 {
   506 {
   479     Q_D( HbScrollArea );
   507     Q_D( HbScrollArea );
   480 
   508 
   481     d->mFrictionEnabled = value;
   509     d->mFrictionEnabled = value;
   482 }
   510 }
   483 
   511 
   484 /*!
   512 /*!
   485   Returns true if the scroll area handles
   513     Returns true if the scroll area handles long press gestures, false otherwise.
   486   long press gestures, false otherwise
   514 
   487  
   515     \deprecated This function is deprecated.
   488   \deprecated HbScrollArea::longPressEnabled()
       
   489       is deprecated.
       
   490  
       
   491   \sa HbScrollArea::setHandleLongPress()
       
   492  */
   516  */
   493 bool HbScrollArea::longPressEnabled() const
   517 bool HbScrollArea::longPressEnabled() const
   494 {
   518 {
   495     HB_DEPRECATED("HbScrollArea::longPressEnabled() is deprecated");    
   519     HB_DEPRECATED("HbScrollArea::longPressEnabled() is deprecated");    
   496     return false;
   520     return false;
   497 }
   521 }
   498 
   522 
   499 /*!
   523 /*!
   500   Sets the value of the handleLongPress property.  This value is set
   524     Sets the value of the \c handleLongPress property. Set \a value to true if
   501   to true if the widget is to respond to long press gestures, false otherwise.
   525     the widget responds to long press gestures. Otherwise set it to false.
   502  
   526     The default value is false.
   503   The default value is false.
   527 
   504  
   528     \deprecated This function is deprecated.
   505   \deprecated HbScrollArea::setLongPressEnabled(bool)
       
   506         is deprecated.
       
   507  
       
   508   \sa HbScrollArea::handleLongPress()
       
   509  */
   529  */
   510 void HbScrollArea::setLongPressEnabled (bool value)
   530 void HbScrollArea::setLongPressEnabled (bool value)
   511 {
   531 {
   512     HB_DEPRECATED("HbScrollArea::setLongPressEnabled(bool) is deprecated");
   532     HB_DEPRECATED("HbScrollArea::setLongPressEnabled(bool) is deprecated");
   513     Q_UNUSED(value);
   533     Q_UNUSED(value);
   514 }
   534 }
   515 
   535 
   516 /*
   536 /*!
   517   \reimp
   537     \reimp
   518  */
   538  */
   519 QVariant HbScrollArea::itemChange(GraphicsItemChange change, const QVariant &value)
   539 QVariant HbScrollArea::itemChange(GraphicsItemChange change, const QVariant &value)
   520 {
   540 {
   521     Q_D( HbScrollArea );
   541     Q_D( HbScrollArea );
   522 
   542 
   523     if (change == QGraphicsItem::ItemVisibleHasChanged && d->mContents) {
   543     if (change == QGraphicsItem::ItemVisibleHasChanged && d->mContents) {
   524         if (value.toBool() == true)
   544         if (value.toBool() == true)
   525             d->adjustContent();
   545             d->adjustContent();
   526         else
   546         else
   527             d->_q_hideScrollBars();
   547             d->_q_hideScrollBars();
       
   548         //need to invalidate the whole region as we apply clipping
       
   549         prepareGeometryChange();
   528     }
   550     }
   529 
   551 
   530     return HbWidget::itemChange(change, value);
   552     return HbWidget::itemChange(change, value);
   531 }
   553 }
   532 
   554 
   533 /*! @beta
   555 /*!
   534   upGesture() is a virtual slot function that is called whenever an
   556     A virtual slot function that is called when an upwards flick gesture is detected
   535   up flick gesture is detected, if the scrollDirection is set to
   557     while vertical scrolling is enabled.
   536   enable vertical scrolling.
   558 
   537  
   559     \deprecated This function is deprecated.
   538   Derived classes can override this method to add custom handling of
       
   539   the gesture.  In most cases, derived classes should call up to the
       
   540   HbScrollArea parent method.
       
   541  
       
   542   \deprecated HbScrollArea::upGesture(int)
       
   543         is deprecated.
       
   544  */
   560  */
   545 void HbScrollArea::upGesture(int speedPixelsPerSecond)
   561 void HbScrollArea::upGesture(int speedPixelsPerSecond)
   546 {
   562 {
   547     HB_DEPRECATED("HbScrollArea::upGesture(int) is deprecated. Use gesture FW.");
   563     HB_DEPRECATED("HbScrollArea::upGesture(int) is deprecated. Use gesture FW.");
   548 
   564 
   549     Q_UNUSED(speedPixelsPerSecond);
   565     Q_UNUSED(speedPixelsPerSecond);
   550 }
   566 }
   551 
   567 
   552 /*! @beta
   568 /*!
   553   downGesture() is a virtual slot function that is called whenever an
   569     A virtual slot function that is called when a downwards flick gesture is
   554   down flick gesture is detected, if the scrollDirection is set to
   570     detected while vertical scrolling is enabled.
   555   enable vertical scrolling. 
   571 
   556  
   572     \deprecated This function is deprecated.
   557   Derived classes can override this method to add custom handling of
       
   558   the gesture.  In most cases, derived classes should call up to the
       
   559   HbScrollArea parent method.
       
   560  
       
   561   \deprecated HbScrollArea::downGesture(int)
       
   562         is deprecated.
       
   563  */
   573  */
   564 void HbScrollArea::downGesture(int speedPixelsPerSecond)
   574 void HbScrollArea::downGesture(int speedPixelsPerSecond)
   565 {
   575 {
   566     HB_DEPRECATED("HbScrollArea::downGesture(int) is deprecated. Use gesture FW.");
   576     HB_DEPRECATED("HbScrollArea::downGesture(int) is deprecated. Use gesture FW.");
   567     Q_UNUSED(speedPixelsPerSecond);
   577     Q_UNUSED(speedPixelsPerSecond);
   568 }
   578 }
   569 
   579 
   570 /*! @beta
   580 /*!
   571   leftGesture() is a virtual slot function that is called whenever an
   581     A virtual slot function that is called when a left flick gesture
   572   left flick gesture is detected, if the scrollDirection is set to
   582     is detected while horizontal scrolling is enabled.
   573   enable horizontal scrolling.
   583 
   574  
   584     \deprecated This function is deprecated.
   575   Derived classes can override this method to add custom handling of
       
   576   the gesture.  In most cases, derived classes should call up to the
       
   577   HbScrollArea parent method.
       
   578  
       
   579   \deprecated HbScrollArea::leftGesture(int)
       
   580             is deprecated.
       
   581  */
   585  */
   582 void HbScrollArea::leftGesture(int speedPixelsPerSecond)
   586 void HbScrollArea::leftGesture(int speedPixelsPerSecond)
   583 {
   587 {
   584     HB_DEPRECATED("HbScrollArea::leftGesture(int) is deprecated. Use gesture FW.");
   588     HB_DEPRECATED("HbScrollArea::leftGesture(int) is deprecated. Use gesture FW.");
   585     Q_UNUSED(speedPixelsPerSecond);
   589     Q_UNUSED(speedPixelsPerSecond);
   586 }
   590 }
   587 
   591 
   588 /*! @beta
   592 /*!
   589   rightGesture() is a virtual slot function that is called whenever an
   593     A virtual slot function that is called when a right flick gesture is detected
   590   right flick gesture is detected, if the scrollDirection is set to
   594     while horizontal scrolling is enabled.
   591   enable horizontal scrolling.
   595 
   592  
   596     \deprecated This function is deprecated.
   593   Derived classes can override this method to add custom handling of
       
   594   the gesture.  In most cases, derived classes should call up to the
       
   595   HbScrollArea parent method.
       
   596  
       
   597   \deprecated HbScrollArea::rightGesture(int)
       
   598         is deprecated.
       
   599  */
   597  */
   600 void HbScrollArea::rightGesture(int speedPixelsPerSecond)
   598 void HbScrollArea::rightGesture(int speedPixelsPerSecond)
   601 {
   599 {
   602     HB_DEPRECATED("HbScrollArea::rightGesture(int) is deprecated. Use gesture FW.");
   600     HB_DEPRECATED("HbScrollArea::rightGesture(int) is deprecated. Use gesture FW.");
   603     Q_UNUSED(speedPixelsPerSecond);
   601     Q_UNUSED(speedPixelsPerSecond);
   604 }
   602 }
   605 
   603 
   606 
   604 
   607 /*!
   605 /*!
   608   panGesture() is a virtual slot function that is called whenever an
   606     A virtual slot function that is called when a pan gesture is detected.
   609   pan gesture is detected.
   607 
   610  
   608     \deprecated This function is deprecated.
   611   Derived classes can override this method to add custom handling of
       
   612   the gesture.  In most cases, derived classes should call up to the
       
   613   HbScrollArea parent method.
       
   614  
       
   615   \deprecated HbScrollArea::panGesture(const QPointF&)
       
   616    is deprecated.
       
   617  */
   609  */
   618 void HbScrollArea::panGesture(const QPointF &delta)
   610 void HbScrollArea::panGesture(const QPointF &delta)
   619 {
   611 {
   620     HB_DEPRECATED("HbScrollArea::panGesture(const QPointF &) is deprecated. Use gesture FW.");
   612     HB_DEPRECATED("HbScrollArea::panGesture(const QPointF &) is deprecated. Use gesture FW.");
   621     Q_UNUSED(delta);
   613     Q_UNUSED(delta);
   622 }
   614 }
   623 
   615 
   624 /*!  @beta
   616 /*!
   625   longPressGesture() is a virtual slot function that is called whenever an
   617     A virtual slot function that is called when a long press gesture is
   626   long press gesture is detected, if the handleLongPress property is set to true.
   618     detected while the \c handleLongPress property is set to true.
       
   619 
       
   620     \deprecated This function is deprecated.
       
   621  */
       
   622 void HbScrollArea::longPressGesture(const QPointF &)
       
   623 {
       
   624     HB_DEPRECATED("HbScrollArea::longPressGesture(const QPointF &) is deprecated. Use gesture FW.");
       
   625 }
       
   626 
       
   627 /*!
       
   628     Reimplemented from QObject.
       
   629  */
       
   630 void HbScrollArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
       
   631 {
       
   632     Q_UNUSED (event);
       
   633 }
       
   634 
       
   635 /*!
       
   636     Returns true if a scrolling action is in progress, false otherwise.
       
   637  */
       
   638 bool HbScrollArea::isScrolling() const
       
   639 {
       
   640     Q_D( const HbScrollArea );
       
   641 
       
   642     return d->mIsScrolling;
       
   643 }
       
   644 
       
   645 /*!
       
   646     Returns true if the scrolling is in a response to the user dragging, false if it
       
   647     is the follow-on scrolling animation.
       
   648  */
       
   649 bool HbScrollArea::isDragging() const
       
   650 {
       
   651     Q_D( const HbScrollArea );
       
   652 
       
   653     return (d->mIsScrolling && !d->mIsAnimating);
       
   654 }
       
   655 
       
   656 /*!
       
   657     Scrolls the view by the amount indicated by \a delta and returns true if
       
   658     the scroll was successful and false otherwise.
       
   659 
       
   660     This is a virtual function, which subclasses can override to customize the
       
   661     behavior; for example, to clamp the position so that at least one item in
       
   662     the view remains visible.
       
   663  */
       
   664 bool HbScrollArea::scrollByAmount(const QPointF& delta)
       
   665 {
       
   666     Q_D( HbScrollArea );
       
   667 
       
   668     return d->scrollByAmount(delta);
       
   669 }
   627  
   670  
   628   Derived classes can override this method to add custom handling of
       
   629   the gesture.  By default, HbScrollArea does not respond to a long press.
       
   630  
       
   631   \deprecated HbScrollArea::longPressGesture(const QPointF&)
       
   632    is deprecated.
       
   633  
       
   634   \sa setHandleLongPress(), handleLongPress()
       
   635  */
       
   636 void HbScrollArea::longPressGesture(const QPointF &)
       
   637 {
       
   638     HB_DEPRECATED("HbScrollArea::longPressGesture(const QPointF &) is deprecated. Use gesture FW.");
       
   639 }
       
   640 
       
   641 /*!
   671 /*!
   642     \reimp
   672     \reimp
   643  */
       
   644 void HbScrollArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
       
   645 {
       
   646     Q_UNUSED (event);
       
   647 }
       
   648 
       
   649 /*!
       
   650   Returns true if a scrolling action is in progress, false otherwise.
       
   651  */
       
   652 bool HbScrollArea::isScrolling() const
       
   653 {
       
   654     Q_D( const HbScrollArea );
       
   655 
       
   656     return d->mIsScrolling;
       
   657 }
       
   658 
       
   659 /*!
       
   660   Returns true if the scrolling is due to dragging as opposed to follow-on scrolling
       
   661  */
       
   662 bool HbScrollArea::isDragging() const
       
   663 {
       
   664     Q_D( const HbScrollArea );
       
   665 
       
   666     return (d->mIsScrolling && !d->mIsAnimating);
       
   667 }
       
   668 
       
   669 /*!
       
   670   Scrolls the view by the amount indicated by "delta".
       
   671  
       
   672   The function returns TRUE if the view was able to scroll, FALSE otherwise.
       
   673  
       
   674   The function is virtual so subclasses can override it to customize the behavior by, for example, 
       
   675   clamping the position so that at least one item in the view remains visible.
       
   676  */
       
   677 bool HbScrollArea::scrollByAmount(const QPointF& delta)
       
   678 {
       
   679     Q_D( HbScrollArea );
       
   680 
       
   681     return d->scrollByAmount(delta);
       
   682 }
       
   683  
       
   684 /*!
       
   685    \reimp
       
   686  */
   673  */
   687 bool HbScrollArea::event(QEvent *event)
   674 bool HbScrollArea::event(QEvent *event)
   688 {
   675 {
   689     Q_D(HbScrollArea);
   676     Q_D(HbScrollArea);
   690     bool value(false);
   677     bool value(false);
   741                     }
   728                     }
   742                 } else {
   729                 } else {
   743                     newSize.setWidth(size().width());
   730                     newSize.setWidth(size().width());
   744                 }
   731                 }
   745 
   732 
       
   733 
   746                 d->mContents->resize(newSize);
   734                 d->mContents->resize(newSize);
   747             }
   735             }
   748         } else if (event->type() == QEvent::GraphicsSceneResize) {
   736         } else if (event->type() == QEvent::GraphicsSceneResize) {
   749             if (d->mContents) {
   737             if (d->mContents) {
   750                 if ( d->mIsAnimating ) {
   738                 if ( d->mIsAnimating ) {
   751                     d->stopAnimating();
   739                     d->stopAnimating();
   752                 }
   740                 }
   753                 QSizeF newSize = d->mContents->size();
   741                 QSizeF newSize = d->mContents->size();
   754                 bool sizeChanged = false;
   742                 bool sizeChanged = false;
   755 
   743 
   756                 if (!(d->mScrollDirections & Qt::Vertical)) {
   744                 if (!(d->mScrollDirections & Qt::Vertical) ||
       
   745                     ((d->mContents->sizePolicy().verticalPolicy() & QSizePolicy::ExpandFlag) &&
       
   746                     (newSize.height() < size().height()))) {
   757                     newSize.setHeight(size().height());
   747                     newSize.setHeight(size().height());
   758                     sizeChanged = true;
   748                     sizeChanged = true;
   759                 }
   749                 }
   760 
   750 
   761                 if (!(d->mScrollDirections & Qt::Horizontal)) {
   751                 if (!(d->mScrollDirections & Qt::Horizontal) ||
       
   752                     ((d->mContents->sizePolicy().horizontalPolicy() & QSizePolicy::ExpandFlag) &&
       
   753                      (newSize.width() < size().width()))) {
   762                     newSize.setWidth(size().width());
   754                     newSize.setWidth(size().width());
   763                     sizeChanged = true;
   755                     sizeChanged = true;
   764                 }
   756                 }
   765                 if (sizeChanged) {
   757                 if (sizeChanged) {
   766                     d->mContents->resize(newSize);
   758                     d->mContents->resize(newSize);
   767                 } else {
       
   768                     d->adjustContent();
       
   769                 }
   759                 }
       
   760                 d->adjustContent();
   770             }
   761             }
   771         }
   762         }
   772     }
   763     }
   773   return value;
   764   return value;
   774 }
   765 }
   775 
   766 
   776 /*!
   767 /*!
   777    \reimp
   768     Reimplemented from QObject.
   778  */
   769  */
   779 bool HbScrollArea::eventFilter(QObject *obj, QEvent *event)
   770 bool HbScrollArea::eventFilter(QObject *obj, QEvent *event)
   780 {
   771 {
   781     Q_UNUSED(obj);
   772     Q_UNUSED(obj);
   782     Q_D(HbScrollArea);
   773     Q_D(HbScrollArea);
   783     if (event && event->type() == QEvent::GraphicsSceneResize) {
   774     if (event && event->type() == QEvent::GraphicsSceneResize) {
   784         if (isVisible()) {            
   775         //If layoutdirection is from right to left, we expand the contentwidget to the left
       
   776         //instead of the right
       
   777         if (layoutDirection() == Qt::RightToLeft) {
       
   778             QGraphicsSceneResizeEvent *resizeEvent = static_cast<QGraphicsSceneResizeEvent*>(event);
       
   779             if (resizeEvent) {
       
   780                 qreal xChange = resizeEvent->newSize().width() - resizeEvent->oldSize().width();
       
   781                 qreal newXPos = d->mContents->pos().x() - xChange;
       
   782                 d->mContents->setPos(newXPos, d->mContents->pos().y());
       
   783             }
       
   784         }
       
   785         if (isVisible()) {
   785             d->adjustContent();
   786             d->adjustContent();
   786         }
   787         }
   787 
   788 
   788         if (d->mAbleToScrollX && d->mHorizontalScrollBar->isVisible()) {
   789         if (d->mAbleToScrollX && d->mHorizontalScrollBar && d->mHorizontalScrollBar->isVisible()) {
   789             d->updateScrollBar(Qt::Horizontal);
   790             d->updateScrollBar(Qt::Horizontal);
   790         }
   791         }
   791 
   792 
   792         if (d->mAbleToScrollY && d->mVerticalScrollBar->isVisible()) {
   793         if (d->mAbleToScrollY && d->mVerticalScrollBar && d->mVerticalScrollBar->isVisible()) {
   793             d->updateScrollBar(Qt::Vertical);
   794             d->updateScrollBar(Qt::Vertical);
   794         }
   795         }
   795     }  // no else
   796     }  // no else
   796 
   797 
   797     return false;
   798     return false;
   798 }
   799 }
   799 
   800 
   800 /*!
   801 /*!
   801     \reimp
   802     Reimplemented from QGraphicsWidget.
   802 */
   803  */
   803 QSizeF HbScrollArea::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
   804 QSizeF HbScrollArea::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
   804 {
   805 {
   805     Q_D ( const HbScrollArea );
   806     Q_D ( const HbScrollArea );
   806 
   807 
   807     QSizeF sh(0, 0);
   808     QSizeF sh(0, 0);
   809     switch (which) {
   810     switch (which) {
   810         case Qt::MinimumSize:
   811         case Qt::MinimumSize:
   811             break;
   812             break;
   812         case Qt::PreferredSize:
   813         case Qt::PreferredSize:
   813             if (d->mContents) {
   814             if (d->mContents) {
   814                 sh = d->mContents->effectiveSizeHint( which, constraint );
   815                 sh = d->mContents->effectiveSizeHint( which );
   815             } else {
   816             } else {
   816                 sh = HbWidget::sizeHint( which, constraint );
   817                 sh = HbWidget::sizeHint( which, constraint );
   817             }
   818             }
   818             break;
   819             break;
   819         case Qt::MaximumSize:
   820         case Qt::MaximumSize:
   826     
   827     
   827     return sh;
   828     return sh;
   828 }
   829 }
   829 
   830 
   830 /*!
   831 /*!
   831  \reimp
   832     \reimp
   832  */
   833  */
   833 void HbScrollArea::focusOutEvent( QFocusEvent *event )
   834 void HbScrollArea::focusOutEvent( QFocusEvent *event )
   834 {
   835 {
   835     Q_D ( HbScrollArea );
   836     Q_D ( HbScrollArea );
   836     Q_UNUSED ( event );
   837     Q_UNUSED ( event );
   868 }
   869 }
   869 
   870 
   870 #endif
   871 #endif
   871 
   872 
   872 /*!
   873 /*!
   873     Returns the scrollbar policy for vertical scrollbar
   874     Returns the display policy for the vertical scrollbar.
   874 
   875 
   875     \sa horizontalScrollBarPolicy(), setVerticalScrollBarPolicy()
   876     \sa horizontalScrollBarPolicy(), setVerticalScrollBarPolicy()
   876 */
   877  */
   877 HbScrollArea::ScrollBarPolicy HbScrollArea::verticalScrollBarPolicy() const
   878 HbScrollArea::ScrollBarPolicy HbScrollArea::verticalScrollBarPolicy() const
   878 {
   879 {
   879     Q_D(const HbScrollArea);
   880     Q_D(const HbScrollArea);
   880     return d->mVerticalScrollBarPolicy;
   881     return d->mVerticalScrollBarPolicy;
   881 }
   882 }
   882 
   883 
   883 /*!
   884 /*!
   884     Sets the policy for vertical scrollbar
   885     Sets the display policy for the vertical scrollbar. The possible values are
   885 
   886     defined by the HbScrollArea::ScrollBarPolicy enum. The default value is
   886     The default policy is HbScrollArea::ScrollBarAutoHide.
   887     HbScrollArea::ScrollBarAutoHide.
   887 
   888 
   888     \sa setHorizontalScrollBarPolicy(), verticalScrollBarPolicy()
   889     \sa setHorizontalScrollBarPolicy(), verticalScrollBarPolicy(), setVerticalScrollBar()
   889 */
   890 */
   890 void HbScrollArea::setVerticalScrollBarPolicy(ScrollBarPolicy policy)
   891 void HbScrollArea::setVerticalScrollBarPolicy(ScrollBarPolicy policy)
   891 {
   892 {
   892     Q_D(HbScrollArea);
   893     Q_D(HbScrollArea);
   893     d->setScrollBarPolicy(Qt::Vertical, policy);
   894     d->setScrollBarPolicy(Qt::Vertical, policy);
   894 }
   895 }
   895 
   896 
   896 /*!
   897 /*!
   897   Returns the vertical scroll bar.
   898     Returns the vertical scroll bar.
   898 
   899 
   899   \sa verticalScrollBarPolicy(), horizontalScrollBar()
   900     \sa verticalScrollBarPolicy(), horizontalScrollBar()
   900  */
   901  */
   901 HbScrollBar *HbScrollArea::verticalScrollBar() const
   902 HbScrollBar *HbScrollArea::verticalScrollBar() const
   902 {
   903 {
   903     Q_D(const HbScrollArea);
   904     Q_D(const HbScrollArea);
       
   905     if (!d->mVerticalScrollBar) {
       
   906         const_cast<HbScrollAreaPrivate *>(d)->createScrollBars(Qt::Vertical);
       
   907     }
   904     return d->mVerticalScrollBar;
   908     return d->mVerticalScrollBar;
   905 }
   909 }
   906 
   910 
   907 /*!
   911 /*!
   908    Replaces the existing vertical scroll bar with \a scrollBar. The former
   912     Replaces the existing vertical scroll bar with \a scrollBar. The former
   909    scroll bar is deleted.
   913     scroll bar is deleted.
   910 
   914 
   911    HbScrollArea already provides vertical and horizontal scroll bars by
   915     %HbScrollArea provides provides vertical and horizontal scroll bars by default.
   912    default. You can call this function to replace the default vertical
   916     Call this function to replace the default vertical scroll bar with your own
   913    scroll bar with your own custom scroll bar.
   917     custom scroll bar, if required.
   914 
   918 
   915    \sa verticalScrollBar(), setHorizontalScrollBar()
   919     \sa verticalScrollBar(), setHorizontalScrollBar()
   916 */
   920  */
   917 void HbScrollArea::setVerticalScrollBar(HbScrollBar *scrollBar)
   921 void HbScrollArea::setVerticalScrollBar(HbScrollBar *scrollBar)
   918 {
   922 {
   919     Q_D(HbScrollArea);
   923     Q_D(HbScrollArea);
   920     if (!scrollBar) {
   924     if (!scrollBar) {
   921         qWarning("HbScrollArea::setVerticalScrollBar: Cannot set a null scroll bar");
   925         qWarning("HbScrollArea::setVerticalScrollBar: Cannot set a null scroll bar");
   924 
   928 
   925     d->replaceScrollBar(Qt::Vertical, scrollBar);
   929     d->replaceScrollBar(Qt::Vertical, scrollBar);
   926 }
   930 }
   927 
   931 
   928 /*!
   932 /*!
   929     \brief Returns the policy for horizontal scrollbar
   933     Returns the display policy for the horizontal scrollbar.
   930 
   934 
   931     \sa verticalScrollBarPolicy(), setHorizontalScrollBarPolicy()
   935     \sa verticalScrollBarPolicy(), setHorizontalScrollBarPolicy()
   932 */
   936  */
   933 HbScrollArea::ScrollBarPolicy HbScrollArea::horizontalScrollBarPolicy() const
   937 HbScrollArea::ScrollBarPolicy HbScrollArea::horizontalScrollBarPolicy() const
   934 {
   938 {
   935     Q_D(const HbScrollArea);
   939     Q_D(const HbScrollArea);
   936     return d->mHorizontalScrollBarPolicy;
   940     return d->mHorizontalScrollBarPolicy;
   937 }
   941 }
   938 
   942 
   939 /*!
   943 /*!
   940     \brief Sets the policy for horizontal scrollbar
   944     Sets the display policy for the horizontal scrollbar. The possible values are
   941 
   945     defined by the HbScrollArea::ScrollBarPolicy enum. The default value is
   942     The default policy is HbScrollArea::ScrollBarAutoHide.
   946     HbScrollArea::ScrollBarAutoHide.
   943 
   947 
   944     \sa setVerticalScrollBarPolicy(), horizontalScrollBarPolicy()
   948     \sa setVerticalScrollBarPolicy(), horizontalScrollBarPolicy(), setHorizontalScrollBar()
   945 */
   949 */
   946 void HbScrollArea::setHorizontalScrollBarPolicy(ScrollBarPolicy policy)
   950 void HbScrollArea::setHorizontalScrollBarPolicy(ScrollBarPolicy policy)
   947 {
   951 {
   948     Q_D(HbScrollArea);    
   952     Q_D(HbScrollArea);    
   949     d->setScrollBarPolicy(Qt::Horizontal, policy);
   953     d->setScrollBarPolicy(Qt::Horizontal, policy);
   950 }
   954 }
   951 
   955 
   952 /*!
   956 /*!
   953   Returns the horizontal scroll bar.
   957     Returns the horizontal scroll bar.
   954 
   958 
   955   \sa horizontalScrollBarPolicy(), verticalScrollBar()
   959     \sa horizontalScrollBarPolicy(), verticalScrollBar()
   956  */
   960  */
   957 HbScrollBar *HbScrollArea::horizontalScrollBar() const
   961 HbScrollBar *HbScrollArea::horizontalScrollBar() const
   958 {
   962 {
   959     Q_D(const HbScrollArea);
   963     Q_D(const HbScrollArea);
       
   964     if (!d->mHorizontalScrollBar) {
       
   965         const_cast<HbScrollAreaPrivate *>(d)->createScrollBars(Qt::Horizontal);
       
   966     }
   960     return d->mHorizontalScrollBar;
   967     return d->mHorizontalScrollBar;
   961 }
   968 }
   962 
   969 
   963 /*!
   970 /*!
   964    Replaces the existing horizontal scroll bar with \a scrollBar. The former
   971    Replaces the existing horizontal scroll bar with \a scrollBar. The former
   965    scroll bar is deleted.
   972    scroll bar is deleted.
   966 
   973 
   967    HbScrollArea already provides vertical and horizontal scroll bars by
   974    %HbScrollArea provides vertical and horizontal scroll bars by default.
   968    default. You can call this function to replace the default horizontal
   975    Call this function to replace the default horizontal scroll bar with your
   969    scroll bar with your own custom scroll bar.
   976    own custom scroll bar, if required.
   970 
   977 
   971    \sa horizontalScrollBar(), setVerticalScrollBar()
   978    \sa horizontalScrollBar(), setVerticalScrollBar()
   972 */
   979 */
   973 void HbScrollArea::setHorizontalScrollBar(HbScrollBar *scrollBar)
   980 void HbScrollArea::setHorizontalScrollBar(HbScrollBar *scrollBar)
   974 {
   981 {
   980 
   987 
   981     d->replaceScrollBar(Qt::Horizontal, scrollBar);
   988     d->replaceScrollBar(Qt::Horizontal, scrollBar);
   982 }
   989 }
   983 
   990 
   984 /*!
   991 /*!
   985     \brief the alignment of the scroll area's widget    
   992     Sets the alignment of the scroll area's content widget. The possible values are
   986 
   993     defined by the Qt::Alignment enum.
   987     By default, the widget stays rooted to the top-left corner of the
   994 
   988     scroll area.
   995     The default value is \c Qt::AlignLeft | \c Qt::AlignTop, which roots the content
   989     \sa alignment
   996     widget in the top-left corner of the scroll area.
       
   997 
       
   998     \sa alignment()
   990 */
   999 */
   991 
  1000 
   992 void HbScrollArea::setAlignment(Qt::Alignment alignment)
  1001 void HbScrollArea::setAlignment(Qt::Alignment alignment)
   993 {
  1002 {
   994     Q_D(HbScrollArea);
  1003     Q_D(HbScrollArea);
   996     d->mResetAlignment = true;
  1005     d->mResetAlignment = true;
   997     if (d->mContents)
  1006     if (d->mContents)
   998         d->adjustContent();
  1007         d->adjustContent();
   999 }
  1008 }
  1000 /*!
  1009 /*!
  1001     \brief the alignment of the scroll area's widget
  1010     Returns the alignment of the scroll area's content widget.
  1002 
  1011 
  1003     By default, the widget stays rooted to the top-left corner of the
  1012     \sa setAlignment()
  1004     scroll area.
  1013  */
  1005     \sa setAlignment
       
  1006 */
       
  1007 Qt::Alignment HbScrollArea::alignment() const
  1014 Qt::Alignment HbScrollArea::alignment() const
  1008 {
  1015 {
  1009     Q_D(const HbScrollArea);
  1016     Q_D(const HbScrollArea);
  1010     return d->mAlignment;
  1017     return d->mAlignment;
  1011 }
  1018 }
  1012 
  1019 
  1013 
  1020 
  1014 /*!
  1021 /*!
  1015     \brief Contination indicators for scroll area
  1022     Sets the \c contuationIndicators property for the scroll area. Set
  1016 
  1023     \a indication to true if you want the scroll area to provide visual
  1017     By default continuation graphics are disabled. When continuation
  1024     feedback when scrolling is possible. The default value is false.
  1018     graphics are enabled, scroll area shows indications where it is
  1025 
  1019     possible to scroll.
  1026     \sa continuationIndicators()
  1020 
  1027  */
  1021     \sa continuationIndicators
       
  1022 */
       
  1023 
       
  1024 void HbScrollArea::setContinuationIndicators(bool indication)
  1028 void HbScrollArea::setContinuationIndicators(bool indication)
  1025 {
  1029 {
  1026     Q_D(HbScrollArea);
  1030     Q_D(HbScrollArea);
  1027     if (d->mContinuationIndicators == indication)
  1031     if (d->mContinuationIndicators == indication)
  1028         return;
  1032         return;
  1034     }
  1038     }
  1035     repolish();
  1039     repolish();
  1036 }
  1040 }
  1037 
  1041 
  1038 /*!
  1042 /*!
  1039     \brief Contination indicators for scroll area
  1043     Returns the value of the \c continuationIndicators property for the
  1040 
  1044     scroll area.
  1041     By default continuation graphics are disabled. When continuation
  1045 
  1042     graphics are enabled, scroll area shows indications where it is
  1046     \sa setContinuationIndicators()
  1043     possible to scroll.
       
  1044 
       
  1045     \sa setContinuationIndicators
       
  1046 */
  1047 */
  1047 bool HbScrollArea::continuationIndicators() const
  1048 bool HbScrollArea::continuationIndicators() const
  1048 {
  1049 {
  1049     Q_D(const HbScrollArea);
  1050     Q_D(const HbScrollArea);
  1050     return d->mContinuationIndicators;
  1051     return d->mContinuationIndicators;
  1051 }
  1052 }
  1052 
  1053 
  1053 
  1054 
  1054 /*!
  1055 
  1055     Scrolls the contents of the scroll area so that the point \a position is visible
  1056 /*!
  1056     inside the region of the scrollArea with margins specified in pixels by \a xMargin and
  1057     Scrolls the contents of the scroll area so that \a position is visible within
  1057     \a yMargin. If the specified point cannot be reached, the contents are scrolled to
  1058     the scroll area with the given margins. If the specified point cannot be shown,
  1058     the nearest valid position. The default and minimum valid value for both margins is 0 pixels.
  1059     the contents are scrolled to the nearest valid position.
  1059     Valid range for \a xMargin is between 0 and width of scrollArea, valid range for \a yMargin is
  1060 
  1060     between 0 and height of scrollArea.\a xMargin, \a yMargin, x and y values of \a position will be
  1061     \param position Defines the position within the content widget that is to be shown within
  1061     ignored depending on scrollingDirection.
  1062                the scroll area.
       
  1063     \param xMargin The width of the vertical margins in pixels. This can be between 0 and the
       
  1064                width of the scroll area. The default value is 0.
       
  1065 
       
  1066     \param yMargin The height of the horizontal margins in pixels. This can be between 0
       
  1067                and the height of the scroll area. The default value is 0.
  1062 
  1068 
  1063     \sa setScrollDirections()
  1069     \sa setScrollDirections()
  1064 */
  1070  */
  1065 void HbScrollArea::ensureVisible(const QPointF& position, qreal xMargin, qreal yMargin)
  1071 void HbScrollArea::ensureVisible(const QPointF& position, qreal xMargin, qreal yMargin)
  1066 {
  1072 {
  1067     Q_D(HbScrollArea);
  1073     Q_D(HbScrollArea);
  1068     d->ensureVisible(position, xMargin, yMargin);
  1074     d->ensureVisible(position, xMargin, yMargin);
  1069 }
  1075 }
  1070 
  1076 
  1071 /*!
  1077 /*!
  1072     Scrolls the contents of the scroll area to the \a newPosition in a given \a time.
  1078     Scrolls the contents of the scroll area to \a newPosition in the given \a time.
  1073     If the time is 0, contents is scrolled to the position instantly.
  1079     If \a time is 0, the contents are scrolled to the position immediately.
  1074 */
  1080  */
  1075 void HbScrollArea::scrollContentsTo (const QPointF& newPosition, int time) {
  1081 void HbScrollArea::scrollContentsTo (const QPointF& newPosition, int time) {
  1076     Q_D(HbScrollArea);
  1082     Q_D(HbScrollArea);
  1077 
  1083 
  1078     if (!contentWidget())
  1084     if (!contentWidget())
  1079         return;
  1085         return;
       
  1086 
       
  1087     d->stopAnimating();
       
  1088     d->stopScrolling();
  1080 
  1089 
  1081     if (time > 0){
  1090     if (time > 0){
  1082         d->startTargetAnimation (newPosition, qMax (0, time));
  1091         d->startTargetAnimation (newPosition, qMax (0, time));
  1083     } else {
  1092     } else {
  1084         scrollByAmount(newPosition - (-d->mContents->pos()));
  1093         scrollByAmount(newPosition - (-d->mContents->pos()));
  1085         d->stopScrolling();
  1094         d->stopScrolling();
  1086     }
  1095     }
  1087 }
  1096 }
  1088 
  1097 
  1089 /*!
  1098 /*!
  1090   \reimp
  1099     \reimp
  1091  */
  1100  */
  1092 void HbScrollArea::polish(HbStyleParameters& params)
  1101 void HbScrollArea::polish(HbStyleParameters& params)
  1093 {
  1102 {
  1094     Q_D(HbScrollArea);
  1103     if (isVisible()) {
  1095 
  1104         Q_D(HbScrollArea);
  1096     d->doLazyInit();
  1105         d->doLazyInit();
  1097 
  1106 
  1098     // fetch scrolling parameters from css
  1107         // fetch scrolling parameters from css
  1099     const QString SpeedFactor = "speed-factor";
  1108         const QLatin1String SpeedFactor("speed-factor");
  1100     const QString IntertiaSpeedFactor = "inertia-speed-factor";
  1109         const QLatin1String IntertiaSpeedFactor("inertia-speed-factor");
  1101     const QString MaxScrollSpeed = "max-scroll-speed";
  1110         const QLatin1String MaxScrollSpeed("max-scroll-speed");
  1102     const QString SpringStrength = "spring-strength";
  1111         const QLatin1String SpringStrength("spring-strength");
  1103     const QString SpringDampingFactor = "spring-damping-factor";
  1112         const QLatin1String SpringDampingFactor("spring-damping-factor");
  1104     const QString FrictionPerMilliSecond = "friction";
  1113         const QLatin1String FrictionPerMilliSecond("friction");
  1105 
  1114 
  1106     params.addParameter(SpeedFactor);
  1115         params.addParameter(SpeedFactor);
  1107     params.addParameter(IntertiaSpeedFactor);
  1116         params.addParameter(IntertiaSpeedFactor);
  1108     params.addParameter(MaxScrollSpeed);
  1117         params.addParameter(MaxScrollSpeed);
  1109     params.addParameter(SpringStrength);
  1118         params.addParameter(SpringStrength);
  1110     params.addParameter(SpringDampingFactor);
  1119         params.addParameter(SpringDampingFactor);
  1111     params.addParameter(FrictionPerMilliSecond);
  1120         params.addParameter(FrictionPerMilliSecond);
  1112     HbWidget::polish(params);
  1121         HbWidget::polish(params);
  1113 
  1122 
  1114     if (!params.value(SpeedFactor).isNull()) {
  1123         if (!params.value(SpeedFactor).isNull()) {
  1115         d->mSpeedFactor = params.value(SpeedFactor).toDouble();
  1124             d->mSpeedFactor = params.value(SpeedFactor).toDouble();
  1116     }
  1125         }
  1117     if (!params.value(IntertiaSpeedFactor).isNull()) {
  1126         if (!params.value(IntertiaSpeedFactor).isNull()) {
  1118         d->mInertiaSpeedFactor = params.value(IntertiaSpeedFactor).toDouble();
  1127             d->mInertiaSpeedFactor = params.value(IntertiaSpeedFactor).toDouble();
  1119     }
  1128         }
  1120     if (!params.value(MaxScrollSpeed).isNull()) {
  1129         if (!params.value(MaxScrollSpeed).isNull()) {
  1121         d->mMaxScrollSpeed = params.value(MaxScrollSpeed).toDouble();
  1130             d->mMaxScrollSpeed = params.value(MaxScrollSpeed).toDouble();
  1122     }
  1131         }
  1123     if (!params.value(SpringStrength).isNull()) {
  1132         if (!params.value(SpringStrength).isNull()) {
  1124         d->mSpringStrength = params.value(SpringStrength).toDouble();
  1133             d->mSpringStrength = params.value(SpringStrength).toDouble();
  1125     }
  1134         }
  1126     if (!params.value(SpringDampingFactor).isNull()) {
  1135         if (!params.value(SpringDampingFactor).isNull()) {
  1127         d->mSpringDampingFactor = params.value(SpringDampingFactor).toDouble();
  1136             d->mSpringDampingFactor = params.value(SpringDampingFactor).toDouble();
  1128     }
  1137         }
  1129     if (!params.value(FrictionPerMilliSecond).isNull()) {
  1138         if (!params.value(FrictionPerMilliSecond).isNull()) {
  1130         d->mFrictionPerMilliSecond = params.value(FrictionPerMilliSecond).toDouble();
  1139             d->mFrictionPerMilliSecond = params.value(FrictionPerMilliSecond).toDouble();
  1131     }
  1140         }
  1132     if (d->mContinuationIndicators) {
  1141         if (d->mContinuationIndicators) {
  1133         d->updateIndicators(-d->mContents->pos());
  1142             d->updateIndicators(-d->mContents->pos());
  1134     }
  1143         }
  1135 }
  1144     } else {
  1136 
  1145         HbWidget::polish(params);
  1137 /*!
  1146     }
  1138   \reimp
  1147 }
  1139 
  1148 
       
  1149 /*!
       
  1150     Reimplemented from QObject.
  1140  */
  1151  */
  1141 void HbScrollArea::timerEvent(QTimerEvent *event)
  1152 void HbScrollArea::timerEvent(QTimerEvent *event)
  1142 {
  1153 {
  1143     Q_D(HbScrollArea);
  1154     Q_D(HbScrollArea);
  1144     if (event->timerId() == d->mScrollTimerId) {
  1155     if (event->timerId() == d->mScrollTimerId) {
  1147         d->_q_hideScrollBars();
  1158         d->_q_hideScrollBars();
  1148     }
  1159     }
  1149 }
  1160 }
  1150 
  1161 
  1151 /*!
  1162 /*!
  1152     \reimp
  1163     Reimplemented from QGraphicsWidget.
  1153 */
  1164  */
       
  1165 QPainterPath HbScrollArea::shape() const
       
  1166 {
       
  1167     Q_D(const HbScrollArea);
       
  1168     if ( d->mClearCachedRect){
       
  1169         d->reCalculateCachedValue();
       
  1170     }
       
  1171     return d->mShape;
       
  1172 }
       
  1173 
       
  1174 /*!
       
  1175     Reimplemented from QGraphicsWidget.
       
  1176  */
       
  1177 QRectF HbScrollArea::boundingRect() const
       
  1178 
       
  1179 {
       
  1180     Q_D(const HbScrollArea);
       
  1181     if (d->mClearCachedRect) {
       
  1182         d->reCalculateCachedValue();
       
  1183     }
       
  1184     return d->mBoundingRect;
       
  1185 }
       
  1186 
       
  1187 /*!
       
  1188     Reimplemented from QGraphicsWidget.
       
  1189  */
       
  1190 void HbScrollArea::setGeometry(const QRectF& rect)
       
  1191 {
       
  1192     Q_D(HbScrollArea);
       
  1193     d->mClearCachedRect = true;
       
  1194     HbWidget::setGeometry(rect);
       
  1195 }
       
  1196 
       
  1197 /*!
       
  1198     Reimplemented from QObject.
       
  1199  */
  1154 void HbScrollArea::disconnectNotify (const char *signal)
  1200 void HbScrollArea::disconnectNotify (const char *signal)
  1155 {
  1201 {
  1156     Q_D(HbScrollArea);
  1202     Q_D(HbScrollArea);
  1157     if (d->mEmitPositionChangedSignal &&
  1203     if (d->mEmitPositionChangedSignal &&
  1158         QLatin1String(signal) == SIGNAL(scrollPositionChanged(QPointF))) {
  1204         QLatin1String(signal) == SIGNAL(scrollPositionChanged(QPointF))) {
  1162     }
  1208     }
  1163     HbWidget::disconnectNotify(signal);
  1209     HbWidget::disconnectNotify(signal);
  1164 }
  1210 }
  1165 
  1211 
  1166 /*!
  1212 /*!
  1167     \reimp
  1213     Reimplemented from QObject.
  1168 */
  1214  */
  1169 void HbScrollArea::connectNotify(const char * signal)
  1215 void HbScrollArea::connectNotify(const char * signal)
  1170 {
  1216 {
  1171     Q_D(HbScrollArea);
  1217     Q_D(HbScrollArea);
  1172     if (!d->mEmitPositionChangedSignal &&
  1218     if (!d->mEmitPositionChangedSignal &&
  1173         QLatin1String(signal) == SIGNAL(scrollPositionChanged(QPointF))) {
  1219         QLatin1String(signal) == SIGNAL(scrollPositionChanged(QPointF))) {
  1174         d->mEmitPositionChangedSignal = true;
  1220         d->mEmitPositionChangedSignal = true;
  1175     }
  1221     }
  1176     HbWidget::connectNotify(signal);
  1222     HbWidget::connectNotify(signal);
  1177 }
  1223 }
       
  1224 
       
  1225 /*!
       
  1226   Reimplemented from HbWidgetBase.
       
  1227   */
       
  1228 void HbScrollArea::initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive)
       
  1229 {
       
  1230     HbWidgetBase::initPrimitiveData(primitiveData, primitive);
       
  1231     QString itemName = HbStyle::itemName(primitive);
       
  1232 
       
  1233     HbStyleFramePrimitiveData *data = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData);
       
  1234     data->frameType = HbFrameDrawer::OnePiece;
       
  1235 
       
  1236     if (itemName == QLatin1String("continuation-indicator-top"))
       
  1237     {
       
  1238         data->frameGraphicsName = QLatin1String("qtg_graf_list_mask_t");
       
  1239     }
       
  1240     else if (itemName == QLatin1String("continuation-indicator-bottom"))
       
  1241     {
       
  1242         data->frameGraphicsName = QLatin1String("qtg_graf_list_mask_b");
       
  1243     }
       
  1244     else if (itemName == QLatin1String("continuation-indicator-left"))
       
  1245     {
       
  1246         data->frameGraphicsName = QLatin1String("qtg_graf_list_mask_l");
       
  1247     }
       
  1248     else if (itemName == QLatin1String("continuation-indicator-right"))
       
  1249     {
       
  1250         data->frameGraphicsName = QLatin1String("qtg_graf_list_mask_r");
       
  1251     }
       
  1252 }
       
  1253 
  1178 #include "moc_hbscrollarea.cpp"
  1254 #include "moc_hbscrollarea.cpp"