From 3da6b9c14fdc7d9f492861eb79bef91e9165019a Mon Sep 17 00:00:00 2001 From: "R.J.V. Bertin" Date: Sun, 5 Nov 2017 22:56:57 +0100 Subject: [PATCH] Make wxQt build again, with less compiler warnings This fixes a missing include in qt/nonownedwnd.cpp and a missing method in qt/glcanvas.cpp, allowing the build to complete again. A number of missing wxOVERRIDE statements were added to reduce the important number of compiler warnings about those missing labels. --- demos/life/life.cpp | 2 +- include/wx/qt/combobox.h | 14 +++--- include/wx/qt/toolbar.h | 22 ++++---- include/wx/qt/window.h | 106 +++++++++++++++++++-------------------- src/qt/glcanvas.cpp | 4 ++ src/qt/nonownedwnd.cpp | 1 + 6 files changed, 77 insertions(+), 72 deletions(-) diff --git a/demos/life/life.cpp b/demos/life/life.cpp index 3b3c9ced49..5d7e52f3c8 100644 --- a/demos/life/life.cpp +++ b/demos/life/life.cpp @@ -38,7 +38,7 @@ // resources // -------------------------------------------------------------------------- -#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) || defined(__WXQT__) // application icon #include "mondrian.xpm" diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h index 1f80df5b37..b2fe23d305 100644 --- a/include/wx/qt/combobox.h +++ b/include/wx/qt/combobox.h @@ -52,18 +52,18 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); - virtual void SetSelection(int n) { wxChoice::SetSelection(n); } - virtual void SetSelection(long from, long to); + virtual void SetSelection(int n) wxOVERRIDE { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to) wxOVERRIDE; - virtual int GetSelection() const { return wxChoice::GetSelection(); } - virtual void GetSelection(long *from, long *to) const; + virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); } + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; - virtual wxString GetStringSelection() const + virtual wxString GetStringSelection() const wxOVERRIDE { return wxItemContainer::GetStringSelection(); } - virtual void Clear() + virtual void Clear() wxOVERRIDE { wxTextEntry::Clear(); wxItemContainer::Clear(); @@ -79,7 +79,7 @@ public: protected: // From wxTextEntry: - virtual wxString DoGetValue() const; + virtual wxString DoGetValue() const wxOVERRIDE; private: diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index 10639b6aac..850ef5eb67 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -40,10 +40,10 @@ public: long style = wxTB_DEFAULT_STYLE | wxNO_BORDER, const wxString& name = wxToolBarNameStr); - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; virtual QToolBar *GetQToolBar() const { return m_qtToolBar; } - virtual void SetWindowStyleFlag( long style ); + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; virtual bool Realize() wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(int toolid, @@ -53,20 +53,20 @@ public: wxItemKind kind, wxObject *clientData, const wxString& shortHelp, - const wxString& longHelp); + const wxString& longHelp) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); - QWidget *GetHandle() const; - + const wxString& label) wxOVERRIDE; + QWidget *GetHandle() const wxOVERRIDE; + protected: QActionGroup* GetActionGroup(size_t pos); - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; private: long GetButtonStyle(); diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 76f87791f4..192ae2b54a 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -65,82 +65,82 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); - + bool Create(wxWindowQt *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); - + // Used by all window classes in the widget creation process. void PostCreation( bool generic = true ); - void AddChild( wxWindowBase *child ); + void AddChild( wxWindowBase *child ) wxOVERRIDE; - virtual bool Show( bool show = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; - virtual void DoEnable( bool enable ); - virtual void SetFocus(); + virtual void DoEnable( bool enable ) wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; // Parent/Child: static void QtReparent( QWidget *child, QWidget *parent ); - virtual bool Reparent( wxWindowBase *newParent ); - - // Z-order - virtual void Raise(); - virtual void Lower(); - - // move the mouse to the specified position - virtual void WarpPointer(int x, int y); + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; - virtual void Update(); + // Z-order + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + + // move the mouse to the specified position + virtual void WarpPointer(int x, int y) wxOVERRIDE; + + virtual void Update() wxOVERRIDE; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; - virtual bool SetFont(const wxFont& font); - + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + // get the (average) character size for the current font - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + virtual void SetScrollbar( int orient, int pos, int thumbvisible, int range, - bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; + bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; // scroll window to the specified position virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ); + const wxRect* rect = NULL ) wxOVERRIDE; // Styles - virtual void SetWindowStyleFlag( long style ); - virtual void SetExtraStyle( long exStyle ); + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + virtual void SetExtraStyle( long exStyle ) wxOVERRIDE; - virtual bool SetBackgroundStyle(wxBackgroundStyle style); - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent() { return true; } + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE { return true; } - QWidget *GetHandle() const; + QWidget *GetHandle() const wxOVERRIDE; + + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; - virtual void SetDropTarget( wxDropTarget *dropTarget ); - #if wxUSE_ACCEL // accelerators // ------------ - virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) wxOVERRIDE; #endif // wxUSE_ACCEL - + // wxQt implementation internals: virtual QPicture *QtGetPicture() const; @@ -174,34 +174,34 @@ protected: int *x, int *y, int *descent = NULL, int *externalLeading = NULL, - const wxFont *font = NULL) const; + const wxFont *font = NULL) const wxOVERRIDE; // coordinates translation - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; // capture/release the mouse, used by Capture/ReleaseMouse() - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; // retrieve the position/size of the window - virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void DoGetSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; // same as DoSetSize() for the client size - virtual void DoSetClientSize(int width, int height); - virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; - virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; #if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; #endif // wxUSE_TOOLTIPS #if wxUSE_MENUS - virtual bool DoPopupMenu(wxMenu *menu, int x, int y); + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) wxOVERRIDE; #endif // wxUSE_MENUS QWidget *m_qtWindow; diff --git a/src/qt/glcanvas.cpp b/src/qt/glcanvas.cpp index 482c8f2588..ba8b49678b 100644 --- a/src/qt/glcanvas.cpp +++ b/src/qt/glcanvas.cpp @@ -318,6 +318,10 @@ wxGLAttributes& wxGLAttributes::Defaults() return *this; } +void wxGLAttributes::AddDefaultsForWXBefore31() +{ + Defaults(); +} //--------------------------------------------------------------------------- // wxGlContext diff --git a/src/qt/nonownedwnd.cpp b/src/qt/nonownedwnd.cpp index 061ddec816..91ed44e740 100644 --- a/src/qt/nonownedwnd.cpp +++ b/src/qt/nonownedwnd.cpp @@ -28,6 +28,7 @@ #include "wx/nonownedwnd.h" #include "wx/qt/private/converter.h" +#include "wx/qt/private/utils.h" #include #include