From 159deeaab8646b0fdaf285b11b7a16e95be33814 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 20 Jul 2012 20:31:47 +0200 Subject: [PATCH] FIXED: #1471 The rendered image should no longer disappear from NelGUI widget, when resizing another widget. --- .../src/plugins/gui_editor/nel3d_widget.cpp | 33 ++++++++++-------- .../src/plugins/gui_editor/nel3d_widget.h | 34 +++++++++++-------- .../src/plugins/gui_editor/nelgui_widget.cpp | 5 +++ .../src/plugins/gui_editor/nelgui_widget.h | 3 ++ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp index 8f211057f..089158913 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp @@ -1,17 +1,17 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . @@ -29,6 +29,11 @@ namespace GUIEditor { driver = NULL; textContext = NULL; + + // Need to set this attribute with a NULL paintengine returned to Qt + // so that we can render the widget normally ourselves, without the image + // disappearing when a widget is resized or shown on top of us + setAttribute( Qt::WA_PaintOnScreen, true ); } Nel3DWidget::~Nel3DWidget() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h index cfb634916..7779ed389 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h @@ -1,17 +1,17 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . @@ -43,6 +43,12 @@ namespace GUIEditor NL3D::UDriver* getDriver() const{ return driver; } NL3D::UTextContext* getTextContext() const{ return textContext; } + + // Need to return NULL paintengine to Qt so that we can + // render the widget normally ourselves, without the image + // disappearing when a widget is resized or shown on top of us + QPaintEngine* paintEngine() const{ return NULL; } + public Q_SLOTS: void clear(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp index c8ce78123..e9cf2713b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp @@ -96,5 +96,10 @@ namespace GUIEditor CWidgetManager::getInstance()->drawViews( 0 ); getDriver()->swapBuffers(); } + + void NelGUIWidget::paintEvent( QPaintEvent *evnt ) + { + draw(); + } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h index c00d25c04..8d2ee3ad5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h @@ -35,6 +35,9 @@ namespace GUIEditor bool parse( SProjectFiles &files ); void draw(); + protected: + void paintEvent( QPaintEvent *evnt ); + }; }