Start implementation of detached window mode. Hide scrollbars in viewArea.

This commit is contained in:
Luis Lucas committed 2015-01-20 00:16:48 +00:00
1 parent 85143f0236
commit 69cd20ab59
6 files changed
+27 -31

No files matched your search

+1 -1
View File
@@ -37,7 +37,7 @@ PlotSubWindow::PlotSubWindow( QWidget * parent ) :
setVisible( false );
m_cPlotArea = new QCustomPlot( this );
setMainWidget( m_cPlotArea );
setWidget( m_cPlotArea );
Example();
+14 -19
View File
@@ -28,19 +28,20 @@ namespace plaYUVer
{
SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
QMdiSubWindow( parent )
QScrollArea( parent )
{
setParent( parent );
setAttribute( Qt::WA_DeleteOnClose );
setBackgroundRole( QPalette::Light );
// Create a new scroll area inside the sub-window
m_cScrollArea = new QScrollArea( this );
connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
connect( horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
connect( verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
setWidget( m_cScrollArea );
m_cScrollArea->setWidgetResizable( true );
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setWidgetResizable( true );
m_cLastScroll = QPoint();
@@ -50,25 +51,19 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
SubWindowHandle::~SubWindowHandle()
{
delete m_cScrollArea;
}
Void SubWindowHandle::setMainWidget( QWidget *widget )
{
m_cScrollArea->setWidget( widget );
}
QSize SubWindowHandle::getScrollSize()
{
return QSize( m_cScrollArea->viewport()->size().width() - 5, m_cScrollArea->viewport()->size().height() - 5 );
return QSize( viewport()->size().width() - 5, viewport()->size().height() - 5 );
}
Void SubWindowHandle::adjustScrollBarByOffset( QPoint Offset )
{
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
QScrollBar *scrollBar = horizontalScrollBar();
scrollBar->setValue( int( scrollBar->value() + Offset.x() ) );
m_cLastScroll.setX( scrollBar->value() );
scrollBar = m_cScrollArea->verticalScrollBar();
scrollBar = verticalScrollBar();
scrollBar->setValue( int( scrollBar->value() + Offset.y() ) );
m_cLastScroll.setY( scrollBar->value() );
updateLastScrollValue();
@@ -78,7 +73,7 @@ Void SubWindowHandle::adjustScrollBarByOffset( QPoint Offset )
// http://stackoverflow.com/questions/13155382/jscrollpane-zoom-relative-to-mouse-position
Void SubWindowHandle::adjustScrollBarByScale( Double scale, QPoint center )
{
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
QScrollBar *scrollBar = horizontalScrollBar();
if( center.isNull() )
{
scrollBar->setValue( int( scale * scrollBar->value() + ( ( scale - 1 ) * scrollBar->pageStep() / 2 ) ) );
@@ -94,7 +89,7 @@ Void SubWindowHandle::adjustScrollBarByScale( Double scale, QPoint center )
scrollBar->setValue( value );
}
scrollBar = m_cScrollArea->verticalScrollBar();
scrollBar = verticalScrollBar();
if( center.isNull() )
{
scrollBar->setValue( int( scale * scrollBar->value() + ( ( scale - 1 ) * scrollBar->pageStep() / 2 ) ) );
@@ -115,9 +110,9 @@ Void SubWindowHandle::adjustScrollBarByScale( Double scale, QPoint center )
Void SubWindowHandle::updateLastScrollValue()
{
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
QScrollBar *scrollBar = horizontalScrollBar();
m_cLastScroll.setX( scrollBar->value() );
scrollBar = m_cScrollArea->verticalScrollBar();
scrollBar = verticalScrollBar();
m_cLastScroll.setY( scrollBar->value() );
}
+1 -3
View File
@@ -36,12 +36,11 @@
namespace plaYUVer
{
class SubWindowHandle: public QMdiSubWindow
class SubWindowHandle: public QScrollArea
{
Q_OBJECT
private:
QScrollArea* m_cScrollArea;
QPoint m_cLastScroll;
UInt m_uiCategory;
@@ -92,7 +91,6 @@ public:
protected:
virtual void closeEvent( QCloseEvent *event ) = 0;
virtual Void setMainWidget( QWidget *widget );
QSize getScrollSize();
Q_SIGNALS:
+1 -1
View File
@@ -93,7 +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
setMainWidget( m_cViewArea );
setWidget( m_cViewArea );
m_apcCurrentModule.clear();
+2 -1
View File
@@ -34,7 +34,6 @@
#include <QPixmapCache>
#include <QRectF>
#include <QDebug>
#include "ViewArea.h"
#include "GridManager.h"
@@ -66,6 +65,7 @@ ViewArea::ViewArea( QWidget *parent ) :
m_snapToGrid = false;
m_blockTrackEnable = false;
m_pStream = NULL;
}
void ViewArea::setImage( PlaYUVerFrame* pcFrame )
@@ -346,6 +346,7 @@ void ViewArea::paintEvent( QPaintEvent *event )
painter.restore();
// Draw a border around the image.
/* if( m_xOffset || m_yOffset )
{
+8 -6
View File
@@ -72,6 +72,7 @@ plaYUVerApp::plaYUVerApp()
setAcceptDrops( true );
mdiArea->setAcceptDrops( true );
//mdiArea->hide();
connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( update() ) );
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
@@ -167,7 +168,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
VideoSubWindow *videoSubWindow = plaYUVerApp::findVideoSubWindow( mdiArea, fileName );
if( videoSubWindow )
{
mdiArea->setActiveSubWindow( videoSubWindow );
//mdiArea->setActiveSubWindow( videoSubWindow );
return;
}
videoSubWindow = new VideoSubWindow( this ); //createSubWindow();
@@ -190,15 +191,16 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
if( opened )
{
statusBar()->showMessage( tr( "Loading file..." ) );
mdiArea->addSubWindow( videoSubWindow );
//mdiArea->addSubWindow( videoSubWindow );
videoSubWindow->setWindowFlags(Qt::Window);
videoSubWindow->show();
connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) );
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( zoomToFactorAll( double, QPoint ) ) );
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
// connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( zoomToFactorAll( double, QPoint ) ) );
// connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
videoSubWindow->zoomToFit();
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool ) m_uiViewTool );
@@ -510,7 +512,7 @@ void plaYUVerApp::tileSubWindows()
SubWindowHandle *plaYUVerApp::activeSubWindow()
{
if( QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow() )
return qobject_cast<SubWindowHandle *>( activeSubWindow );
return qobject_cast<SubWindowHandle *>( activeSubWindow->widget() );
return 0;
}
@@ -675,7 +677,7 @@ Void plaYUVerApp::updateWindowMenu()
for( Int i = 0; i < number_windows; ++i )
{
SubWindowHandle *child = qobject_cast<SubWindowHandle *>( windows.at( i ) );
SubWindowHandle *child = qobject_cast<SubWindowHandle *>( windows.at(i)->widget());
QString text;
if( i < 9 )