-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "SUIT_Application.h"
#include "SUIT_ViewManager.h"
#include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
#include "QtxActionToolMgr.h"
#include "QtxMultiAction.h"
if ( e->type() == DUMP_EVENT )
{
bool bOk = false;
- if ( myManager && myManager->study() && myManager->study()->application() )
+ SUIT_Application* app = NULL;
+ if (myManager && myManager->study() && myManager->study()->application())
+ app = myManager->study()->application();
+ QString fileName;
+ if (app)
+ fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 ); //old way
+ else
{
- // get file name
- SUIT_Application* app = myManager->study()->application();
- QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
- if ( !fileName.isEmpty() )
- {
- QImage im = dumpView();
- QString fmt = SUIT_Tools::extension( fileName ).toUpper();
- Qtx::Localizer loc;
- bOk = dumpViewToFormat( im, fileName, fmt );
- }
- else
- bOk = true; // cancelled
+ QStringList fls = filter().split( ";;", QString::SkipEmptyParts );
+ fileName = SUIT_FileDlg::getFileName( NULL, QString(), fls, tr( "TLT_DUMP_VIEW" ), false, true );
+ }
+ if ( !fileName.isEmpty() )
+ {
+ QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+ QImage im = dumpView();
+ Qtx::Localizer loc;
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
+ else
+ bOk = true; // cancelled
+
if ( !bOk )
SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
SUIT_Application* app = SUIT_Session::session()->activeApplication();
if ( app ) {
SUIT_Desktop* d = app->desktop();
- QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+ QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
foreach( SUIT_ViewWindow* vw, allViews ) {
if ( !vw || vw == this ) continue; // skip invalid views and this one
SUIT_CameraProperties otherProps = vw->cameraProperties();
SUIT_Desktop* d = app->desktop();
if ( !d ) return;
- QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+ QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
foreach( SUIT_ViewWindow* vw, allViews ) {
if ( !vw->cameraProperties().isValid() )
continue; // omit views not supporting camera properties
}
}
}
+
+void SUIT_ViewWindow::setVisible( bool on )
+{
+ // This is a workaround to avoid showing view window as a top-level window
+ // before re-parenting it to workstack (issue #23467).
+ // See SUIT_Desktop::childEvent().
+ QApplication::sendPostedEvents( 0, QEvent::ChildRemoved );
+ QApplication::sendPostedEvents( 0, QEvent::ChildAdded );
+ QApplication::sendPostedEvents( 0, QEvent::ChildPolished );
+ if ( !property( "blockShow" ).toBool() )
+ QMainWindow::setVisible( on );
+}