how to implement 'new tab' functionality as konqueror does?
jiang jefix
jefix214 at gmail.com
Tue May 1 06:55:23 BST 2007
hi,
i have trouble with tab tabwidget for days,somebody suggest me to ask here
when konqueror startups,i will see a 'read only text edit' central
widget with no tabs,
if i choose 'Location | New tab ', konqueror will create a tabwidget
with two tabs,if i close
a tab when total tab nums greater than 2(such as 3),konqueror remove one tab,
if i close a tab when there's only two tabs,konqueror will remove
these two tabs,
i want to know how to implement this?
i tried this:
KTabWidget *tabwidget=new KTabWidget(this);
QTextEdit *te1=new QTextEdit(this,"te1");
QTextEdit *te2=new QTextEdit(this,"te2");
tabwidget->addTab(te1,"tab1");
tabwidget->addTab(te2,"tab2");
setCentralWidget(tabwidget);
tabwidget->show();
tabwidget->showPage(te2);
now have create a tabwidget with two tabs ,each tab has a QTextEdit widget;
i use this to remove a tab:
tabwidget->removePage(tabwidget->currentPage());
but not like konqueror, i still have a tab tabbar leave
so i tried this:
tabwidget->removePage(tabwidget->currentPage());
tabwidget->hide();
setCentralWidget(te1);
te1->raise();
tel->show();
nothing leaves,everything's invisible
then i use this:
tabwidget->removePage(tabwidget->currentPage());
setCentralWidget(te1);
tabwidget->setTabBarHidden(true);
e->raise();
e->show();
well ,it almost reach: on tab leaves, can see te1 as centralwidget,but
there's a white tabbar between menubar and (QTextEdit ) te1,i have
setTabBarHiddent(true)
why the tabbar still visibal( a white area )?
i was beated,and looking for some help,
any suggestions will be appropriates,
regards
jiang jefix
( Sorry if i wrote bad English )
More information about the kfm-devel
mailing list