From 5ecda429d1aa937a8977c30876dca25c3e7e6735 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Feb 2016 22:37:30 +0100 Subject: [PATCH 1/5] Check for Qt using PKG_CHECK_MODULES() in configure Running pkg-config directly was wrong for many reasons and we didn't even detect the libraries absence. --- configure | 216 +++++++++++++++++++++++++++++++++++++++++++++++++-- configure.in | 30 ++++--- 2 files changed, 228 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 7725b68fb5..49e5978fa5 100755 --- a/configure +++ b/configure @@ -971,6 +971,8 @@ Xxf86vm_LIBS Xxf86vm_CFLAGS Xinerama_LIBS Xinerama_CFLAGS +QT5_LIBS +QT5_CFLAGS PANGOFT2_LIBS PANGOFT2_CFLAGS PANGOXFT_LIBS @@ -1375,6 +1377,8 @@ PANGOXFT_CFLAGS PANGOXFT_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS +QT5_CFLAGS +QT5_LIBS Xinerama_CFLAGS Xinerama_LIBS Xxf86vm_CFLAGS @@ -2355,6 +2359,8 @@ Some influential environment variables: C compiler flags for PANGOFT2, overriding pkg-config PANGOFT2_LIBS linker flags for PANGOFT2, overriding pkg-config + QT5_CFLAGS C compiler flags for QT5, overriding pkg-config + QT5_LIBS linker flags for QT5, overriding pkg-config Xinerama_CFLAGS C compiler flags for Xinerama, overriding pkg-config Xinerama_LIBS @@ -25242,15 +25248,208 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$wxUSE_QT" = 1; then - TOOLKIT=QT - GUIDIST=QT_DIST - TOOLKIT_DIR="qt" - TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} `pkg-config Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test --cflags` -DQT_WIDGETS_LIB" - GUI_TK_LIBRARY="${GUI_TK_LIBRARY} `pkg-config Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test --libs`" - if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS $TOOLKIT_INCLUDE" + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT5" >&5 +$as_echo_n "checking for QT5... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$QT5_CFLAGS"; then + pkg_cv_QT5_CFLAGS="$QT5_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_QT5_CFLAGS=`$PKG_CONFIG --cflags "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$QT5_LIBS"; then + pkg_cv_QT5_LIBS="$QT5_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_QT5_LIBS=`$PKG_CONFIG --libs "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + QT5_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test"` + else + QT5_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test"` fi + # Put the nasty error message in config.log where it belongs + echo "$QT5_PKG_ERRORS" >&5 + + + as_fn_error $? "Qt5 libraries are not available" "$LINENO" 5 + + +elif test $pkg_failed = untried; then + + as_fn_error $? "Qt5 libraries are not available" "$LINENO" 5 + + +else + QT5_CFLAGS=$pkg_cv_QT5_CFLAGS + QT5_LIBS=$pkg_cv_QT5_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + TOOLKIT=QT + GUIDIST=QT_DIST + TOOLKIT_DIR="qt" + TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} ${QT5_CFLAGS}" + GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" + if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then + SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" + WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS $TOOLKIT_INCLUDE" + fi + +fi fi TOOLKIT_DIR=`echo ${TOOLKIT} | tr '[A-Z]' '[a-z]'` @@ -40907,3 +41106,4 @@ echo " libmspack ${wxUSE_LIBMSPAC echo " sdl ${wxUSE_LIBSDL}" echo "" + diff --git a/configure.in b/configure.in index 6ff278de70..3971754689 100644 --- a/configure.in +++ b/configure.in @@ -3283,16 +3283,26 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config if test "$wxUSE_QT" = 1; then - TOOLKIT=QT - GUIDIST=QT_DIST - TOOLKIT_DIR="qt" - TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} `pkg-config Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test --cflags` -DQT_WIDGETS_LIB" - GUI_TK_LIBRARY="${GUI_TK_LIBRARY} `pkg-config Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test --libs`" - if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then - dnl build with position independent code if Qt needs it - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS $TOOLKIT_INCLUDE" - fi + PKG_PROG_PKG_CONFIG() + + PKG_CHECK_MODULES(QT5, + [Qt5Core Qt5Widgets Qt5Gui Qt5OpenGL Qt5Test], + [ + TOOLKIT=QT + GUIDIST=QT_DIST + TOOLKIT_DIR="qt" + TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} ${QT5_CFLAGS}" + GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" + if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then + dnl build with position independent code if Qt needs it + SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" + WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS $TOOLKIT_INCLUDE" + fi + ], + [ + AC_MSG_ERROR([Qt5 libraries are not available]) + ] + ) fi dnl the name of the directory where the files for this toolkit live TOOLKIT_DIR=`echo ${TOOLKIT} | tr '[[A-Z]]' '[[a-z]]'` From 9db24be4967ca1c8cfa22bc6e3ea35be2ecb47f8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Feb 2016 22:57:19 +0100 Subject: [PATCH 2/5] Add missing headers to fix PCH-less wxQt build Just include the headers of the classes being used. --- src/qt/bitmap.cpp | 1 + src/qt/dcscreen.cpp | 1 + src/qt/uiaction.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/qt/bitmap.cpp b/src/qt/bitmap.cpp index 60417f44bf..b45171442d 100644 --- a/src/qt/bitmap.cpp +++ b/src/qt/bitmap.cpp @@ -22,6 +22,7 @@ #endif // WX_PRECOMP #include "wx/bitmap.h" +#include "wx/cursor.h" #include "wx/rawbmp.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" diff --git a/src/qt/dcscreen.cpp b/src/qt/dcscreen.cpp index d3986fdca7..b6e2adfc0f 100644 --- a/src/qt/dcscreen.cpp +++ b/src/qt/dcscreen.cpp @@ -13,6 +13,7 @@ #include #include +#include #include wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl); diff --git a/src/qt/uiaction.cpp b/src/qt/uiaction.cpp index 127843440e..67bfcfa5ec 100644 --- a/src/qt/uiaction.cpp +++ b/src/qt/uiaction.cpp @@ -13,6 +13,7 @@ #endif #include +#include #include "wx/qt/defs.h" #include "wx/qt/private/utils.h" From 4d27a5dde35e7716c177508932a36257c09629b3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Feb 2016 22:58:07 +0100 Subject: [PATCH 3/5] Compilation fix for wxQt wxUIActionSimulator with Qt 5.3 QTest::mouseEvent() and keyEvent() want QWindow, not QWidget, in this version. --- src/qt/uiaction.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/qt/uiaction.cpp b/src/qt/uiaction.cpp index 67bfcfa5ec..c3d6261fcd 100644 --- a/src/qt/uiaction.cpp +++ b/src/qt/uiaction.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "wx/qt/defs.h" #include "wx/qt/private/utils.h" @@ -26,6 +27,16 @@ using namespace Qt; using namespace QTest; +// Apparently {mouse,key}Event() functions signature has changed somewhere +// between Qt 5.3 and 5.5 as they're documented to take QWidget in the latter +// but actually take QWindow in the former, so use this helper to hide the +// difference. +#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) +inline QWidget* argForEvents(QWidget* w) { return w; } +#else +inline QWindow* argForEvents(QWidget* w) { return w->windowHandle(); } +#endif + static MouseButton ConvertMouseButton( int button ) { MouseButton qtButton; @@ -66,7 +77,7 @@ static bool SimulateMouseButton( MouseAction mouseAction, MouseButton mouseButto QPoint mousePosition = QCursor::pos(); QWidget *widget = QApplication::widgetAt( mousePosition ); if ( widget != NULL ) - mouseEvent( mouseAction, widget, mouseButton, NoModifier, mousePosition ); + mouseEvent( mouseAction, argForEvents(widget), mouseButton, NoModifier, mousePosition ); // If we found a widget then we successfully simulated an event: @@ -77,7 +88,7 @@ static bool SimulateKeyboardKey( KeyAction keyAction, Key key ) { QWidget *widget = QApplication::focusWidget(); if ( widget != NULL ) - keyEvent( keyAction, widget, key ); + keyEvent( keyAction, argForEvents(widget), key ); // If we found a widget then we successfully simulated an event: From 67f97053bd8b45688dccba754da7b9e524e52f13 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Feb 2016 23:09:13 +0100 Subject: [PATCH 4/5] Avoid warning about missing return value in wxCheckBox code Handle unknown checkbox values as well, if only to silence the compiler. --- src/qt/checkbox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/checkbox.cpp b/src/qt/checkbox.cpp index 537daa4281..5196b684bd 100644 --- a/src/qt/checkbox.cpp +++ b/src/qt/checkbox.cpp @@ -119,6 +119,9 @@ wxCheckBoxState wxCheckBox::DoGet3StateValue() const case Qt::PartiallyChecked: return wxCHK_UNDETERMINED; } + + wxFAIL_MSG( "unknown QCheckBox state" ); + return wxCHK_UNDETERMINED; } QCheckBox *wxCheckBox::GetHandle() const From 4b9dc209562b478778913503938ab6bb6b2100df Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Feb 2016 23:09:58 +0100 Subject: [PATCH 5/5] Remove or make optional tons of debug messages from wxQt Using the library wasn't really possible with all the debug messages it generated, so either suppress them completely or turn them into trace messages which can be activated on demand if needed. --- include/wx/qt/private/winevent.h | 119 +++++++++++++++---------------- src/qt/dc.cpp | 3 - src/qt/dcclient.cpp | 3 - src/qt/window.cpp | 25 +++---- 4 files changed, 67 insertions(+), 83 deletions(-) diff --git a/include/wx/qt/private/winevent.h b/include/wx/qt/private/winevent.h index 5ca7d466d5..cbda1cc2a2 100644 --- a/include/wx/qt/private/winevent.h +++ b/include/wx/qt/private/winevent.h @@ -63,8 +63,6 @@ public: void HandleDestroyedSignal() { - wxLogDebug( wxT("%s was destroyed by Qt. pointer=%p"), - QObject::staticMetaObject.className(), this ); } virtual Handler *GetHandler() const @@ -72,9 +70,6 @@ public: // Only process the signal / event if the wxWindow is not destroyed if ( !wxWindow::QtRetrieveWindowPointer( this ) ) { - wxLogDebug( wxT("%s win pointer is NULL (wxWindow is deleted)!"), - Widget::staticMetaObject.className() - ); return NULL; } else @@ -90,9 +85,9 @@ protected: virtual void changeEvent ( QEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::changeEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleChangeEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleChangeEvent(this, event) ) Widget::changeEvent(event); else event->accept(); @@ -102,9 +97,9 @@ protected: virtual void closeEvent ( QCloseEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::closeEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleCloseEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleCloseEvent(this, event) ) Widget::closeEvent(event); else event->accept(); @@ -114,9 +109,9 @@ protected: virtual void contextMenuEvent ( QContextMenuEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::contextMenuEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) ) Widget::contextMenuEvent(event); else event->accept(); @@ -129,9 +124,9 @@ protected: virtual void enterEvent ( QEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::enterEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) Widget::enterEvent(event); else event->accept(); @@ -141,9 +136,9 @@ protected: virtual void focusInEvent ( QFocusEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::focusInEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) Widget::focusInEvent(event); else event->accept(); @@ -153,9 +148,9 @@ protected: virtual void focusOutEvent ( QFocusEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::focusOutEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) Widget::focusOutEvent(event); else event->accept(); @@ -165,9 +160,9 @@ protected: virtual void hideEvent ( QHideEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::hideEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) Widget::hideEvent(event); else event->accept(); @@ -177,9 +172,9 @@ protected: virtual void keyPressEvent ( QKeyEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::keyPressEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) Widget::keyPressEvent(event); else event->accept(); @@ -189,9 +184,9 @@ protected: virtual void keyReleaseEvent ( QKeyEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::keyReleaseEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) Widget::keyReleaseEvent(event); else event->accept(); @@ -201,9 +196,9 @@ protected: virtual void leaveEvent ( QEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::leaveEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) Widget::leaveEvent(event); else event->accept(); @@ -213,9 +208,9 @@ protected: virtual void mouseDoubleClickEvent ( QMouseEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::mouseDoubleClickEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) Widget::mouseDoubleClickEvent(event); else event->accept(); @@ -225,9 +220,9 @@ protected: virtual void mouseMoveEvent ( QMouseEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::mouseMoveEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) Widget::mouseMoveEvent(event); else event->accept(); @@ -237,9 +232,9 @@ protected: virtual void mousePressEvent ( QMouseEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::mousePressEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) Widget::mousePressEvent(event); else event->accept(); @@ -249,9 +244,9 @@ protected: virtual void mouseReleaseEvent ( QMouseEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::mouseReleaseEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) Widget::mouseReleaseEvent(event); else event->accept(); @@ -261,9 +256,9 @@ protected: virtual void moveEvent ( QMoveEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::moveEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleMoveEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleMoveEvent(this, event) ) Widget::moveEvent(event); else event->accept(); @@ -273,9 +268,9 @@ protected: virtual void paintEvent ( QPaintEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::paintEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandlePaintEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandlePaintEvent(this, event) ) Widget::paintEvent(event); else event->accept(); @@ -285,9 +280,9 @@ protected: virtual void resizeEvent ( QResizeEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::resizeEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleResizeEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleResizeEvent(this, event) ) Widget::resizeEvent(event); else event->accept(); @@ -297,9 +292,9 @@ protected: virtual void showEvent ( QShowEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::showEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) Widget::showEvent(event); else event->accept(); @@ -309,9 +304,9 @@ protected: virtual void wheelEvent ( QWheelEvent * event ) { if ( !this->GetHandler() ) - wxLogDebug( wxT("%s::wheelEvent for invalid handler!"), - Widget::staticMetaObject.className() ); - else if ( !this->GetHandler()->QtHandleWheelEvent(this, event) ) + return; + + if ( !this->GetHandler()->QtHandleWheelEvent(this, event) ) Widget::wheelEvent(event); else event->accept(); diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 05ac9f5988..d1996b553f 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -409,9 +409,6 @@ void wxQtDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) QTransform qtrans = m_qtPainter->worldTransform(); // Reset transofrmation to match device coordinates m_qtPainter->setWorldTransform( QTransform() ); - wxLogDebug(wxT("wxQtDCImpl::DoSetDeviceClippingRegion rect %d %d %d %d"), - qregion.boundingRect().x(), qregion.boundingRect().y(), - qregion.boundingRect().width(), qregion.boundingRect().height()); // Set QPainter clipping (intersection if not the first one) m_qtPainter->setClipRegion( qregion, m_clipping ? Qt::IntersectClip : Qt::ReplaceClip ); diff --git a/src/qt/dcclient.cpp b/src/qt/dcclient.cpp index 3b8dfce898..0a69244bfd 100644 --- a/src/qt/dcclient.cpp +++ b/src/qt/dcclient.cpp @@ -102,9 +102,6 @@ wxClientDCImpl::~wxClientDCImpl() { // only force the update of the rect affected by the DC widget->repaint( rect ); - wxLogDebug( wxT("wxClientDC Repainting %s (%d %d %d %d)"), - (const char*) m_window->GetName(), - rect.left(), rect.top(), rect.width(), rect.height()); } else { diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 1db35744b5..6c59620127 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -37,6 +37,8 @@ #define VERT_SCROLLBAR_POSITION 0, 1 #define HORZ_SCROLLBAR_POSITION 1, 0 +#define TRACE_QT_WINDOW "qtwindow" + // Base Widget helper (no scrollbar, used by wxWindow) class wxQtWidget : public wxQtEventSignalHandler< QWidget, wxWindowQt > @@ -188,7 +190,7 @@ wxWindowQt::~wxWindowQt() // Delete only if the qt widget was created or assigned to this base class if (m_qtWindow) { - wxLogDebug(wxT("wxWindow::~wxWindow %s m_qtWindow=%p"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow=%p"), (const char*)GetName(), m_qtWindow); // Avoid sending further signals (i.e. if deleting the current page) m_qtWindow->blockSignals(true); @@ -200,7 +202,7 @@ wxWindowQt::~wxWindowQt() } else { - wxLogDebug(wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), (const char*)GetName()); } } @@ -256,7 +258,7 @@ void wxWindowQt::PostCreation(bool generic) // store pointer to the QWidget subclass (to be used in the destructor) m_qtWindow = GetHandle(); } - wxLogDebug(wxT("wxWindow::Create %s m_qtWindow=%p"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Create %s m_qtWindow=%p"), (const char*)GetName(), m_qtWindow); // set the background style after creation (not before like in wxGTK) @@ -391,7 +393,7 @@ void wxWindowQt::WarpPointer(int x, int y) void wxWindowQt::Update() { - wxLogDebug(wxT("wxWindow::Update %s"), (const char*)GetName()); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Update %s"), (const char*)GetName()); // send the paint event to the inner widget in scroll areas: if ( QtGetScrollBarsContainer() ) { @@ -417,14 +419,14 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect ) { if ( rect != NULL ) { - wxLogDebug(wxT("wxWindow::Refresh %s rect %d %d %d %d"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s rect %d %d %d %d"), (const char*)GetName(), rect->x, rect->y, rect->width, rect->height); widget->update( wxQtConvertRect( *rect )); } else { - wxLogDebug(wxT("wxWindow::Refresh %s"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"), (const char*)GetName()); widget->update(); } @@ -1018,13 +1020,6 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) // use the Qt event region: m_updateRegion.QtSetRegion( event->region() ); - if (false) - wxLogDebug(wxT("wxWindow::QtHandlePaintEvent %s %s region %d %d %d %d"), - (const char*)GetName(), - m_qtPicture->isNull() ? "wxPaintDC" : "wxClientDC", - m_updateRegion.GetBox().x, m_updateRegion.GetBox().y, - m_updateRegion.GetBox().width, m_updateRegion.GetBox().height); - // Prepare the Qt painter for wxWindowDC: bool ok = false; if ( QtGetScrollBarsContainer() ) @@ -1071,7 +1066,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) // Ensure DC is cleared if handler didn't and Qt will not do it if ( UseBgCol() && !GetHandle()->autoFillBackground() ) { - wxLogDebug(wxT("wxWindow::QtHandlePaintEvent %s clearing DC to %s"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s clearing DC to %s"), (const char*)GetName(), GetBackgroundColour().GetAsString() ); dc.SetBackground(GetBackgroundColour()); @@ -1120,7 +1115,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) else { // Painter didn't begun, not handled by wxWidgets: - wxLogDebug(wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"), + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"), (const char*)GetName() ); return false; }