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()
{
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();

View File

@@ -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 );

View File

@@ -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
{

View File

@@ -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;
}