#include <QApplication>
#include <QPainter>
#include <QMouseEvent>
+#include <QLayout>
class HYDROGUI_OverviewBand : public QtxPolyRubberBand
{
int h = main->height();
QPolygon poly;
- poly.append( myOverview->fromMain( 0, 0 ) );
- poly.append( myOverview->fromMain( w, 0 ) );
- poly.append( myOverview->fromMain( w, h ) );
- poly.append( myOverview->fromMain( 0, h ) );
- poly.append( myOverview->fromMain( 0, 0 ) );
+ QPoint p1 = myOverview->fromMain( 0, 0 );
+ QPoint p2 = myOverview->fromMain( w, 0 );
+ QPoint p3 = myOverview->fromMain( w, h );
+ QPoint p4 = myOverview->fromMain( 0, h );
+ poly.append( p1 );
+ poly.append( p2 );
+ poly.append( p3 );
+ poly.append( p4 );
+ poly.append( p1 );
initGeometry( poly );
}
else
HYDROGUI_Overview::HYDROGUI_Overview( const QString& theTitle, int theMargin, QWidget* theParent )
- : QDockWidget( theParent ), myMargin( theMargin ),
+ : QFrame( theParent ), myMargin( theMargin ),
myMainView( 0 ), myViewPort( 0 ), myBand( 0 )
{
setWindowTitle( theTitle );
+ myLayout = new QGridLayout( this );
+ myLayout->setMargin( 0 );
+ myLayout->setSpacing( 0 );
+ myLayout->setRowStretch( 0, 1 );
+ myLayout->setColumnStretch( 0, 1 );
}
HYDROGUI_Overview::~HYDROGUI_Overview()
connect( aMainView->getViewPort(), SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ),
this, SLOT( OnTransformation() ) );
- myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC );
- myViewPort->setBackgroundColor( Qt::white );
+ if( !myViewPort )
+ {
+ myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC );
+ //myViewPort->setBackgroundColor( Qt::white );
- connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ),
- this, SLOT( OnMouseEvent( QMouseEvent* ) ) );
- connect( myViewPort, SIGNAL( vpResizeEvent( QResizeEvent* ) ),
- this, SLOT( OnResizeEvent( QResizeEvent* ) ) );
+ connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ),
+ this, SLOT( OnMouseEvent( QMouseEvent* ) ) );
+ connect( myViewPort, SIGNAL( vpResizeEvent( QResizeEvent* ) ),
+ this, SLOT( OnResizeEvent( QResizeEvent* ) ) );
+
+ myLayout->addWidget( myViewPort, 0, 0 );
+ }
#if defined(TEST_MODE) || defined(_DEBUG)
//qApp->installEventFilter( this );
#endif
- setWidget( myViewPort );
+ qApp->processEvents();
+
setTopView();
qApp->processEvents();
- myBand = new HYDROGUI_OverviewBand( this );
+
+ if( !myBand )
+ myBand = new HYDROGUI_OverviewBand( this );
+
myBand->update( true );
}
myViewPort->fitAll();
// Apply margins for internal area in the view port
- QRect aRect( -myMargin, -myMargin, myViewPort->width()+2*myMargin, myViewPort->height()+2*myMargin );
- myViewPort->fitRect( aRect );
+ if( myMargin>0 )
+ {
+ QRect aRect( -myMargin, -myMargin, myViewPort->width()+2*myMargin, myViewPort->height()+2*myMargin );
+ myViewPort->fitRect( aRect );
+ }
if( myBand )
myBand->update( true );
void HYDROGUI_Overview::OnTransformation()
{
- myBand->update( true );
+ if( myBand )
+ myBand->update( true );
}
QPoint HYDROGUI_Overview::fromMain( int xp, int yp ) const
break;
}*/
#endif
- return QDockWidget::eventFilter( theObject, theEvent );
+ return QFrame::eventFilter( theObject, theEvent );
}
void HYDROGUI_Overview::OnResizeEvent( QResizeEvent* )