summaryrefslogtreecommitdiff
path: root/libopie2/opieui
authorzecke <zecke>2005-03-06 14:04:57 (UTC)
committer zecke <zecke>2005-03-06 14:04:57 (UTC)
commit125fa91f604cf9b7f3272798e72b6725fca9e23f (patch) (side-by-side diff)
treef7d328df5173a56254b6d5c8627eb53f897d9ebe /libopie2/opieui
parentfe51b2ed0ec3bccbcac880623123d2abc5d71a4e (diff)
downloadopie-125fa91f604cf9b7f3272798e72b6725fca9e23f.zip
opie-125fa91f604cf9b7f3272798e72b6725fca9e23f.tar.gz
opie-125fa91f604cf9b7f3272798e72b6725fca9e23f.tar.bz2
-When going back from BigScreen to SmallScreen we resize the widgetstack,
show it and raise the 'main widget' This should fix all bugs alwin spotted while deploying OWidgetStack on Opie-Eye
Diffstat (limited to 'libopie2/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp
index 00194b4..ac46cca 100644
--- a/libopie2/opieui/big-screen/owidgetstack.cpp
+++ b/libopie2/opieui/big-screen/owidgetstack.cpp
@@ -288,49 +288,49 @@ void OWidgetStack::raiseWidget( QWidget* wid) {
* and raise the widget specified by the parameter.
* Note that this method does not use visibleWIdget but remembers
* the last raisedWidget
*/
void OWidgetStack::hideWidget( int id) {
/* hiding our main widget wouldn't be smart */
if ( m_mode == BigScreen && m_last != m_mWidget )
m_last->hide();
raiseWidget( id );
}
/**
* This is overloaded and only differs in the parameters
* it takes.
*/
void OWidgetStack::hideWidget( QWidget* wid) {
/* still not smart */
if ( m_mode == BigScreen && m_last != m_mWidget )
m_last->hide();
raiseWidget( wid );
}
-bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) {
+bool OWidgetStack::eventFilter( QObject*, QEvent* e) {
if ( e->type() == QEvent::Resize && !m_forced ) {
QResizeEvent *res = static_cast<QResizeEvent*>( e );
QSize size = res->size();
if ( size.width() >= mode_size )
switchTop();
else
switchStack();
}
return false;
}
/**
* @internal_resons
*/
void OWidgetStack::resizeEvent( QResizeEvent* ev ) {
QFrame::resizeEvent( ev );
if (m_mode == SmallScreen )
m_stack->setGeometry( frameRect() );
else
if (m_mWidget )
m_mWidget->setGeometry( frameRect() );
}
@@ -367,62 +367,67 @@ void OWidgetStack::setMainWindow( QWidget* wid ) {
m_mWidget = wid;
}
/**
* this is an overloaded member and only differs
* in the type of arguments.
* @see setMainWindow(QWidget*)
*/
void OWidgetStack::setMainWindow( int id) {
setMainWindow( widget( id ) );
}
/*
* this function switches to a stack ;)
*/
void OWidgetStack::switchStack() {
if (m_stack ) {
m_stack->setGeometry( frameRect() );
return;
}
m_mode = SmallScreen;
m_stack = new QWidgetStack(this);
+ m_stack->setGeometry( frameRect() );
+ m_stack->show();
connect(m_stack, SIGNAL(aboutToShow(QWidget*) ),
this, SIGNAL(aboutToShow(QWidget*) ) );
connect(m_stack, SIGNAL(aboutToShow(int) ),
this, SIGNAL(aboutToShow(int) ) );
/* now reparent the widgets... luckily QWidgetSatck does most of the work */
if (m_list.isEmpty() )
return;
QMap<int, QWidget*>::Iterator it = m_list.begin();
for ( ; it != m_list.end(); ++it )
m_stack->addWidget( it.data(), it.key() );
+ if ( m_mWidget )
+ m_stack->raiseWidget( m_mWidget );
+
}
/*
* we will switch to top level mode
* reparent the list of widgets and then delete the stack
*/
void OWidgetStack::switchTop() {
m_mode = BigScreen;
/* this works because it is guaranteed that switchStack was called at least once*/
if (!m_stack && m_mWidget) {
m_mWidget->setGeometry( frameRect() );
return;
}else if (!m_stack)
return;
if (!m_list.isEmpty() ) {
QMap<int, QWidget*>::Iterator it = m_list.begin();
for ( ; it != m_list.end(); ++it ) {
/* better than reparenting twice */
if ( it.data() == m_mWidget ) {
m_mWidget->reparent(this, 0, frameRect().topLeft() );
m_mWidget->setGeometry( frameRect() );
m_mWidget->show();