How to make tabs expanding???
-
[quote author="alfah" date="1312960820"]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; }"); @ i tried like this, my first stylesheet setting disappeared!! no color red or size specificcation. yea solving this would dissolve the second problem :) alfah[/quote]
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 :
@QTabBar::tab{height:40px; width:108px; color:red;font: 9pt;}
QTabWidget::tab-bar{left:0px; }@ -
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.
-
i jus simply pasted the same code in another a new proj, new form of QWidget and i got the proj running with no errors but no tabs seen!!
I cant set the following
@
centralWidget()->setLayout(mainLayout);
@I faced with the same prob last time and the above code did it, but now since it is QWidget. .:(
-
[quote author="alfah" date="1312970956"]eddy, got the tabs displayed, but the same trouble. It works on the simulator but not on the device!! :( The gap is still there :([/quote]
Do you have any stylesheet changed on the device or is it like you didn't use a stylesheet at all?
-
stylesheet changed on the device meaning??
I havnt made any settings change.Simply created three tabs using following code
@{
ui->setupUi(this);
QTabWidget *tabWidget = new QTabWidget;
tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; }\n"
"QTabBar::tab{height:40px; width:105px; color:red;font: 9pt}\n");QWidget *pCalender = new QWidget; QWidget *pHistory = new QWidget; QWidget *pStatistics= new QWidget; 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
-
i found out somethin else too,
In the simulator, if you use Maemo Fremantle, tabs are aligned center or pushed to the left. But if nokia symbian^3 simulator is used, the same problem occurs, the tabs are placed a bit off from the screen's left end.
P.S printscreen of the simulator??
alfah
-
the symbian^3 of course that's the one for your c7. The Maemo Fremantle is for another device.
But now we are a step forward. We know for symbian^3 simulator AND the device it is not working as expected.
I will test with the symbian^3 simulator myself. Maybe this is not possible due to style restrictions on Symbian^3. -
I think the reason why we cannot set the first tab aligned to the left is because there is space reserved for the arrow.
You will have to experiment with the stylesheet settings untill you find something pleasing.
At least we know we shouldn't make a bug report as I suspected earlier.
-
i found something like this in the docs
expanding : bool
This property holds when expanding is true QTabBar will expand the tabs to use the empty space.
By default the value is true.
This property was introduced in Qt 4.5.Access functions:
@
bool expanding () const
void setExpanding ( bool enabled )
@could you tell me how to use it??? Its said its set to true by default. jus giving it a try
alfah
-
have a look at "this thread.":http://developer.qt.nokia.com/forums/viewthread/2879
They didn't succeed however.the setexpanding function is protected so you will have to subclass.