From 24fb6a5c0c10144a0b072781d72ee79c6d1abd19 Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 20 Dec 2006 10:36:35 +0000 Subject: [PATCH] no message --- src/QDS/QDS_Datum.cxx | 66 ++++++++++++++++++++----------------------- src/QDS/QDS_Datum.h | 8 +++--- src/QDS/QDS_Table.cxx | 3 ++ 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index 419ce1d88..848fe6a04 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -12,6 +12,7 @@ #include #include #include +#include /*! Class: QDS_Datum::Wrapper @@ -27,16 +28,15 @@ public: 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 ) @@ -71,32 +71,37 @@ void QDS_Datum::Wrapper::setWidget( QWidget* wid ) 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() ); } /*! @@ -497,10 +502,15 @@ void QDS_Datum::setEnabled( bool on ) 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; + } } /*! @@ -509,14 +519,7 @@ void QDS_Datum::setShown( const bool visible, const int flags ) */ 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 ); } /*! @@ -525,14 +528,7 @@ void QDS_Datum::show( const int 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 ); } /*! diff --git a/src/QDS/QDS_Datum.h b/src/QDS/QDS_Datum.h index 3a1a92985..4e98daf6c 100644 --- a/src/QDS/QDS_Datum.h +++ b/src/QDS/QDS_Datum.h @@ -3,7 +3,7 @@ #include "QDS.h" -#include +#include #include #include #include @@ -64,9 +64,9 @@ public: 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(); diff --git a/src/QDS/QDS_Table.cxx b/src/QDS/QDS_Table.cxx index 12e796314..33bcfa7d6 100644 --- a/src/QDS/QDS_Table.cxx +++ b/src/QDS/QDS_Table.cxx @@ -288,6 +288,9 @@ QWidget* QDS_Table::createEditor( int row, int col, bool init ) const else wid = QtxTable::createEditor( row, col, init ); + if ( wid ) + wid->setMinimumSize( 0, 0 ); + return wid; } -- 2.39.2