From 0461029ea9819c38f8537db7153a809ccfa38e7b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 21 Apr 2021 08:24:17 +0200 Subject: [PATCH] code fixed for later Qt versions --- src/controls/QskWindow.cpp | 50 ++++++-------------------------------- 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/src/controls/QskWindow.cpp b/src/controls/QskWindow.cpp index bb39f819..c9b60757 100644 --- a/src/controls/QskWindow.cpp +++ b/src/controls/QskWindow.cpp @@ -26,18 +26,10 @@ QSK_QT_PRIVATE_END #ifdef QSK_DEBUG_RENDER_TIMING -// does not work with Qt >= 5.12 TODO ... - #include #include Q_LOGGING_CATEGORY( logTiming, "qsk.window.timing", QtCriticalMsg ) -#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 ) -QSK_QT_PRIVATE_BEGIN -#include -QSK_QT_PRIVATE_END -#endif - #endif static void qskResolveLocale( QskWindow* ); @@ -66,28 +58,6 @@ static QQuickItem* qskDefaultFocusItem( QQuickWindow* window ) return window->contentItem()->nextItemInFocusChain( true ); } -#ifdef QSK_DEBUG_RENDER_TIMING -static inline int qskUpdateTimerId( const QWindow* window ) -{ -#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 ) - class PlatformWindow : public QPlatformWindow - { - public: - int updateTimerId() const - { - return d_ptr->updateTimer.timerId(); - } - }; - - auto platformWindow = static_cast< const PlatformWindow* >( window->handle() ); - return platformWindow->updateTimerId(); -#else - auto w = const_cast< QWindow* >( window ); - return QWindowPrivate::get( w )->updateTimer; -#endif -} -#endif - namespace { class ChildListener final : public QQuickItemChangeListener @@ -375,26 +345,20 @@ bool QskWindow::event( QEvent* event ) } break; } -#ifdef QSK_DEBUG_RENDER_TIMING - case QEvent::Timer: + case QEvent::UpdateRequest: { +#ifdef QSK_DEBUG_RENDER_TIMING if ( logTiming().isDebugEnabled() ) { - const int updateTimerId = qskUpdateTimerId( this ); + if ( !d->renderInterval.isValid() ) + d->renderInterval.start(); - if ( static_cast< QTimerEvent* >( event )->timerId() == updateTimerId ) - { - if ( !d->renderInterval.isValid() ) - d->renderInterval.start(); - - qCDebug( logTiming() ) << "update timer - elapsed" - << d->renderInterval.restart() << this; - } + qCDebug( logTiming() ) << "update timer - elapsed" + << d->renderInterval.restart() << objectName(); } - +#endif break; } -#endif default: break;