Author: sh-sh-sh Date: Fri Apr 11 17:14:00 2008 New Revision: 46432 URL: http://svn.opensuse.org/viewcvs/yast?rev=46432&view=rev Log: use new methods Modified: trunk/qt/src/YQWizard.cc trunk/qt/src/YQWizard.h Modified: trunk/qt/src/YQWizard.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.cc?rev=46432&... ============================================================================== --- trunk/qt/src/YQWizard.cc (original) +++ trunk/qt/src/YQWizard.cc Fri Apr 11 17:14:00 2008 @@ -605,6 +605,7 @@ QWidget *YQWizard::layoutWorkArea( QWidget * parent ) { _workingDock = new QStackedWidget( parent ); + _workingDock->installEventFilter( this ); QFrame *workArea = new QFrame( _workingDock ); workArea->setObjectName( "work_area" ); @@ -1064,17 +1065,44 @@ void YQWizard::resizeClientArea() { - yuiDebug() << "resizing client area" << endl; + yuiDebug() << "Resizing client area" << endl; QRect contentsRect = _clientArea->contentsRect(); _contents->setSize( contentsRect.width(), contentsRect.height() ); } + bool YQWizard::eventFilter( QObject * obj, QEvent * ev ) { - if ( ev->type() == QEvent::Resize && obj == _contents ) + if ( ev->type() == QEvent::Resize ) { - resizeClientArea(); - return true; // Event handled + if ( obj == _contents ) + { + resizeClientArea(); + return true; // Event handled + } + + if ( obj == _workingDock ) + { + yuiWarning() << "Resize event for _workingDock; currentWidget: " + << hex << (void *) _workingDock->currentWidget() << dec << endl; + + YQWizard * wizard = dynamic_cast<YQWizard *> ( _workingDock->currentWidget() ); + + if ( wizard ) + { + yuiWarning() << "Resizing sub-wizard" << wizard << endl; + QRect contentsRect = _workingDock->contentsRect(); + + YWizard * yWizard = (YWizard *) wizard; + yWizard->setSize( contentsRect.width(), contentsRect.height() ); + + return true; // Event handled + } + } + else + { + yuiWarning() << "Unknown resize event: " << hex << (void *) obj << dec << endl; + } } return QWidget::eventFilter( obj, ev ); @@ -1088,7 +1116,8 @@ YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (button); - if ( wizardButton ) { + if ( wizardButton ) + { // QWizardButton only implements hide and show, not setVisible if ( newLabel.empty() ) wizardButton->hide(); @@ -1153,37 +1182,44 @@ YUI_THROW( YUIInvalidChildException<YWidget>( this, ySubWizard ) ); yuiMilestone() << "Docking sub-wizard " << ySubWizard << " to " << this << endl; + + setInternalIdsEnabled( false ); // avoid duplicate widget IDs YQWizard * yqSubWizard = (YQWizard *) ySubWizard->widgetRep(); +#if 0 + ((QWidget *) yqSubWizard)->setParent( _workingDock ); +#endif + int index = _workingDock->addWidget( yqSubWizard ); yuiMilestone() << "Index " << index << endl; _workingDock->setCurrentWidget( yqSubWizard ); + yqSubWizard->installEventFilter( this ); return true; // success } -void YQWizard::deleteSubWizard() +bool YQWizard::deleteSubWizard( YWizard * subWizard ) { - YWizard * subWizard = 0; - - for ( YWidgetListConstReverseIterator it = childrenManager()->rbegin(); - it != childrenManager()->rend() && ! subWizard; - ++it ) - { - subWizard = dynamic_cast<YWizard *> (*it); - } - if ( subWizard ) { yuiMilestone() << "Deleting sub-wizard " << subWizard << endl; delete subWizard; + setInternalIdsEnabled( true ); // re-enable widget IDs if no more sub-wizard open + // FIXME (?) // FIXME (?) // FIXME (?) // Make next-lower sub-wizard visible in widget stack, if necessary + + return true; // success + } + else + { + yuiWarning() << "No more sub-wizard" << endl; + return false; // failure } } Modified: trunk/qt/src/YQWizard.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.h?rev=46432&r... ============================================================================== --- trunk/qt/src/YQWizard.h (original) +++ trunk/qt/src/YQWizard.h Fri Apr 11 17:14:00 2008 @@ -141,18 +141,17 @@ * * Return 'true' upon success, 'false' upon failure. * - * Implemented from YWizard. + * Reimplemented from YWizard. **/ virtual bool dockSubWizard( YWizard * subWizard ); - /** - * Delete the last sub-wizard of this wizard, if there is one. - * Do nothing if there is none. + * Delete a sub-wizard. + * Return 'true' upon success, 'false' upon failure. * - * Implemented from YWizard. + * Reimplemented from YWizard. **/ - virtual void deleteSubWizard(); + virtual bool deleteSubWizard( YWizard * subWizard ); // // Steps handling -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org