#include <qwhatsthis.h>
#include <qvalidator.h>
#include <qmessagebox.h>
+#include <qapplication.h>
/*!
Class: QDS_Datum::Wrapper
QWidget* widget() const;
void setWidget( QWidget* );
- virtual bool eventFilter( QObject*, QEvent* );
+ virtual void setGeometry( int x, int y, int w, int h );
+ virtual void setSizePolicy( QSizePolicy );
-protected:
- virtual void resizeEvent( QResizeEvent* );
+ virtual bool eventFilter( QObject*, QEvent* );
private:
QWidget* myWid;
};
-
QDS_Datum::Wrapper::Wrapper( QWidget* parent )
: QWidget( parent ),
myWid( 0 )
if ( myWid->parent() != this )
myWid->reparent( this, QPoint( 0, 0 ) );
+ myWid->installEventFilter( this );
+
setTabOrder( this, myWid );
setFocusProxy( myWid );
myWid->updateGeometry();
updateGeometry();
-
- myWid->installEventFilter( this );
}
bool QDS_Datum::Wrapper::eventFilter( QObject* o, QEvent* e )
{
- if ( e->type() == QEvent::Resize && o == widget() )
- {
- QResizeEvent* re = (QResizeEvent*)e;
- if ( re->size() != size() )
- resize( re->size() );
+ if ( o == widget() && ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut ) )
+ QApplication::sendEvent( this, e );
+
+ return false;
}
- return QWidget::eventFilter( o, e );
+
+void QDS_Datum::Wrapper::setSizePolicy( QSizePolicy sp )
+{
+ 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 );
}
/*!
#include "QDS.h"
-#include <qobject.h>
+#include <qwidget.h>
#include <qstring.h>
#include <qvariant.h>
#include <qguardedptr.h>
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();