how to make tabs expanding???
Page |
1 |
hey everybody,
How can I make the tabs expanding?. I was able to set size of the tabs with the following
- tabWidget->setStyleSheet("QTabBar::tab{height:40px; width:108px; color:red;font: 9pt}");
but there is a small gap between the left end of the screen and the first tab, how ever the third tab touches the right end. I jus want all the three tabs to be fully expanded to the screen size.
If i increase the width to more than 108px, the tab width with increases and two scroll buttons appear at both ends. No i dont want that.
The second problem is that i cant align the tabs to the centre. If I get the solution for the first problem, I would not be needing to align the tabs to the center since it will be expanded to the screen size.
Though i found a solution like this, it does not work :(
I tried to set it like this in my code
- tabWidget->setStyleSheet("QTabWidget::tab-bar{alignment:center; }");
alfah
31 replies
eddy,
no the problem is not solved with that,
infact,
- tabWidget->setStyleSheet("QTabBar::tab{height:40px; width:108px; color:red;font: 9pt}");
- tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; }");
yea solving this would dissolve the second problem :)
alfah
eddy, no the problem is not solved with that, infact,i tried like this, my first stylesheet setting disappeared!! no color red or size specificcation. yea solving this would dissolve the second problem :) alfah
tabWidget->setStyleSheet("QTabBar::tab{height:40px; width:108px; color:red;font: 9pt}"); tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; }");
i tried it out with my code and it works on my example.
I tried your code in Qt Designer RIGHT MOUSE BUTTON click > change style sheet. You get immediately a statusbar which tells you if the stylesheet is ok or not. I suggest you to test them always there. That’s what I did and it gave me the following good result :
So it’s Symbian^3. That’s what you use in the project settings in Qt Creator or choosing as template when starting your project.
Could you make a new Symbian^3 based project use a QWidget instead of a QMainWindow and apply a QTabWidget on it with your stylesheet? I want to diagnose when this occurs and maybe QMainWindow has to follow some styling rules.
stylesheet changed on the device meaning??
I havnt made any settings change.
Simply created three tabs using following code
- {
- ui->setupUi(this);
- tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; }\n"
- "QTabBar::tab{height:40px; width:105px; color:red;font: 9pt}\n");
- pCalender->setStyleSheet("background-color: rgb(224, 220, 201);");
- pHistory->setStyleSheet("background-color: rgb(224, 220, 201);");
- pStatistics->setStyleSheet("background-color: rgb(224, 220, 201);");
- tabWidget->addTab(pCalender,tr("Calender"));
- tabWidget->addTab(pHistory,tr("History"));
- tabWidget->addTab(pStatistics,tr("Statistics"));
- mainLayout = new QVBoxLayout;
- mainLayout->addWidget(tabWidget);
- setLayout(mainLayout);
Only the above stylesheet has been used
alfah
You must log in to post a reply. Not a member yet? Register here!


