QWidget* widget() const;
void setWidget( QWidget* );
- virtual bool eventFilter( QObject*, QEvent* );
-
-protected:
- virtual void resizeEvent( QResizeEvent* );
+ virtual void setGeometry( int x, int y, int w, int h );
+ virtual void setSizePolicy( QSizePolicy );
private:
QWidget* myWid;
};
-
QDS_Datum::Wrapper::Wrapper( QWidget* parent )
: QWidget( parent ),
myWid( 0 )
if ( myWid == wid )
return;
- if ( myWid )
- myWid->removeEventFilter( this );
-
myWid = wid;
if ( !myWid )
myWid->updateGeometry();
updateGeometry();
-
- myWid->installEventFilter( this );
}
-bool QDS_Datum::Wrapper::eventFilter( QObject* o, QEvent* e )
+void QDS_Datum::Wrapper::setSizePolicy( QSizePolicy sp )
{
- if ( e->type() == QEvent::Resize && o == widget() )
- {
- QResizeEvent* re = (QResizeEvent*)e;
- if ( re->size() != size() )
- resize( re->size() );
- }
- return QWidget::eventFilter( o, e );
+ QWidget::setSizePolicy( sp );
+
+ if ( widget() )
+ widget()->setSizePolicy( sp );
}
-void QDS_Datum::Wrapper::resizeEvent( QResizeEvent* e )
+void QDS_Datum::Wrapper::setGeometry( int x, int y, int w, int h )
{
- QWidget::resizeEvent( e );
+ QWidget::setGeometry( x, y, w, h );
if ( widget() && widget()->size() != size() )
- widget()->resize( size() );
+ widget()->setGeometry( 0, 0, width(), height() );
}
/*!
*/
void QDS_Datum::setShown( const bool visible, const int flags )
{
- if ( visible )
- show( flags );
- else
- hide( flags );
+ initDatum();
+
+ uint flag = Units;
+ while ( flag )
+ {
+ if ( flags & flag && widget( flag ) )
+ widget( flag )->setShown( visible );
+ flag = flag >> 1;
+ }
}
/*!
*/
void QDS_Datum::show( const int element )
{
- initDatum();
-
- if ( ( element & Label ) && labelWidget() )
- labelWidget()->show();
- if ( ( element & Units ) && unitsWidget() )
- unitsWidget()->show();
- if ( ( element & Control ) && controlWidget() )
- controlWidget()->show();
+ setShown( true, element );
}
/*!
*/
void QDS_Datum::hide( const int element )
{
- initDatum();
-
- if ( ( element & Label ) && labelWidget() )
- labelWidget()->hide();
- if ( ( element & Units ) && unitsWidget() )
- unitsWidget()->hide();
- if ( ( element & Control ) && controlWidget() )
- controlWidget()->hide();
+ setShown( false, element );
}
/*!
virtual bool isEnabled( const int = Control ) const;
virtual void setEnabled( const bool, const int );
- void show( const int = -1 );
- void hide( const int = -1 );
- void setShown( const bool, const int = -1 );
+ void show( const int = All );
+ void hide( const int = All );
+ virtual void setShown( const bool, const int = All );
QWidget* widget( const int ) const;
void setFocus();