List Info

Thread: how to implement 'new tab' functionality as konqueror does?




how to implement 'new tab' functionality as konqueror does?
user name
2007-05-01 00:55:23
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 )

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )