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.
This commit is contained in:
Vadim Zeitlin
2016-02-24 23:09:58 +01:00
parent 67f97053bd
commit 4b9dc20956
4 changed files with 67 additions and 83 deletions

View File

@@ -63,8 +63,6 @@ public:
void HandleDestroyedSignal() void HandleDestroyedSignal()
{ {
wxLogDebug( wxT("%s was destroyed by Qt. pointer=%p"),
QObject::staticMetaObject.className(), this );
} }
virtual Handler *GetHandler() const virtual Handler *GetHandler() const
@@ -72,9 +70,6 @@ public:
// Only process the signal / event if the wxWindow is not destroyed // Only process the signal / event if the wxWindow is not destroyed
if ( !wxWindow::QtRetrieveWindowPointer( this ) ) if ( !wxWindow::QtRetrieveWindowPointer( this ) )
{ {
wxLogDebug( wxT("%s win pointer is NULL (wxWindow is deleted)!"),
Widget::staticMetaObject.className()
);
return NULL; return NULL;
} }
else else
@@ -90,9 +85,9 @@ protected:
virtual void changeEvent ( QEvent * event ) virtual void changeEvent ( QEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::changeEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleChangeEvent(this, event) ) if ( !this->GetHandler()->QtHandleChangeEvent(this, event) )
Widget::changeEvent(event); Widget::changeEvent(event);
else else
event->accept(); event->accept();
@@ -102,9 +97,9 @@ protected:
virtual void closeEvent ( QCloseEvent * event ) virtual void closeEvent ( QCloseEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::closeEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleCloseEvent(this, event) ) if ( !this->GetHandler()->QtHandleCloseEvent(this, event) )
Widget::closeEvent(event); Widget::closeEvent(event);
else else
event->accept(); event->accept();
@@ -114,9 +109,9 @@ protected:
virtual void contextMenuEvent ( QContextMenuEvent * event ) virtual void contextMenuEvent ( QContextMenuEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::contextMenuEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) ) if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) )
Widget::contextMenuEvent(event); Widget::contextMenuEvent(event);
else else
event->accept(); event->accept();
@@ -129,9 +124,9 @@ protected:
virtual void enterEvent ( QEvent * event ) virtual void enterEvent ( QEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::enterEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
Widget::enterEvent(event); Widget::enterEvent(event);
else else
event->accept(); event->accept();
@@ -141,9 +136,9 @@ protected:
virtual void focusInEvent ( QFocusEvent * event ) virtual void focusInEvent ( QFocusEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::focusInEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
Widget::focusInEvent(event); Widget::focusInEvent(event);
else else
event->accept(); event->accept();
@@ -153,9 +148,9 @@ protected:
virtual void focusOutEvent ( QFocusEvent * event ) virtual void focusOutEvent ( QFocusEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::focusOutEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
Widget::focusOutEvent(event); Widget::focusOutEvent(event);
else else
event->accept(); event->accept();
@@ -165,9 +160,9 @@ protected:
virtual void hideEvent ( QHideEvent * event ) virtual void hideEvent ( QHideEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::hideEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
Widget::hideEvent(event); Widget::hideEvent(event);
else else
event->accept(); event->accept();
@@ -177,9 +172,9 @@ protected:
virtual void keyPressEvent ( QKeyEvent * event ) virtual void keyPressEvent ( QKeyEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::keyPressEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) if ( !this->GetHandler()->QtHandleKeyEvent(this, event) )
Widget::keyPressEvent(event); Widget::keyPressEvent(event);
else else
event->accept(); event->accept();
@@ -189,9 +184,9 @@ protected:
virtual void keyReleaseEvent ( QKeyEvent * event ) virtual void keyReleaseEvent ( QKeyEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::keyReleaseEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) if ( !this->GetHandler()->QtHandleKeyEvent(this, event) )
Widget::keyReleaseEvent(event); Widget::keyReleaseEvent(event);
else else
event->accept(); event->accept();
@@ -201,9 +196,9 @@ protected:
virtual void leaveEvent ( QEvent * event ) virtual void leaveEvent ( QEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::leaveEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
Widget::leaveEvent(event); Widget::leaveEvent(event);
else else
event->accept(); event->accept();
@@ -213,9 +208,9 @@ protected:
virtual void mouseDoubleClickEvent ( QMouseEvent * event ) virtual void mouseDoubleClickEvent ( QMouseEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::mouseDoubleClickEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseDoubleClickEvent(event); Widget::mouseDoubleClickEvent(event);
else else
event->accept(); event->accept();
@@ -225,9 +220,9 @@ protected:
virtual void mouseMoveEvent ( QMouseEvent * event ) virtual void mouseMoveEvent ( QMouseEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::mouseMoveEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseMoveEvent(event); Widget::mouseMoveEvent(event);
else else
event->accept(); event->accept();
@@ -237,9 +232,9 @@ protected:
virtual void mousePressEvent ( QMouseEvent * event ) virtual void mousePressEvent ( QMouseEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::mousePressEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mousePressEvent(event); Widget::mousePressEvent(event);
else else
event->accept(); event->accept();
@@ -249,9 +244,9 @@ protected:
virtual void mouseReleaseEvent ( QMouseEvent * event ) virtual void mouseReleaseEvent ( QMouseEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::mouseReleaseEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseReleaseEvent(event); Widget::mouseReleaseEvent(event);
else else
event->accept(); event->accept();
@@ -261,9 +256,9 @@ protected:
virtual void moveEvent ( QMoveEvent * event ) virtual void moveEvent ( QMoveEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::moveEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleMoveEvent(this, event) ) if ( !this->GetHandler()->QtHandleMoveEvent(this, event) )
Widget::moveEvent(event); Widget::moveEvent(event);
else else
event->accept(); event->accept();
@@ -273,9 +268,9 @@ protected:
virtual void paintEvent ( QPaintEvent * event ) virtual void paintEvent ( QPaintEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::paintEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandlePaintEvent(this, event) ) if ( !this->GetHandler()->QtHandlePaintEvent(this, event) )
Widget::paintEvent(event); Widget::paintEvent(event);
else else
event->accept(); event->accept();
@@ -285,9 +280,9 @@ protected:
virtual void resizeEvent ( QResizeEvent * event ) virtual void resizeEvent ( QResizeEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::resizeEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleResizeEvent(this, event) ) if ( !this->GetHandler()->QtHandleResizeEvent(this, event) )
Widget::resizeEvent(event); Widget::resizeEvent(event);
else else
event->accept(); event->accept();
@@ -297,9 +292,9 @@ protected:
virtual void showEvent ( QShowEvent * event ) virtual void showEvent ( QShowEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::showEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
Widget::showEvent(event); Widget::showEvent(event);
else else
event->accept(); event->accept();
@@ -309,9 +304,9 @@ protected:
virtual void wheelEvent ( QWheelEvent * event ) virtual void wheelEvent ( QWheelEvent * event )
{ {
if ( !this->GetHandler() ) if ( !this->GetHandler() )
wxLogDebug( wxT("%s::wheelEvent for invalid handler!"), return;
Widget::staticMetaObject.className() );
else if ( !this->GetHandler()->QtHandleWheelEvent(this, event) ) if ( !this->GetHandler()->QtHandleWheelEvent(this, event) )
Widget::wheelEvent(event); Widget::wheelEvent(event);
else else
event->accept(); event->accept();

View File

@@ -409,9 +409,6 @@ void wxQtDCImpl::DoSetDeviceClippingRegion(const wxRegion& region)
QTransform qtrans = m_qtPainter->worldTransform(); QTransform qtrans = m_qtPainter->worldTransform();
// Reset transofrmation to match device coordinates // Reset transofrmation to match device coordinates
m_qtPainter->setWorldTransform( QTransform() ); 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) // Set QPainter clipping (intersection if not the first one)
m_qtPainter->setClipRegion( qregion, m_qtPainter->setClipRegion( qregion,
m_clipping ? Qt::IntersectClip : Qt::ReplaceClip ); m_clipping ? Qt::IntersectClip : Qt::ReplaceClip );

View File

@@ -102,9 +102,6 @@ wxClientDCImpl::~wxClientDCImpl()
{ {
// only force the update of the rect affected by the DC // only force the update of the rect affected by the DC
widget->repaint( rect ); 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 else
{ {

View File

@@ -37,6 +37,8 @@
#define VERT_SCROLLBAR_POSITION 0, 1 #define VERT_SCROLLBAR_POSITION 0, 1
#define HORZ_SCROLLBAR_POSITION 1, 0 #define HORZ_SCROLLBAR_POSITION 1, 0
#define TRACE_QT_WINDOW "qtwindow"
// Base Widget helper (no scrollbar, used by wxWindow) // Base Widget helper (no scrollbar, used by wxWindow)
class wxQtWidget : public wxQtEventSignalHandler< QWidget, wxWindowQt > 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 // Delete only if the qt widget was created or assigned to this base class
if (m_qtWindow) 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); (const char*)GetName(), m_qtWindow);
// Avoid sending further signals (i.e. if deleting the current page) // Avoid sending further signals (i.e. if deleting the current page)
m_qtWindow->blockSignals(true); m_qtWindow->blockSignals(true);
@@ -200,7 +202,7 @@ wxWindowQt::~wxWindowQt()
} }
else 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()); (const char*)GetName());
} }
} }
@@ -256,7 +258,7 @@ void wxWindowQt::PostCreation(bool generic)
// store pointer to the QWidget subclass (to be used in the destructor) // store pointer to the QWidget subclass (to be used in the destructor)
m_qtWindow = GetHandle(); 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); (const char*)GetName(), m_qtWindow);
// set the background style after creation (not before like in wxGTK) // 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() 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: // send the paint event to the inner widget in scroll areas:
if ( QtGetScrollBarsContainer() ) if ( QtGetScrollBarsContainer() )
{ {
@@ -417,14 +419,14 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect )
{ {
if ( rect != NULL ) 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(), (const char*)GetName(),
rect->x, rect->y, rect->width, rect->height); rect->x, rect->y, rect->width, rect->height);
widget->update( wxQtConvertRect( *rect )); widget->update( wxQtConvertRect( *rect ));
} }
else else
{ {
wxLogDebug(wxT("wxWindow::Refresh %s"), wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"),
(const char*)GetName()); (const char*)GetName());
widget->update(); widget->update();
} }
@@ -1018,13 +1020,6 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
// use the Qt event region: // use the Qt event region:
m_updateRegion.QtSetRegion( 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: // Prepare the Qt painter for wxWindowDC:
bool ok = false; bool ok = false;
if ( QtGetScrollBarsContainer() ) 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 // Ensure DC is cleared if handler didn't and Qt will not do it
if ( UseBgCol() && !GetHandle()->autoFillBackground() ) 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() (const char*)GetName(), GetBackgroundColour().GetAsString()
); );
dc.SetBackground(GetBackgroundColour()); dc.SetBackground(GetBackgroundColour());
@@ -1120,7 +1115,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
else else
{ {
// Painter didn't begun, not handled by wxWidgets: // 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() ); (const char*)GetName() );
return false; return false;
} }