From 175756506c46df986782dff2448998945e4aca6f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 22 Jun 2018 14:33:26 +0200 Subject: [PATCH] Minor cleanup of wxFrame::DoGetClientSize() in wxQt Test whether height != NULL just once and make the code slightly more compact. --- src/qt/frame.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp index fd23be2c56..41322c3733 100644 --- a/src/qt/frame.cpp +++ b/src/qt/frame.cpp @@ -170,22 +170,19 @@ void wxFrame::DoGetClientSize(int *width, int *height) const { wxWindow::DoGetClientSize(width, height); - // for a status bar, we must subtract it's height here - wxStatusBar *sb = GetStatusBar(); - if (height && sb) + // Adjust the height, taking the status and menu bars into account, if any: + if ( height ) { - int sbh = 0; - sb->GetSize(NULL, &sbh); - *height -= sbh; - } + if ( wxStatusBar *sb = GetStatusBar() ) + { + *height -= sb->GetSize().y; + } - // also for menubar , we must subtract it's height here - QMenuBar *qmb = GetQMainWindow()->menuBar(); - if (height && qmb) - { - QRect geometry = qmb->geometry(); - *height -= geometry.height(); + if ( QMenuBar *qmb = GetQMainWindow()->menuBar() ) + { + *height -= qmb->geometry().height(); + } } }