[Solved]creating tabs
-
ahhh, , its not workin on the simulator or the device!!
it is '/'. And i have corrected it. But still it does not work. Does image size gotta do anything with it??
ive used 16x16. its almost 900 byte -
you can test if it's available from the resource editor using a dialog in Qt Designer and set the icon from there.
-
Ive pulled in a tabWidget in the Designer. But i can only find iconsize property not the simple icon property with which you can set.
-
no you have to use code to add it to a tab.
But you could use a QLabel just for testing if the icon is reachable through the resource editor.
-
it worked in the new project, both in the device as well as the simulator.
@
ui->tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));
@I think i know why it doesn work on my application.
@
tabWidget = new QTabWidget;
tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; width:350px; }\n"
"QTabBar::tab{height:40px; width:95px; color:red; font:9pt; }\n");
tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));pCalender = new QWidget;
pHistory = new QWidget;
pStatistics= new QWidget;connect(tabWidget,SIGNAL(currentChanged(int)),this,SLOT(onSelectTab(int)));
tabWidget->addTab(pCalender,tr("Calender"));
tabWidget->addTab(pHistory,tr("History"));
tabWidget->addTab(pStatistics,tr("Statistics"));
tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));
@EDIT : solved :D
-
bq. it worked in the new project, both in the device as well as the simulator.
so you know a good approach to solve issues yourself. Sometimes a project can grow bigger and bigger. If you make a small test project like you did you can easily narrow down to the problem. Now you know for sure that the code is right.
bq. EDIT: na i don think so, cuz widgets are placed inside the tabs not on those heading.
To be sure just comment out the lines you suspect. This one is for you ;)
-
ok all advises noticed and acknowledged :)
I have solved it too,
I jus needed to place the same code after the addTab function(), :) How dumb of me! How else would it put an icon if the tab not added :D :D
-
Glad you solved it! You even start helping out others.
Keep up the good work!