Fix size hint of video subwindows

This commit is contained in:
jfmcarreira committed 2015-01-23 17:39:22 +00:00
1 parent 56e466346b
commit dfa8fbb34e
10 files changed
+59 -20

No files matched your search

+5 -2
View File
@@ -23,6 +23,7 @@
*/
#include "PlaYUVerMdiSubWindow.h"
#include "SubWindowHandle.h"
namespace plaYUVer
{
@@ -34,11 +35,13 @@ PlaYUVerMdiSubWindow::PlaYUVerMdiSubWindow( QWidget *parent ) :
QSize PlaYUVerMdiSubWindow::sizeHint() const
{
QSize sizeHint = widget()->sizeHint();
QSize maxSize;
if( parent() )
maxSize = parentWidget()->size();
QSize sizeHint = qobject_cast<SubWindowHandle*>( widget() )->sizeHint( maxSize );
return sizeHint;
}
Void PlaYUVerMdiSubWindow::closeEvent( QCloseEvent *event )
{
emit aboutToClose( this );
+2 -2
View File
@@ -32,7 +32,7 @@ namespace plaYUVer
class PlaYUVerMdiArea: public QMdiArea
{
public:
PlaYUVerMdiArea( QWidget *parent = 0 ) :
PlaYUVerMdiArea( QWidget *parent ) :
QMdiArea( parent ),
m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
{
@@ -138,7 +138,7 @@ Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowHandle *window, Qt::WindowF
}
if( m_uiWindowMode == MdiWSubWindows )
{
PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow( this );
PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow;
mdiSubWindow->setWidget( window );
m_pcMdiArea->addSubWindow( mdiSubWindow );
m_apcMdiSubWindowList.append( mdiSubWindow );
+1 -1
View File
@@ -45,7 +45,7 @@ class PlaYUVerSubWindowHandle: public QWidget
Q_OBJECT
public:
PlaYUVerSubWindowHandle( QWidget *parent = 0 );
PlaYUVerSubWindowHandle( QWidget *parent );
Void addSubWindow( SubWindowHandle *widget, Qt::WindowFlags flags = 0 );
+6
View File
@@ -110,5 +110,11 @@ Void PlotSubWindow::scaleView( Double scale, QPoint center )
//{
//
//}
//
//
//QSize PlotSubWindow::sizeHint( const QSize & maxSize ) const
//{
//
//}
} // NAMESPACE
+7 -1
View File
@@ -63,7 +63,13 @@ public:
{
return 0;
}
//QSize sizeHint() const;
/**
* Size related functions
*/
// QSize sizeHint() const;
// QSize sizeHint( const QSize & ) const;
};
} // NAMESPACE
+5
View File
@@ -132,6 +132,11 @@ Bool SubWindowHandle::mayClose()
return true;
}
QSize SubWindowHandle::sizeHint( const QSize & ) const
{
return QSize();
}
Void SubWindowHandle::focusInEvent( QFocusEvent * event )
{
emit aboutToActivate( this );
+12 -2
View File
@@ -80,6 +80,16 @@ public:
virtual Double getScaleFactor() = 0;
/**
* Size related functions
*/
//virtual QSize sizeHint() const;
virtual QSize sizeHint( const QSize & ) const;
/**
* Window name
*/
Void setWindowName( QString );
QString getWindowName();
@@ -91,8 +101,8 @@ public:
}
protected:
virtual void focusInEvent( QFocusEvent * event );
virtual void closeEvent( QCloseEvent *event );
void focusInEvent( QFocusEvent * event );
void closeEvent( QCloseEvent *event );
QSize getScrollSize();
Q_SIGNALS:
+12 -9
View File
@@ -93,6 +93,7 @@ VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) :
connect( m_cViewArea, SIGNAL( positionChanged( const QPoint & ) ), this, SLOT( updatePixelValueStatusBar( const QPoint & ) ) );
// Define the cViewArea as the widget inside the scroll area
m_cViewArea->setMinimumSize( size() );
setWidget( m_cViewArea );
m_apcCurrentModule.clear();
@@ -454,8 +455,7 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
QSize VideoSubWindow::sizeHint() const
{
QSize maxSize; // The size of the parent (viewport widget
// of the QMdiArea).
QSize maxSize;
QWidget *p = parentWidget();
if( p )
@@ -466,7 +466,11 @@ QSize VideoSubWindow::sizeHint() const
{
maxSize = QApplication::desktop()->availableGeometry().size();
}
return sizeHint( maxSize );
}
QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const
{
QSize isize;
if( m_pcCurrFrame )
isize = QSize( m_pcCurrFrame->getWidth() + 50, m_pcCurrFrame->getHeight() + 50 );
@@ -475,17 +479,16 @@ QSize VideoSubWindow::sizeHint() const
// If the VideoSubWindow needs more space that the avaiable, we'll give
// to the subwindow a reasonable size preserving the image aspect ratio.
if( isize.width() < maxSize.width() && isize.height() < maxSize.height() )
{
return isize;
}
else
if( !( isize.width() < maxSize.width() && isize.height() < maxSize.height() ) )
{
isize.scale( maxSize, Qt::KeepAspectRatio );
maxSize = isize;
}
return isize;
}
return maxSize;
Void VideoSubWindow::resizeEvent( QResizeEvent * event )
{
m_cViewArea->setMinimumSize( size() );
}
Void VideoSubWindow::closeEvent( QCloseEvent *event )
+7 -1
View File
@@ -172,7 +172,12 @@ public:
return m_cViewArea->getZoomFactor();
}
QSize sizeHint() const;
/**
* Size related functions
*/
QSize sizeHint() const ;
QSize sizeHint( const QSize & ) const ;
Void setWindowShortName( const QString& name)
{
@@ -193,6 +198,7 @@ public:
}
protected:
void resizeEvent(QResizeEvent * event);
void closeEvent( QCloseEvent *event );
public Q_SLOTS:
+2 -2
View File
@@ -87,8 +87,8 @@ Void plaYUVerApp::parseArgs( Int argc, Char *argv[] )
{
loadFile( argv[i] );
}
m_pcWindowHandle->tileSubWindows();
zoomToFitAll();
// m_pcWindowHandle->tileSubWindows();
// zoomToFitAll();
}
}