--- a/homescreenapp/hsutils/src/hspageindicator.cpp Fri May 14 15:43:04 2010 +0300
+++ b/homescreenapp/hsutils/src/hspageindicator.cpp Thu May 27 12:46:08 2010 +0300
@@ -23,9 +23,10 @@
/*!
*/
-HsPageIndicator::HsPageIndicator(QGraphicsItem *parent)
+HsPageIndicator::HsPageIndicator(qreal spacing, QGraphicsItem *parent)
: HbWidget(parent),
- mActiveItemIndex(-1)
+ mActiveItemIndex(-1),
+ mSpacing(spacing)
{
}
@@ -46,18 +47,18 @@
mItems.clear();
mActiveItemIndex = -1;
- if (itemCount < 1 || activeItemIndex < 0 ||
+ if (itemCount < 1 || activeItemIndex < 0 ||
itemCount <= activeItemIndex) {
return;
}
for (int i = 0; i < itemCount; ++i) {
mItems << new HsPageIndicatorItem(i == activeItemIndex);
- }
+ }
mActiveItemIndex = activeItemIndex;
layoutItems();
}
-
+
/*!
*/
@@ -80,7 +81,7 @@
mItems[i]->setActive(i == activeItemIndex);
}
}
-
+
/*!
*/
@@ -107,7 +108,7 @@
*/
void HsPageIndicator::removeItem(int activeItemIndex)
-{
+{
if (activeItemIndex < 0 || itemCount() - 1 <= activeItemIndex) {
return;
}
@@ -133,12 +134,23 @@
{
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(8);
+ layout->setSpacing(mSpacing);
layout->addStretch();
foreach (HsPageIndicatorItem *item, mItems) {
item->setPreferredSize(preferredHeight(), preferredHeight());
layout->addItem(item);
- }
+ }
layout->addStretch();
setLayout(layout);
}
+
+/*!
+
+*/
+void HsPageIndicator::setSpacing(qreal spacing)
+{
+ QGraphicsLinearLayout *linearLayout = static_cast<QGraphicsLinearLayout*>(layout());
+ if (linearLayout) {
+ linearLayout->setSpacing(spacing);
+ }
+}