From 32e71ef37491d9aa3b1ba70b8335d902a1ceacfa Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 23:46:14 +0300 Subject: [PATCH] Fixed: #1193 Fixed flickering graphics viewport under windows. --- .../src/plugins/core/core_constants.h | 2 +- .../src/plugins/example/qnel_widget.cpp | 3 ++ .../plugins/object_viewer/global_wind_form.ui | 10 ++++- .../object_viewer/graphics_viewport.cpp | 38 ++----------------- .../plugins/object_viewer/graphics_viewport.h | 4 -- .../plugins/object_viewer/tune_timer_form.ui | 14 +++++-- 6 files changed, 26 insertions(+), 45 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index eb59cddd2..a3b7c0d72 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -77,7 +77,7 @@ const char * const DATA_PATH_SECTION = "DataPath"; const char * const SEARCH_PATHS = "SearchPaths"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; const char * const LEVELDESIGN_PATH = "LevelDesignPath"; -const char * const ASSETS_PATH = "LevelDesignPath"; +const char * const ASSETS_PATH = "AssetsPath"; //resources const char * const ICON_NEL = ":/core/images/nel.png"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp index 9a67abb80..759e8f304 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp @@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent) m_initialized(false), m_interval(25) { + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_PaintOnScreen); setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui index 971d16c60..bb266f650 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui @@ -6,8 +6,8 @@ 0 0 - 195 - 64 + 192 + 52 @@ -21,6 +21,12 @@ + + 3 + + + 3 + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp index 2a15932b7..7eaed0a1b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp @@ -49,6 +49,9 @@ namespace NLQT CGraphicsViewport::CGraphicsViewport(QWidget *parent) : QNLWidget(parent) { + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_PaintOnScreen); } CGraphicsViewport::~CGraphicsViewport() @@ -77,7 +80,7 @@ void CGraphicsViewport::release() { //H_AUTO2 nldebug("CGraphicsViewport::release"); - + Modules::veget().release(); Modules::psEdit().release(); Modules::objView().release(); @@ -119,39 +122,6 @@ void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent) Modules::objView().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height()); } -#if defined(NL_OS_MAC) -// Qt does not provide wheel events through winEvent() and macEvent() (but it -// does through x11Event(), which is inconsistent...) -// Workaround is to handle wheel events like implemented below. -// -// TODO: this is not a clean solution, because all but wheel events are -// handled using winEvent(), x11Event(), macEvent(). But this seems to be a -// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm) -void CGraphicsViewport::wheelEvent(QWheelEvent *event) -{ - // Get relative positions. - float fX = 1.0f - (float)event->pos().x() / this->width(); - float fY = 1.0f - (float)event->pos().y() / this->height(); - - // Get the buttons currently pressed. - uint32 buttons = NLMISC::noButton; - if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton; - if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton; - if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton; - if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton; - if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton; - if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton; - - if(event->delta() > 0) - Modules::objView().getDriver()->EventServer.postEvent( - new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL)); - else - Modules::objView().getDriver()->EventServer.postEvent( - new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL)); -} -#endif // defined(NL_OS_MAC) - - #if defined(NL_OS_WINDOWS) typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h index 00b2c80d2..d810d8c01 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h @@ -80,10 +80,6 @@ private Q_SLOTS: protected: virtual void resizeEvent(QResizeEvent *resizeEvent); -#if defined(NL_OS_MAC) - virtual void wheelEvent(QWheelEvent *event); -#endif - #if defined(NL_OS_WINDOWS) virtual bool winEvent(MSG *message, long *result); #elif defined(NL_OS_MAC) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui index f2f883263..8288747ce 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui @@ -6,14 +6,14 @@ 0 0 - 460 - 64 + 452 + 52 - 86 - 64 + 0 + 0 @@ -24,6 +24,12 @@ + + 3 + + + 3 +