[Qt-interest] how to add a scrollBar in QTabWidget
Sujan Dasmahapatra
sdh at lmwindpower.com
Wed Jul 13 14:40:33 CEST 2011
The complete example is this Samuel. Please check below.
class TabWidget: public QTabWidget
{
Q_OBJECT;
public:
TabWidget();
~TabWidget();
private:
QStringList names;
QList<QWidget *> pages;
QList<QScrollArea *> areas;
};
TabWidget::TabWidget() {
For(int i=0; i<10; i++)
{
names.append("Page " + QString::number(i+1));
areas.append(new QScrollArea(this));
pages.append(new QWidget(areas.at(i)));
areas.at(i)->setWidget(pages.at(i));
addTab(areas.at(i),names.at(i)); //names is QStringList of 10 strings.
// Now I'll create the contents in the pages.
QList <QPushButton *> buttons;
int w=50;
int h = 25;
int coordx= 20;
int coordy = 20;
int incre=0;
for(int j=0; j<20; j++)
{
buttons.append(new QPushButton(pages.at(i)));
button.at(j)->setGeometry(coordx,coordy+incre,w,h);
button.at(j)->show();
incre = incre + h + 10;
}
}
}
With these I am creating 20 buttons in each page. But I cannot see a single button with this. Any help would be highly appreciated.
Kind Regards,
Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group
Tel +91 80 66470248
Mob
sdh at lmwindpower.com
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.
-----Original Message-----
From: qt-interest-bounces+sdh=lmwindpower.com at qt.nokia.com [mailto:qt-interest-bounces+sdh=lmwindpower.com at qt.nokia.com] On Behalf Of Samuel Gaist
Sent: Wednesday, July 13, 2011 5:09 PM
To: Qt-Interest
Subject: Re: [Qt-interest] how to add a scrollBar in QTabWidget
On 13 juil. 2011, at 11:50, Sujan Dasmahapatra wrote:
> Hi Samuel
> Later I am adding a number of subwidgets int the page. .e.g edit box spinbox etc..
>
>
> Kind Regards,
>
>
> Sujan Dasmahapatra
> Project Leader, Aero Group
> Aero Group
> Tel +91 80 66470248
> Mob
> sdh at lmwindpower.com
>
> 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.
> -----Original Message-----
> From: Samuel Gaist [mailto:samuel.gaist at edeltech.ch]
> Sent: Wednesday, July 13, 2011 3:19 PM
> To: Sujan Dasmahapatra
> Subject: Re: [Qt-interest] how to add a scrollBar in QTabWidget
>
>
> On 13 juil. 2011, at 11:06, Sujan Dasmahapatra wrote:
>
>> Dear Friends
>> I want to add a scrollbar in some of the tab pages in QTabWidget. How can I achieve this. ?
>>
>> class TabWidget: public QTabWidget
>> {
>> Q_OBJECT;
>> public:
>> TabWidget();
>> ~TabWidget();
>> private:
>> QList<QWidget *> pages;
>> QList<QScrollArea *> areas;
>> };
>>
>> TabWidget::TabWidget() {
>> For(int i=0; i<10; i++)
>> {
>> areas.append(new QScrollArea(this));
>> pages.append(new QWidget(areas.at(i)));
>> areas.at(i)->setWidget(pages.at(i));
>> addTab(areas.at(i),names.at(i)); //names is QStringList of 10 strings.
>> }
>> }
>>
>> But with this its not coming I cannot see the contents in pages. Please give some suggestions. Thanks sujan
>>
>>
>> Kind Regards,
>>
>>
>> Sujan Dasmahapatra
>> Project Leader, Aero Group
>> Aero Group
>>
>> Tel +91 80 66470248
>> Mob
>> sdh at lmwindpower.com
>>
>>
>> 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.
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
> Hi,
>
> Are you aware that you are setting an empty widget to each QScrollArea ?
> Without any content you won't see anything except the background.
>
> Hope this helps
> Samuel
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
Hi,
Try to create a small, complete, example of what you are trying to achieve.
This would help us to help you.
Samuel
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list