summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/big-screen/osplitter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp
index 47f856d..b09bc94 100644
--- a/libopie/big-screen/osplitter.cpp
+++ b/libopie/big-screen/osplitter.cpp
@@ -357,108 +357,111 @@ void OSplitter::resizeEvent( QResizeEvent* res ) {
qWarning("Changng to vbox %s", name() );
changeVBox();
mode = false;
}
emit sizeChanged(mode, m_orient );
}
/*
* Adds a container to a tab either the parent tab
* or our own
*/
void OSplitter::addToTab( const Opie::OSplitterContainer& con ) {
QWidget *wid = con.widget;
// not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) );
if (m_parentTab )
m_parentTab->addTab( wid, con.icon, con.name );
else
m_tabWidget->addTab( wid, con.icon, con.name );
}
/*
* adds a container to the box
*/
void OSplitter::addToBox( const Opie::OSplitterContainer& con ) {
QWidget* wid = con.widget;
wid->reparent(m_hbox, 0, QPoint(0, 0) );
}
/*
* Removes a widget from the tab
*/
void OSplitter::removeFromTab( QWidget* wid ) {
if (m_parentTab )
m_parentTab->removePage( wid );
else
m_tabWidget->removePage( wid );
}
/*
* switches over to a OTabWidget layout
* it is recursive
*/
void OSplitter::changeTab() {
/* if we're the owner of the tab widget */
if (m_tabWidget ) {
+ raise();
+ show();
m_tabWidget->setGeometry( frameRect() );
return;
}
qWarning(" New Tab Widget %s", name() );
/*
* and add all widgets this will reparent them
* delete m_hbox set it to 0
*
*/
OTabWidget *tab;
if ( m_parentTab ) {
+ hide();
tab = m_parentTab;
/* expensive but needed cause we're called from setTabWidget and resizeEvent*/
if (!m_container.isEmpty() ) {
ContainerList::Iterator it = m_container.begin();
for (; it != m_container.end(); ++it )
m_parentTab->removePage( (*it).widget );
}
}else
tab = m_tabWidget = new OTabWidget( this );
connect(tab, SIGNAL(currentChanged(QWidget*) ),
this, SIGNAL(currentChanged(QWidget*) ) );
for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) {
qWarning("Widget is %s", (*it).name.latin1() );
addToTab( (*it) );
}
for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) {
split->reparent(this, 0, QPoint(0, 0) );
split->setTabWidget( tab );
}
delete m_hbox;
m_hbox = 0;
if (!m_tabWidget )
return;
m_tabWidget->setGeometry( frameRect() );
m_tabWidget->show();
}
/*
* changes over to a box
* this is recursive as well
*/
void OSplitter::changeHBox() {
if (m_hbox ) {
m_hbox->setGeometry( frameRect() );
return;
}
qWarning("new HBox %s", name() );
m_hbox = new QHBox( this );
commonChangeBox();
}
@@ -500,82 +503,80 @@ void OSplitter::commonChangeBox() {
// con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget)
// : static_cast<QWidget*>(split->m_hbox);
addToBox( con );
}
if (m_parentTab )
m_parentTab->addTab(m_hbox, iconName(), label() );
else {
qWarning(" setting Box geometry for %s", name() );
m_hbox->setGeometry( frameRect() );
m_hbox->show();
delete m_tabWidget;
m_tabWidget = 0;
}
}
/*
* sets the tabwidget, removes tabs, and relayouts the widget
*/
void OSplitter::setTabWidget( OTabWidget* wid) {
/* clean up cause m_parentTab will not be available for us */
if ( m_parentTab ) {
if (m_hbox )
m_parentTab->removePage( m_hbox );
else if (!m_container.isEmpty() ){
ContainerList::Iterator it = m_container.begin();
for ( ; it != m_container.end(); ++it )
m_parentTab->removePage( (*it).widget );
}
}
/* the parent Splitter changed so either make us indepent or dep */
m_parentTab = wid;
QWidget *tab = m_tabWidget;
QWidget *box = m_hbox;
m_hbox = 0; m_tabWidget = 0;
if ( layoutMode() )
changeTab();
else if (m_orient == Horizontal )
changeHBox();
else
changeVBox();
/* our own crap is added and children from change* */
- if (m_parentTab ) {
- delete tab;
- delete box;
- }
+ delete tab;
+ delete box;
}
#if 0
void OSplitter::reparentAll() {
if (m_container.isEmpty() )
return;
ContainerList::Iterator it = m_container.begin();
for ( ; it != m_container.end(); ++it )
(*it).wid->reparent(0, 0, QPoint(0, 0) );
}
#endif
/**
* @internal
*/
bool OSplitter::layoutMode()const {
if ( size().width() > m_size_policy &&
m_orient == Horizontal ) {
return false;
}else if ( size().height() > m_size_policy &&
m_orient == Vertical ) {
return false;
}
return true;
}