PDA

View Full Version : sliderrect() replacement not working..



kr_217
11th January 2011, 18:55
1. //please ignore the syntax...

ABC :: ABC()
2.
{
3.
sArea = new QScrollArea(this);
4.
SArea->setVeritcalPolicy(off);
5.
SArea->setHorizontalPolicy(off);
6.
..............
7.
.................
8.
}
9.

10.
//this will be called when when slider's value of the scrollbar changes
11.
ABC::valuechanged(int value)
12.
{
13.
//adding property value to slideroption
14.
QStyleOptionSlider* sliderOption = new QStyleOptionSlider();
15.
sliderOption->maximum = Area->verticalScrollBar()->maximum();
16.
sliderOption->minimum = Area->verticalScrollBar()->minimum();
17.
...
18.
...
19.
...
20.
int height = sArea->verticalScrollBar()->style()->subControlRect(QStyle::CC_Slider, sliderOption,QStyle::SC_SliderHandle, slider).height(); //here it always show 11 even though the element in scrollarea has be increased
21.
int y = sArea->verticalScrollBar()->style()->subControlRect(QStyle::CC_Slider, sliderOption,QStyle::SC_SliderHandle, slider).y();//here also y coordinate always show zero even though i have scroll the QWidget(here Qwidget is scrolling properly) of the scrollarea.
22.

23.
}

//I just want the height of the slider of particular scrollbar and also the y-cordinate of the slider when it slides..Please help me:crying:

kr_217
14th January 2011, 14:33
ABC :: ABC()
2.
{
3.
sArea = new QScrollArea(this);
4.
SArea->setVeritcalPolicy(off);
5.
SArea->setHorizontalPolicy(off);
6.
..............
7.
.................
8.
}
9.

10.
//this will be called when when slider's value of the scrollbar changes
11.
ABC::valuechanged(int value)
12.
{
13.
//adding property value to slideroption
14.
QStyleOptionSlider* sliderOption = new QStyleOptionSlider();
15.
sliderOption->maximum = Area->verticalScrollBar()->maximum();
16.
sliderOption->minimum = Area->verticalScrollBar()->minimum();
17.
...
18.
...
19.
...
20.
int height = sArea->verticalScrollBar()->style()->subControlRect(QStyle::CC_Slider, sliderOption,QStyle::SC_SliderHandle, slider).height(); //here it always show 11 even though the element in scrollarea has be increased
21.
int y = sArea->verticalScrollBar()->style()->subControlRect(QStyle::CC_Slider, sliderOption,QStyle::SC_SliderHandle, slider).y();//here also y coordinate always show zero even though i have scroll the QWidget(here Qwidget is scrolling properly) of the scrollarea.
22.

23.
}

//I just want the height of the slider of particular scrollbar and also the y-cordinate of the slider when it slides..Please help me