Commit 59c40fb0 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Handle QVTKOpenGLWidget dropping support for caching.

Caching is unnecessary in Qt 5 and hence QVTKOpenGLWidget has dropped
support for it. Update ParaView code to handle it.
parent 6c4f02e3
......@@ -69,8 +69,10 @@ public:
, FinalRender(false)
, Rendering(false)
, LinkedWindowRendered(false)
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
, DisplayUsedCache(false)
, LinkedUsedCache(false)
#endif
, HideLinkedViewBackground(false)
{
this->ViewLinkRepresentation->ProportionalResizeOff();
......@@ -114,8 +116,10 @@ public:
bool FinalRender;
bool Rendering;
bool LinkedWindowRendered;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
bool DisplayUsedCache;
bool LinkedUsedCache;
#endif
bool HideLinkedViewBackground;
};
......@@ -147,11 +151,13 @@ pqInteractiveViewLink::pqInteractiveViewLink(pqRenderView* displayView, pqRender
return;
}
// Disable cache on widgets
// Disable cache on widgets
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
this->Internal->DisplayUsedCache = this->Internal->DisplayWidget->isAutomaticImageCacheEnabled();
this->Internal->DisplayWidget->setAutomaticImageCacheEnabled(false);
this->Internal->LinkedUsedCache = this->Internal->LinkedWidget->isAutomaticImageCacheEnabled();
this->Internal->LinkedWidget->setAutomaticImageCacheEnabled(false);
#endif
// Initialize link widget interactor and renderer
this->Internal->LinkWidget->SetInteractor(
......@@ -197,6 +203,7 @@ pqInteractiveViewLink::~pqInteractiveViewLink()
this->Internal->DisplayWindow->RemoveObserver(this->Internal->RenderedTag);
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
if (this->Internal->DisplayWidget)
{
this->Internal->DisplayWidget->setAutomaticImageCacheEnabled(this->Internal->DisplayUsedCache);
......@@ -205,6 +212,7 @@ pqInteractiveViewLink::~pqInteractiveViewLink()
{
this->Internal->LinkedWidget->setAutomaticImageCacheEnabled(this->Internal->LinkedUsedCache);
}
#endif
if (this->Internal->DisplayView)
{
......
......@@ -83,8 +83,6 @@ public:
#if defined(Q_WS_WIN) || defined(Q_OS_WIN)
this->ContextView->GetRenderWindow()->SetLineSmoothing(true);
#endif
this->View->setAutomaticImageCacheEnabled(true);
this->ContextView->GetScene()->AddItem(this->SliceItem.GetPointer());
this->SliceItem->GetAxis()->SetPoint1(10, 10);
......
......@@ -69,7 +69,10 @@ pqQVTKWidget::pqQVTKWidget(QWidget* parentObject, Qt::WindowFlags f)
, SizePropertyName("ViewSize")
, SkipHandleViewSizeForModifiedQt4(false)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// caching only support for QVTKWidget (Qt 4), and not for QVTKOpenGLWidget (Qt 5).
this->setAutomaticImageCacheEnabled(getenv("DASHBOARD_TEST_FROM_CTEST") == NULL);
#endif
// Tmp objects
QPixmap mousePixmap(":/pqCore/Icons/pqMousePick15.png");
......@@ -172,17 +175,8 @@ void pqQVTKWidget::setSession(vtkSMSession* session)
}
//----------------------------------------------------------------------------
bool pqQVTKWidget::paintCachedImage()
void pqQVTKWidget::doDeferredRender()
{
// In future we can update this code to ensure that view->Render() is never
// called from the pqQVTKWidget. For now, we are letting the default path
// execute when not resizing.
if (this->Superclass::paintCachedImage())
{
return true;
}
// despite our best efforts, it's possible that the paint event happens while
// the server manager is busy processing some other request that yields
// progress (e.g. pvcrs.UndoRedo2 test).
......@@ -190,15 +184,17 @@ bool pqQVTKWidget::paintCachedImage()
// rendering in those cases.
if (this->ViewProxy && this->ViewProxy->GetSession()->GetPendingProgress())
{
return true;
return;
}
if (this->Session && this->Session->GetPendingProgress())
{
return true;
return;
}
return false;
this->Superclass::doDeferredRender();
}
//----------------------------------------------------------------------------
vtkTypeUInt32 pqQVTKWidget::getProxyId()
{
......
......@@ -93,11 +93,10 @@ protected:
*/
virtual void resizeEvent(QResizeEvent* event);
// method called in paintEvent() to render the image cache on to the device.
// return false, if cache couldn;t be used for painting. In that case, the
// paintEvent() method will continue with the default painting code.
virtual bool paintCachedImage();
/**
* skip rendering is not ready for it.
*/
virtual void doDeferredRender();
private slots:
void updateSizeProperties();
void handleViewSizeForModifiedQt4();
......
Subproject commit dcc2f4a5d53867e020ec54dcb5a8286c7b4114fe
Subproject commit 0cf7b8e1bd76a338214397f28b1d99bf79aa897e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment