diff --git a/configure b/configure index 55d0fbb654..be5211dd64 100755 --- a/configure +++ b/configure @@ -24062,7 +24062,7 @@ $as_echo "yes" >&6; } 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" + WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" fi fi diff --git a/configure.in b/configure.in index a8bc2b94e3..231a04220d 100644 --- a/configure.in +++ b/configure.in @@ -3322,7 +3322,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config 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" + WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" fi ], [ diff --git a/include/wx/qt/accel.h b/include/wx/qt/accel.h index be25cd13fd..a710f7f0ab 100644 --- a/include/wx/qt/accel.h +++ b/include/wx/qt/accel.h @@ -9,9 +9,6 @@ #ifndef _WX_QT_ACCEL_H_ #define _WX_QT_ACCEL_H_ -#include -#include - /* wxQt accelerators implementation: * * Storing: @@ -36,6 +33,9 @@ * QShortcut. This handler will finally create and send the appropriate wx * event to the window. */ +class QShortcut; +template < class T > class QList; + class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject { public: @@ -43,7 +43,7 @@ public: wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Implementation - QList< QShortcut* > ConvertShortcutTable( QWidget *parent ) const; + QList < QShortcut* > *ConvertShortcutTable( QWidget *parent ) const; bool Ok() const { return IsOk(); } bool IsOk() const; diff --git a/include/wx/qt/anybutton.h b/include/wx/qt/anybutton.h index 975ffae6fe..1d07bc5b3b 100644 --- a/include/wx/qt/anybutton.h +++ b/include/wx/qt/anybutton.h @@ -9,7 +9,7 @@ #ifndef _WX_QT_ANYBUTTON_H_ #define _WX_QT_ANYBUTTON_H_ -#include +class QPushButton; //----------------------------------------------------------------------------- // wxAnyButton @@ -28,7 +28,7 @@ public: virtual void SetLabel( const wxString &label ); virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual QPushButton *GetHandle() const; + virtual QWidget *GetHandle() const; protected: diff --git a/include/wx/qt/app.h b/include/wx/qt/app.h index 55cee83781..80bda3a773 100644 --- a/include/wx/qt/app.h +++ b/include/wx/qt/app.h @@ -9,8 +9,7 @@ #ifndef _WX_QT_APP_H_ #define _WX_QT_APP_H_ -#include - +class QApplication; class WXDLLIMPEXP_CORE wxApp : public wxAppBase { public: diff --git a/include/wx/qt/brush.h b/include/wx/qt/brush.h index a3f0fd0e6e..7dfe38ee22 100644 --- a/include/wx/qt/brush.h +++ b/include/wx/qt/brush.h @@ -8,8 +8,6 @@ #ifndef _WX_QT_BRUSH_H_ #define _WX_QT_BRUSH_H_ -#include - class QBrush; class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase diff --git a/include/wx/qt/calctrl.h b/include/wx/qt/calctrl.h index cf40ccc0c5..c8c7595750 100644 --- a/include/wx/qt/calctrl.h +++ b/include/wx/qt/calctrl.h @@ -11,7 +11,7 @@ #define _WX_QT_CALCTRL_H_ #include "wx/calctrl.h" -#include +class QCalendarWidget; class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase { @@ -70,7 +70,7 @@ public: using wxCalendarCtrlBase::GenerateAllChangeEvents; - virtual QCalendarWidget *GetHandle() const; + virtual QWidget *GetHandle() const; protected: virtual void RefreshHolidays(); diff --git a/include/wx/qt/checkbox.h b/include/wx/qt/checkbox.h index adf2c2ac6f..6bb328de70 100644 --- a/include/wx/qt/checkbox.h +++ b/include/wx/qt/checkbox.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_CHECKBOX_H_ #define _WX_QT_CHECKBOX_H_ -#include +class QCheckBox; class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase { @@ -32,7 +32,7 @@ public: virtual void SetValue(bool value); virtual bool GetValue() const; - virtual QCheckBox *GetHandle() const; + virtual QWidget *GetHandle() const; protected: virtual void DoSet3StateValue(wxCheckBoxState state); diff --git a/include/wx/qt/choice.h b/include/wx/qt/choice.h index 8ab1811879..06602b9b68 100644 --- a/include/wx/qt/choice.h +++ b/include/wx/qt/choice.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_CHOICE_H_ #define _WX_QT_CHOICE_H_ -#include +class QComboBox; class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase { @@ -56,7 +56,7 @@ public: virtual void SetSelection(int n); virtual int GetSelection() const; - virtual QComboBox *GetHandle() const; + virtual QWidget *GetHandle() const; protected: virtual int DoInsertItems(const wxArrayStringsAdapter & items, diff --git a/include/wx/qt/colordlg.h b/include/wx/qt/colordlg.h index 3e65349d40..fec19d7d94 100644 --- a/include/wx/qt/colordlg.h +++ b/include/wx/qt/colordlg.h @@ -10,7 +10,7 @@ #include "wx/dialog.h" -#include +class QColorDialog; class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog { @@ -23,9 +23,8 @@ public: wxColourData &GetColourData(); - QColorDialog *GetHandle() const { return static_cast(m_qtWindow); } - private: + QColorDialog *GetQColorDialog() const; wxColourData m_data; }; diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h index 3b0169f9c6..1f80df5b37 100644 --- a/include/wx/qt/combobox.h +++ b/include/wx/qt/combobox.h @@ -9,7 +9,7 @@ #define _WX_QT_COMBOBOX_H_ #include "wx/choice.h" -#include +class QComboBox; class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, public wxTextEntry { diff --git a/include/wx/qt/cursor.h b/include/wx/qt/cursor.h index 47320195dc..b57f770a6f 100644 --- a/include/wx/qt/cursor.h +++ b/include/wx/qt/cursor.h @@ -10,7 +10,7 @@ #include "wx/image.h" -#include +class QCursor; class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase { @@ -36,7 +36,8 @@ protected: void InitFromImage( const wxImage & image ); #endif -protected: +private: + void Init(); virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; diff --git a/include/wx/qt/dataform.h b/include/wx/qt/dataform.h index 612903a881..b6f5c307bf 100644 --- a/include/wx/qt/dataform.h +++ b/include/wx/qt/dataform.h @@ -8,6 +8,8 @@ #ifndef _WX_QT_DATAFORM_H_ #define _WX_QT_DATAFORM_H_ +class QString; + class WXDLLIMPEXP_CORE wxDataFormat { public: @@ -33,7 +35,7 @@ public: wxDataFormatId GetType() const; void SetType( wxDataFormatId type ); - QString m_MimeType; + wxString m_MimeType; }; #endif // _WX_QT_DATAFORM_H_ diff --git a/include/wx/qt/dataobj.h b/include/wx/qt/dataobj.h index 8ccc1908e4..002de9c2a0 100644 --- a/include/wx/qt/dataobj.h +++ b/include/wx/qt/dataobj.h @@ -8,12 +8,13 @@ #ifndef _WX_QT_DATAOBJ_H_ #define _WX_QT_DATAOBJ_H_ -#include +class QMimeData; class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase { public: - wxDataObject() {} + wxDataObject(); + ~wxDataObject(); virtual bool IsSupportedFormat(const wxDataFormat& format, Direction dir) const; virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const; @@ -24,7 +25,7 @@ public: virtual bool SetData(const wxDataFormat& format, size_t len, const void * buf); private: - QMimeData m_qtMimeData; // to handle formats that have no helper classes + QMimeData *m_qtMimeData; // to handle formats that have no helper classes }; #endif // _WX_QT_DATAOBJ_H_ diff --git a/include/wx/qt/dc.h b/include/wx/qt/dc.h index adb0fac3e2..5a4ece366c 100644 --- a/include/wx/qt/dc.h +++ b/include/wx/qt/dc.h @@ -8,8 +8,7 @@ #ifndef _WX_QT_DC_H_ #define _WX_QT_DC_H_ -#include - +class QPainter; class QImage; class WXDLLIMPEXP_FWD_CORE wxRegion; @@ -125,8 +124,8 @@ private: wxQtINVERT }; wxQtRasterColourOp m_rasterColourOp; - QColor m_qtPenColor; - QColor m_qtBrushColor; + QColor *m_qtPenColor; + QColor *m_qtBrushColor; void ApplyRasterColourOp(); }; diff --git a/include/wx/qt/dialog.h b/include/wx/qt/dialog.h index 3a857309c8..5ae3b04a33 100644 --- a/include/wx/qt/dialog.h +++ b/include/wx/qt/dialog.h @@ -9,7 +9,7 @@ #define _WX_QT_DIALOG_H_ #include "wx/dialog.h" -#include +class QDialog; class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase { @@ -35,7 +35,7 @@ public: virtual void EndModal(int retCode); virtual bool IsModal() const; - virtual QDialog *GetHandle() const; + QDialog *GetDialogHandle() const; private: diff --git a/include/wx/qt/dirdlg.h b/include/wx/qt/dirdlg.h index f7bc38a3f5..17d8dfc8fb 100644 --- a/include/wx/qt/dirdlg.h +++ b/include/wx/qt/dirdlg.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_DIRDLG_H_ #define _WX_QT_DIRDLG_H_ -#include +class QFileDialog; class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase { @@ -36,10 +36,10 @@ public: // overrides from wxGenericDirDialog wxString GetPath() const wxOVERRIDE; void SetPath(const wxString& path) wxOVERRIDE; - virtual QFileDialog *GetHandle() const; - private: + virtual QFileDialog *GetQFileDialog() const; + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); }; diff --git a/include/wx/qt/evtloop.h b/include/wx/qt/evtloop.h index d46609f7a8..6034a808a7 100644 --- a/include/wx/qt/evtloop.h +++ b/include/wx/qt/evtloop.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_EVTLOOP_H_ #define _WX_QT_EVTLOOP_H_ -#include +class QTimer; class WXDLLIMPEXP_BASE wxQtEventLoopBase : public wxEventLoopBase { @@ -58,21 +58,4 @@ public: #endif // wxUSE_GUI - -class wxQtEventLoopBase; - -class wxQtIdleTimer : public QTimer -{ - -public: - wxQtIdleTimer( wxQtEventLoopBase *eventLoop ); - virtual bool eventFilter( QObject * watched, QEvent * event ); - -private: - void idle(); - -private: - wxQtEventLoopBase *m_eventLoop; -}; - #endif // _WX_QT_EVTLOOP_H_ diff --git a/include/wx/qt/filedlg.h b/include/wx/qt/filedlg.h index 47ce43fc96..4c907aea83 100644 --- a/include/wx/qt/filedlg.h +++ b/include/wx/qt/filedlg.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_FILEDLG_H_ #define _WX_QT_FILEDLG_H_ -#include +class QFileDialog; class WXDLLIMPEXP_CORE wxFileDialog : public wxFileDialogBase { @@ -48,7 +48,7 @@ public: virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } - virtual QFileDialog *GetHandle() const; + virtual QFileDialog *GetQFileDialog() const; private: diff --git a/include/wx/qt/fontdlg.h b/include/wx/qt/fontdlg.h index b1d63464cc..df739d3852 100644 --- a/include/wx/qt/fontdlg.h +++ b/include/wx/qt/fontdlg.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_FONTDLG_H_ #define _WX_QT_FONTDLG_H_ -#include +class QFontDialog; class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase { @@ -17,8 +17,6 @@ public: wxFontDialog(wxWindow *parent) { Create(parent); } wxFontDialog(wxWindow *parent, const wxFontData& data) { Create(parent, data); } - virtual QFontDialog *GetHandle() const { return static_cast(m_qtWindow); } - protected: bool DoCreate(wxWindow *parent); diff --git a/include/wx/qt/frame.h b/include/wx/qt/frame.h index aaf0541774..35a7f39aaa 100644 --- a/include/wx/qt/frame.h +++ b/include/wx/qt/frame.h @@ -12,8 +12,9 @@ #define _WX_QT_FRAME_H_ #include "wx/frame.h" -#include -#include + +class QMainWindow; +class QScrollArea; class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase { @@ -45,12 +46,8 @@ public: virtual void AddChild( wxWindowBase *child ); virtual void RemoveChild( wxWindowBase *child ); - virtual QMainWindow *GetHandle() const - { - return static_cast(m_qtWindow); - } - - virtual QAbstractScrollArea *QtGetScrollBarsContainer() const; + QMainWindow *GetQMainWindow() const; + virtual QScrollArea *QtGetScrollBarsContainer() const; protected: virtual void DoGetClientSize(int *width, int *height) const; diff --git a/include/wx/qt/gauge.h b/include/wx/qt/gauge.h index 4a21c47f36..fc59debbe8 100644 --- a/include/wx/qt/gauge.h +++ b/include/wx/qt/gauge.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_GAUGE_H_ #define _WX_QT_GAUGE_H_ -#include +class QProgressBar; class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase { @@ -33,7 +33,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxGaugeNameStr); - virtual QProgressBar *GetHandle() const; + virtual QWidget *GetHandle() const; // set/get the control range virtual void SetRange(int range); diff --git a/include/wx/qt/glcanvas.h b/include/wx/qt/glcanvas.h index 13cce8a2ea..a67efa09b0 100644 --- a/include/wx/qt/glcanvas.h +++ b/include/wx/qt/glcanvas.h @@ -8,7 +8,11 @@ #ifndef _WX_GLCANVAS_H_ #define _WX_GLCANVAS_H_ -#include +#include + +class QGLWidget; +class QGLContext; +class QGLFormat; class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { @@ -54,8 +58,6 @@ public: static bool ConvertWXAttrsToQtGL(const int *wxattrs, QGLFormat &format); - virtual QGLWidget *GetHandle() const { return static_cast(m_qtWindow); } - private: // wxDECLARE_EVENT_TABLE(); diff --git a/include/wx/qt/listbox.h b/include/wx/qt/listbox.h index 59e5822dad..ce67508169 100644 --- a/include/wx/qt/listbox.h +++ b/include/wx/qt/listbox.h @@ -8,7 +8,9 @@ #ifndef _WX_QT_LISTBOX_H_ #define _WX_QT_LISTBOX_H_ -#include +class QListWidget; +class QModelIndex; +class QScrollArea; class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase { @@ -57,7 +59,7 @@ public: virtual void SetSelection(int n); virtual int GetSelection() const; - virtual QListWidget *GetHandle() const; + virtual QWidget *GetHandle() const; void QtSendEvent(wxEventType evtType, const QModelIndex &index, bool selected); diff --git a/include/wx/qt/listctrl.h b/include/wx/qt/listctrl.h index 3b08104dcc..17637de752 100644 --- a/include/wx/qt/listctrl.h +++ b/include/wx/qt/listctrl.h @@ -9,7 +9,9 @@ #define _WX_QT_LISTCTRL_H_ #include "wx/textctrl.h" -#include + +class QTreeWidget; +class QTreeWidgetItem; class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -284,7 +286,7 @@ public: return OnGetItemAttr(item); } - virtual QTreeWidget *GetHandle() const; + virtual QWidget *GetHandle() const; protected: void Init(); diff --git a/include/wx/qt/menu.h b/include/wx/qt/menu.h index b45f3ca61b..b8d5abca52 100644 --- a/include/wx/qt/menu.h +++ b/include/wx/qt/menu.h @@ -8,8 +8,8 @@ #ifndef _WX_QT_MENU_H_ #define _WX_QT_MENU_H_ -#include -#include +class QMenu; +class QMenuBar; class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase { @@ -48,7 +48,8 @@ public: virtual void SetMenuLabel(size_t pos, const wxString& label); virtual wxString GetMenuLabel(size_t pos) const; - virtual QMenuBar *GetHandle() const; + QMenuBar *GetQMenuBar() const { return m_qtMenuBar; } + virtual QWidget *GetHandle() const; virtual void Attach(wxFrame *frame); virtual void Detach(); diff --git a/include/wx/qt/menuitem.h b/include/wx/qt/menuitem.h index 0a07c55f02..158007fc4e 100644 --- a/include/wx/qt/menuitem.h +++ b/include/wx/qt/menuitem.h @@ -9,7 +9,7 @@ #define _WX_QT_MENUITEM_H_ #include "wx/menuitem.h" -#include +class QAction; class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxMenu; diff --git a/include/wx/qt/msgdlg.h b/include/wx/qt/msgdlg.h index 447dd60522..6f1acdc16a 100644 --- a/include/wx/qt/msgdlg.h +++ b/include/wx/qt/msgdlg.h @@ -10,7 +10,7 @@ #include "wx/msgdlg.h" -#include +class QMessageBox; class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase { @@ -23,9 +23,6 @@ public: // Reimplemented to translate return codes from Qt to wx virtual int ShowModal(); - - virtual QMessageBox *GetHandle() const; - }; #endif // _WX_QT_MSGDLG_H_ diff --git a/include/wx/qt/notebook.h b/include/wx/qt/notebook.h index c62fb4e859..288d0d9a7f 100644 --- a/include/wx/qt/notebook.h +++ b/include/wx/qt/notebook.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_NOTEBOOK_H_ #define _WX_QT_NOTEBOOK_H_ -#include +class QTabWidget; class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase { @@ -45,7 +45,7 @@ public: int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } - virtual QTabWidget *GetHandle() const; + virtual QWidget *GetHandle() const; protected: virtual wxWindow *DoRemovePage(size_t page); diff --git a/include/wx/qt/pen.h b/include/wx/qt/pen.h index bbaad08379..42c57a5304 100644 --- a/include/wx/qt/pen.h +++ b/include/wx/qt/pen.h @@ -8,8 +8,6 @@ #ifndef _WX_QT_PEN_H_ #define _WX_QT_PEN_H_ -#include - class QPen; class WXDLLIMPEXP_CORE wxPen : public wxPenBase diff --git a/include/wx/qt/timer.h b/include/wx/qt/private/timer.h similarity index 98% rename from include/wx/qt/timer.h rename to include/wx/qt/private/timer.h index cfb875f8d9..21ce2f79d6 100644 --- a/include/wx/qt/timer.h +++ b/include/wx/qt/private/timer.h @@ -10,14 +10,14 @@ #if wxUSE_TIMER -#include "wx/private/timer.h" - #include +#include "wx/private/timer.h" //----------------------------------------------------------------------------- // wxTimer //----------------------------------------------------------------------------- +class QTimerEvent; class WXDLLIMPEXP_CORE wxQtTimerImpl : public wxTimerImpl, QObject { public: diff --git a/include/wx/qt/private/winevent.h b/include/wx/qt/private/winevent.h index cbda1cc2a2..40ea85e417 100644 --- a/include/wx/qt/private/winevent.h +++ b/include/wx/qt/private/winevent.h @@ -11,13 +11,15 @@ #ifndef _WX_QT_EVENTSIGNALFORWARDER_H_ #define _WX_QT_EVENTSIGNALFORWARDER_H_ +#include +#include + #include "wx/log.h" #include "wx/window.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" -#include -#include +class QPaintEvent; template< typename Handler > class wxQtSignalHandler diff --git a/include/wx/qt/radiobox.h b/include/wx/qt/radiobox.h index 62ea5a50cc..f858a576f6 100644 --- a/include/wx/qt/radiobox.h +++ b/include/wx/qt/radiobox.h @@ -8,9 +8,9 @@ #ifndef _WX_QT_RADIOBOX_H_ #define _WX_QT_RADIOBOX_H_ -#include -#include -#include +class QGroupBox; +class QButtonGroup; +class QBoxLayout; class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase { @@ -77,7 +77,7 @@ public: virtual void SetSelection(int n); virtual int GetSelection() const; - virtual QGroupBox *GetHandle() const; + virtual QWidget *GetHandle() const; private: // The 'visual' group box: diff --git a/include/wx/qt/radiobut.h b/include/wx/qt/radiobut.h index 164a0c3f4e..6679be6d04 100644 --- a/include/wx/qt/radiobut.h +++ b/include/wx/qt/radiobut.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_RADIOBUT_H_ #define _WX_QT_RADIOBUT_H_ -#include +class QRadioButton; class WXDLLIMPEXP_CORE wxRadioButton : public wxControl { @@ -35,7 +35,7 @@ public: virtual void SetValue(bool value); virtual bool GetValue() const; - virtual QRadioButton *GetHandle() const; + virtual QWidget *GetHandle() const; protected: diff --git a/include/wx/qt/region.h b/include/wx/qt/region.h index c5ffb699a3..17840ead77 100644 --- a/include/wx/qt/region.h +++ b/include/wx/qt/region.h @@ -9,7 +9,9 @@ #ifndef _WX_QT_REGION_H_ #define _WX_QT_REGION_H_ -#include +class QRegion; +class QRect; +template class QVector; class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase { @@ -25,7 +27,7 @@ public: virtual bool IsEmpty() const; virtual void Clear(); - virtual QRegion GetHandle() const; + virtual const QRegion &GetHandle() const; virtual void QtSetRegion(QRegion region); // Hangs on to this region protected: @@ -45,8 +47,6 @@ protected: virtual bool DoIntersect(const wxRegion& region); virtual bool DoSubtract(const wxRegion& region); virtual bool DoXor(const wxRegion& region); - -private: }; @@ -79,7 +79,7 @@ public: wxRect GetRect() const; private: - QVector< QRect > *m_qtRects; + QVector < QRect > *m_qtRects; int m_pos; }; diff --git a/include/wx/qt/scrolbar.h b/include/wx/qt/scrolbar.h index 2efa3dde30..e1ea3ebe4b 100644 --- a/include/wx/qt/scrolbar.h +++ b/include/wx/qt/scrolbar.h @@ -10,7 +10,7 @@ #include "wx/scrolbar.h" -#include +class QScrollBar; class WXDLLIMPEXP_FWD_CORE wxQtScrollBar; @@ -42,7 +42,8 @@ public: int range, int pageSize, bool refresh = true); - virtual QScrollBar* GetHandle() const; + QScrollBar *GetQScrollBar() const { return m_qtScrollBar; } + QWidget *GetHandle() const; private: QScrollBar *m_qtScrollBar; diff --git a/include/wx/qt/slider.h b/include/wx/qt/slider.h index 1c103d094c..0a183f84b1 100644 --- a/include/wx/qt/slider.h +++ b/include/wx/qt/slider.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_SLIDER_H_ #define _WX_QT_SLIDER_H_ -#include +class QSlider; class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase { @@ -50,7 +50,7 @@ public: virtual void SetThumbLength(int lenPixels); virtual int GetThumbLength() const; - virtual QSlider *GetHandle() const; + virtual QWidget *GetHandle() const; private: QSlider *m_qtSlider; diff --git a/include/wx/qt/spinbutt.h b/include/wx/qt/spinbutt.h index 96a3294756..6df89572e4 100644 --- a/include/wx/qt/spinbutt.h +++ b/include/wx/qt/spinbutt.h @@ -9,7 +9,7 @@ #define _WX_QT_SPINBUTT_H_ #include "wx/spinbutt.h" -#include +class QSpinBox; class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase { @@ -32,7 +32,7 @@ public: virtual int GetValue() const; virtual void SetValue(int val); - virtual QSpinBox *GetHandle() const; + virtual QWidget *GetHandle() const; private: QSpinBox *m_qtSpinBox; diff --git a/include/wx/qt/spinctrl.h b/include/wx/qt/spinctrl.h index 756272b29a..f6cf3df2d1 100644 --- a/include/wx/qt/spinctrl.h +++ b/include/wx/qt/spinctrl.h @@ -8,8 +8,8 @@ #ifndef _WX_QT_SPINCTRL_H_ #define _WX_QT_SPINCTRL_H_ -#include -#include +class QSpinBox; +class QDoubleSpinBox; // Take advantage of the Qt compile time polymorphy and use a template to avoid // copy&paste code for the usage of QSpinBox/QDoubleSpinBox. @@ -45,7 +45,7 @@ public: T GetMax() const; T GetIncrement() const; - virtual Widget *GetHandle() const; + virtual QWidget *GetHandle() const; protected: Widget *m_qtSpinBox; diff --git a/include/wx/qt/statbmp.h b/include/wx/qt/statbmp.h index a4b87687d6..a61fb5e8fc 100644 --- a/include/wx/qt/statbmp.h +++ b/include/wx/qt/statbmp.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_STATBMP_H_ #define _WX_QT_STATBMP_H_ -#include +class QLabel; class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase { @@ -35,7 +35,7 @@ public: virtual wxBitmap GetBitmap() const; virtual wxIcon GetIcon() const; - virtual QLabel *GetHandle() const; + virtual QWidget *GetHandle() const; protected: private: diff --git a/include/wx/qt/statbox.h b/include/wx/qt/statbox.h index 4259f74ec1..186146b242 100644 --- a/include/wx/qt/statbox.h +++ b/include/wx/qt/statbox.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_STATBOX_H_ #define _WX_QT_STATBOX_H_ -#include +class QGroupBox; class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase { @@ -31,7 +31,7 @@ public: virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; - virtual QGroupBox *GetHandle() const; + virtual QWidget *GetHandle() const; protected: diff --git a/include/wx/qt/statline.h b/include/wx/qt/statline.h index d65706b683..aca385e5ec 100644 --- a/include/wx/qt/statline.h +++ b/include/wx/qt/statline.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_STATLINE_H_ #define _WX_QT_STATLINE_H_ -#include +class QFrame; class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase { @@ -29,7 +29,7 @@ public: long style = wxLI_HORIZONTAL, const wxString &name = wxStaticLineNameStr ); - virtual QFrame *GetHandle() const; + virtual QWidget *GetHandle() const; private: QFrame *m_qtFrame; diff --git a/include/wx/qt/stattext.h b/include/wx/qt/stattext.h index 0aae47e778..36f8628aae 100644 --- a/include/wx/qt/stattext.h +++ b/include/wx/qt/stattext.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_STATTEXT_H_ #define _WX_QT_STATTEXT_H_ -#include +class QLabel; class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase { @@ -32,7 +32,8 @@ public: void SetLabel(const wxString& label); - QLabel *GetHandle() const; + virtual QWidget *GetHandle() const; + private: QLabel *m_qtLabel; diff --git a/include/wx/qt/statusbar.h b/include/wx/qt/statusbar.h index 233e506efd..0609d4b044 100644 --- a/include/wx/qt/statusbar.h +++ b/include/wx/qt/statusbar.h @@ -10,13 +10,15 @@ #include "wx/statusbr.h" -#include -#include +class QLabel; +class QStatusBar; + +template < class T > class QList; class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase { public: - wxStatusBar() {} + wxStatusBar(); wxStatusBar(wxWindow *parent, wxWindowID winid = wxID_ANY, long style = wxSTB_DEFAULT_STYLE, const wxString& name = wxStatusBarNameStr); @@ -32,8 +34,9 @@ public: virtual void Refresh( bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL ); - virtual QStatusBar *GetHandle() const; - + QStatusBar *GetQStatusBar() const { return m_qtStatusBar; } + QWidget *GetHandle() const; + protected: virtual void DoUpdateStatusText(int number); @@ -42,7 +45,7 @@ private: void UpdateFields(); QStatusBar *m_qtStatusBar; - QList< QLabel* > m_qtPanes; + QList< QLabel* > *m_qtPanes; wxDECLARE_DYNAMIC_CLASS(wxStatusBar); }; diff --git a/include/wx/qt/taskbar.h b/include/wx/qt/taskbar.h index 6a29f93749..5de2f084b8 100644 --- a/include/wx/qt/taskbar.h +++ b/include/wx/qt/taskbar.h @@ -8,12 +8,13 @@ #ifndef _WX_QT_TASKBAR_H_ #define _WX_QT_TASKBAR_H_ -#include +class QSystemTrayIcon; class WXDLLIMPEXP_CORE wxTaskBarIcon : public wxTaskBarIconBase { public: wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); + virtual ~wxTaskBarIcon(); // Accessors bool IsOk() const { return false; } @@ -26,7 +27,7 @@ public: virtual bool PopupMenu(wxMenu *menu); private: - QSystemTrayIcon m_qtSystemTrayIcon; + QSystemTrayIcon *m_qtSystemTrayIcon; wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); }; diff --git a/include/wx/qt/textctrl.h b/include/wx/qt/textctrl.h index 864165c88c..fda210583c 100644 --- a/include/wx/qt/textctrl.h +++ b/include/wx/qt/textctrl.h @@ -8,8 +8,9 @@ #ifndef _WX_QT_TEXTCTRL_H_ #define _WX_QT_TEXTCTRL_H_ -#include -#include +class QLineEdit; +class QTextEdit; +class QScrollArea; class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase { diff --git a/include/wx/qt/tglbtn.h b/include/wx/qt/tglbtn.h index 1aee755854..3eaa69e044 100644 --- a/include/wx/qt/tglbtn.h +++ b/include/wx/qt/tglbtn.h @@ -36,7 +36,7 @@ public: virtual void SetValue(bool state); virtual bool GetValue() const; - virtual QPushButton *GetHandle() const; + virtual QWidget *GetHandle() const; private: wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton); @@ -69,7 +69,7 @@ public: virtual void SetValue(bool state); virtual bool GetValue() const; - virtual QPushButton *GetHandle() const; + virtual QWidget *GetHandle() const; private: diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index 0c9e4506f3..10639b6aac 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -5,7 +5,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include +class QToolBar; #ifndef _WX_QT_TOOLBAR_H_ #define _WX_QT_TOOLBAR_H_ @@ -41,7 +41,7 @@ public: const wxString& name = wxToolBarNameStr); virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - virtual QToolBar *GetHandle() const; + virtual QToolBar *GetQToolBar() const { return m_qtToolBar; } virtual void SetWindowStyleFlag( long style ); virtual bool Realize() wxOVERRIDE; @@ -57,7 +57,8 @@ public: virtual wxToolBarToolBase *CreateTool(wxControl *control, const wxString& label); - + QWidget *GetHandle() const; + protected: QActionGroup* GetActionGroup(size_t pos); @@ -68,7 +69,7 @@ protected: virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); private: - Qt::ToolButtonStyle GetButtonStyle(); + long GetButtonStyle(); QToolBar *m_qtToolBar; diff --git a/include/wx/qt/treectrl.h b/include/wx/qt/treectrl.h index af832c522f..2abf2e17f4 100644 --- a/include/wx/qt/treectrl.h +++ b/include/wx/qt/treectrl.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_TREECTRL_H_ #define _WX_QT_TREECTRL_H_ -#include +class QTreeWidget; class WXDLLIMPEXP_CORE wxTreeCtrl : public wxTreeCtrlBase { @@ -112,7 +112,7 @@ public: virtual bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const; - virtual QTreeWidget *GetHandle() const; + virtual QWidget *GetHandle() const; protected: virtual int DoGetItemState(const wxTreeItemId& item) const; diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 2689f51303..76f87791f4 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -9,8 +9,27 @@ #ifndef _WX_QT_WINDOW_H_ #define _WX_QT_WINDOW_H_ -#include -#include +#include + +class QWidget; +class QScrollWindow; +class QAbstractScrollArea; +class QScrollArea; +class QPicture; +class QPainter; + +class QPaintEvent; +class QResizeEvent; +class QWheelEvent; +class QKeyEvent; +class QMouseEvent; +class QEvent; +class QMoveEvent; +class QEvent; +class QEvent; +class QCloseEvent; +class QContextMenuEvent; +class QFocusEvent; class WXDLLIMPEXP_FWD_CORE wxScrollBar; class WXDLLIMPEXP_FWD_CORE wxQtShortcutHandler; @@ -112,7 +131,7 @@ public: virtual bool SetTransparent(wxByte alpha); virtual bool CanSetTransparent() { return true; } - virtual WXWidget GetHandle() const; + QWidget *GetHandle() const; virtual void SetDropTarget( wxDropTarget *dropTarget ); @@ -148,7 +167,7 @@ public: virtual void QtHandleShortcut ( int command ); #endif // wxUSE_ACCEL - virtual QAbstractScrollArea *QtGetScrollBarsContainer() const; + virtual QScrollArea *QtGetScrollBarsContainer() const; protected: virtual void DoGetTextExtent(const wxString& string, @@ -206,7 +225,7 @@ private: bool m_mouseInside; #if wxUSE_ACCEL - QList< QShortcut* > m_qtShortcuts; + QList< QShortcut* > *m_qtShortcuts; wxQtShortcutHandler *m_qtShortcutHandler; bool m_processingShortcut; #endif // wxUSE_ACCEL diff --git a/src/qt/accel.cpp b/src/qt/accel.cpp index 5b9b2f37f0..1ecb0c85fb 100644 --- a/src/qt/accel.cpp +++ b/src/qt/accel.cpp @@ -12,6 +12,7 @@ #include "wx/list.h" #include "wx/qt/private/converter.h" #include +#include // ---------------------------------------------------------------------------- // wxAccelList: a list of wxAcceleratorEntries @@ -81,13 +82,13 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] } } -QList< QShortcut* > wxAcceleratorTable::ConvertShortcutTable( QWidget *parent ) const +QList< QShortcut* > *wxAcceleratorTable::ConvertShortcutTable( QWidget *parent ) const { - QList< QShortcut* > qtList; + QList< QShortcut* > *qtList = new QList< QShortcut* >; for ( wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() ) { - qtList << ConvertAccelerator( node->GetData(), parent ); + qtList->push_back(ConvertAccelerator( node->GetData(), parent )); } return qtList; diff --git a/src/qt/anybutton.cpp b/src/qt/anybutton.cpp index f09c6ab88f..216b796979 100644 --- a/src/qt/anybutton.cpp +++ b/src/qt/anybutton.cpp @@ -14,11 +14,12 @@ #include "wx/anybutton.h" #endif +#include + #include "wx/bitmap.h" #include "wx/qt/private/utils.h" #include "wx/qt/private/winevent.h" - class wxQtPushButton : public wxQtEventSignalHandler< QPushButton, wxAnyButton > { @@ -64,7 +65,7 @@ void wxAnyButton::SetLabel( const wxString &label ) m_qtPushButton->setText( wxQtConvertString( label )); } -QPushButton *wxAnyButton::GetHandle() const +QWidget *wxAnyButton::GetHandle() const { return m_qtPushButton; } diff --git a/src/qt/app.cpp b/src/qt/app.cpp index c732701684..93f0ccd3d8 100644 --- a/src/qt/app.cpp +++ b/src/qt/app.cpp @@ -13,6 +13,7 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/converter.h" #include +#include wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxAppBase); diff --git a/src/qt/apptraits.cpp b/src/qt/apptraits.cpp index 2f747d7fb9..f196158be2 100644 --- a/src/qt/apptraits.cpp +++ b/src/qt/apptraits.cpp @@ -12,7 +12,8 @@ #include "wx/stdpaths.h" #include "wx/evtloop.h" -#include "wx/qt/timer.h" +#include "wx/timer.h" +#include "wx/qt/private/timer.h" #include diff --git a/src/qt/bitmap.cpp b/src/qt/bitmap.cpp index da42ecd9e9..485d9a30c5 100644 --- a/src/qt/bitmap.cpp +++ b/src/qt/bitmap.cpp @@ -24,6 +24,7 @@ #include "wx/bitmap.h" #include "wx/cursor.h" #include "wx/rawbmp.h" +#include "wx/qt/colour.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" @@ -213,8 +214,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth, double WXUNUSED(scale) ) wxBitmap::wxBitmap(const wxCursor& cursor) { // note that pixmap could be invalid if is not a pixmap cursor - // also, a wxCursor::GetHandle method could be implemented instead of - // accessing the member variable directly QPixmap pix = cursor.GetHandle().pixmap(); m_refData = new wxBitmapRefData(pix); } diff --git a/src/qt/button.cpp b/src/qt/button.cpp index 382f12626c..7b7a2e992e 100644 --- a/src/qt/button.cpp +++ b/src/qt/button.cpp @@ -21,6 +21,7 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/winevent.h" +#include wxButton::wxButton() { diff --git a/src/qt/calctrl.cpp b/src/qt/calctrl.cpp index cf0e216b19..cc051c09dc 100644 --- a/src/qt/calctrl.cpp +++ b/src/qt/calctrl.cpp @@ -22,7 +22,7 @@ #include "wx/qt/private/winevent.h" #include - +#include class wxQtCalendarWidget : public wxQtEventSignalHandler< QCalendarWidget, wxCalendarCtrl > { @@ -316,7 +316,7 @@ void wxCalendarCtrl::SetAttr(size_t day, wxCalendarDateAttr *attr) m_qtCalendar->setDateTextFormat(date, format); } -QCalendarWidget *wxCalendarCtrl::GetHandle() const +QWidget *wxCalendarCtrl::GetHandle() const { return m_qtCalendar; } diff --git a/src/qt/checkbox.cpp b/src/qt/checkbox.cpp index 5196b684bd..48baecf281 100644 --- a/src/qt/checkbox.cpp +++ b/src/qt/checkbox.cpp @@ -13,6 +13,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include + class wxQtCheckBox : public wxQtEventSignalHandler< QCheckBox, wxCheckBox > { public: @@ -124,7 +126,7 @@ wxCheckBoxState wxCheckBox::DoGet3StateValue() const return wxCHK_UNDETERMINED; } -QCheckBox *wxCheckBox::GetHandle() const +QWidget *wxCheckBox::GetHandle() const { return m_qtCheckBox; } diff --git a/src/qt/checklst.cpp b/src/qt/checklst.cpp index df72f98ff7..a1d336c474 100644 --- a/src/qt/checklst.cpp +++ b/src/qt/checklst.cpp @@ -10,6 +10,8 @@ #include "wx/checklst.h" +#include + wxCheckListBox::wxCheckListBox() { } diff --git a/src/qt/choice.cpp b/src/qt/choice.cpp index 6fad01b70b..19d074284a 100644 --- a/src/qt/choice.cpp +++ b/src/qt/choice.cpp @@ -174,7 +174,7 @@ void wxChoice::DoDeleteOneItem(unsigned int pos) m_qtComboBox->removeItem(pos); } -QComboBox *wxChoice::GetHandle() const +QWidget *wxChoice::GetHandle() const { return m_qtComboBox; } diff --git a/src/qt/clipbrd.cpp b/src/qt/clipbrd.cpp index aa09e516af..582c739d97 100644 --- a/src/qt/clipbrd.cpp +++ b/src/qt/clipbrd.cpp @@ -20,6 +20,7 @@ #include "wx/scopeguard.h" #include "wx/qt/private/converter.h" +#include // ---------------------------------------------------------------------------- // wxClipboard ctor/dtor @@ -108,7 +109,7 @@ bool wxClipboard::AddData( wxDataObject *data ) QByteArray bytearray(size, 0); data->GetDataHere(format, bytearray.data()); - MimeData->setData(format.m_MimeType, bytearray); + MimeData->setData(wxQtConvertString(format.m_MimeType), bytearray); } delete data; @@ -143,7 +144,7 @@ bool wxClipboard::GetData( wxDataObject& data ) const wxDataFormat format(formats[i]); // is this format supported by clipboard ? - if( !MimeData->hasFormat(format.m_MimeType) ) + if( !MimeData->hasFormat(wxQtConvertString(format.m_MimeType)) ) continue; wxTextDataObject *textdata = dynamic_cast(&data); @@ -151,7 +152,7 @@ bool wxClipboard::GetData( wxDataObject& data ) textdata->SetText(wxQtConvertString(MimeData->text())); else { - QByteArray bytearray = MimeData->data( format.m_MimeType ).data(); + QByteArray bytearray = MimeData->data( wxQtConvertString(format.m_MimeType) ).data(); data.SetData(format, bytearray.size(), bytearray.constData()); } @@ -169,7 +170,7 @@ void wxClipboard::Clear() bool wxClipboard::IsSupported( const wxDataFormat& format ) { const QMimeData *data = QtClipboard->mimeData( (QClipboard::Mode)Mode() ); - return data->hasFormat(format.m_MimeType); + return data->hasFormat(wxQtConvertString(format.m_MimeType)); } bool wxClipboard::IsSupportedAsync(wxEvtHandler *sink) diff --git a/src/qt/colordlg.cpp b/src/qt/colordlg.cpp index 2a09d6fe6b..146c161c40 100644 --- a/src/qt/colordlg.cpp +++ b/src/qt/colordlg.cpp @@ -11,6 +11,8 @@ #include "wx/qt/private/winevent.h" #include "wx/colordlg.h" +#include + class wxQtColorDialog : public wxQtEventSignalHandler< QColorDialog, wxDialog > { public: @@ -32,7 +34,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data ) QColorDialog::setCustomColor(i, m_data.GetCustomColour(i).GetQColor()); } - GetHandle()->setCurrentColor(m_data.GetColour().GetQColor()); + static_cast(m_qtWindow)->setCurrentColor(m_data.GetColour().GetQColor()); return wxTopLevelWindow::Create( parent, wxID_ANY, ""); } @@ -40,10 +42,14 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data ) wxColourData &wxColourDialog::GetColourData() { for (int i=0; icustomColor(i)); + m_data.SetCustomColour(i, GetQColorDialog()->customColor(i)); - m_data.SetColour(GetHandle()->currentColor()); + m_data.SetColour(GetQColorDialog()->currentColor()); return m_data; } +QColorDialog *wxColourDialog::GetQColorDialog() const +{ + return static_cast(m_qtWindow); +} diff --git a/src/qt/combobox.cpp b/src/qt/combobox.cpp index aee4130860..67757fd2ee 100644 --- a/src/qt/combobox.cpp +++ b/src/qt/combobox.cpp @@ -12,7 +12,9 @@ #include "wx/window.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" + #include +#include class wxQtComboBox : public wxQtEventSignalHandler< QComboBox, wxComboBox > { @@ -123,12 +125,12 @@ wxString wxComboBox::DoGetValue() const void wxComboBox::Popup() { - GetHandle()->showPopup(); + static_cast(GetHandle())->showPopup(); } void wxComboBox::Dismiss() { - GetHandle()->hidePopup(); + static_cast(GetHandle())->hidePopup(); } void wxComboBox::SetSelection( long from, long to ) diff --git a/src/qt/control.cpp b/src/qt/control.cpp index 5605fd03e0..eacb2409a1 100644 --- a/src/qt/control.cpp +++ b/src/qt/control.cpp @@ -11,6 +11,8 @@ #include "wx/control.h" #include "wx/qt/private/converter.h" +#include + wxIMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow); wxControl::wxControl() diff --git a/src/qt/dataobj.cpp b/src/qt/dataobj.cpp index 85935786bf..72f7d471d8 100644 --- a/src/qt/dataobj.cpp +++ b/src/qt/dataobj.cpp @@ -12,18 +12,17 @@ #pragma hdrstop #endif -#include - #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" #include "wx/dataobj.h" +#include wxDataFormat::wxDataFormat() { } -static QString DataFormatIdToMimeType( wxDataFormatId formatId ) +static wxString DataFormatIdToMimeType( wxDataFormatId formatId ) { switch(formatId) { case wxDF_TEXT: return "text/plain"; @@ -58,32 +57,32 @@ wxDataFormat::wxDataFormat( wxDataFormatId formatId ) wxDataFormat::wxDataFormat(const wxString &id) { - m_MimeType = wxQtConvertString(id); + m_MimeType = id; } wxDataFormat::wxDataFormat(const wxChar *id) { - m_MimeType = wxQtConvertString((wxString)id); + m_MimeType = (wxString)id; } wxDataFormat::wxDataFormat(const QString &id) { - m_MimeType = id; + m_MimeType = wxQtConvertString(id); } void wxDataFormat::SetId( const wxChar *id ) { - m_MimeType = wxQtConvertString((wxString)id); + m_MimeType = (wxString)id; } void wxDataFormat::SetId( const wxString& id ) { - m_MimeType = wxQtConvertString(id); + m_MimeType = id; } wxString wxDataFormat::GetId() const { - return wxQtConvertString(m_MimeType); + return m_MimeType; } wxDataFormatId wxDataFormat::GetType() const @@ -119,6 +118,16 @@ bool wxDataFormat::operator!=(const wxDataFormat& format) const //############################################################################# +wxDataObject::wxDataObject() +{ + m_qtMimeData = new QMimeData; +} + +wxDataObject::~wxDataObject() +{ + delete m_qtMimeData; +} + bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction) const { return wxDataFormat(format) != wxDF_INVALID; @@ -126,21 +135,21 @@ bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction) cons wxDataFormat wxDataObject::GetPreferredFormat(Direction) const { /* formats are in order of preference */ - if (m_qtMimeData.formats().count()) - return m_qtMimeData.formats().first(); + if (m_qtMimeData->formats().count()) + return m_qtMimeData->formats().first(); return wxDataFormat(); } size_t wxDataObject::GetFormatCount(Direction) const { - return m_qtMimeData.formats().count(); + return m_qtMimeData->formats().count(); } void wxDataObject::GetAllFormats(wxDataFormat *formats, Direction) const { int i = 0; - foreach (QString format, m_qtMimeData.formats()) + foreach (QString format, m_qtMimeData->formats()) { formats[i] = format; i++; @@ -149,15 +158,15 @@ void wxDataObject::GetAllFormats(wxDataFormat *formats, Direction) const size_t wxDataObject::GetDataSize(const wxDataFormat& format) const { - return m_qtMimeData.data( format.m_MimeType ).count(); + return m_qtMimeData->data( wxQtConvertString(format.m_MimeType) ).count(); } bool wxDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { - if (!m_qtMimeData.hasFormat(format.m_MimeType)) + if (!m_qtMimeData->hasFormat(wxQtConvertString(format.m_MimeType))) return false; - QByteArray data = m_qtMimeData.data( format.m_MimeType ).data(); + QByteArray data = m_qtMimeData->data( wxQtConvertString(format.m_MimeType) ).data(); memcpy(buf, data.constData(), data.size()); return true; } @@ -165,7 +174,7 @@ bool wxDataObject::GetDataHere(const wxDataFormat& format, void *buf) const bool wxDataObject::SetData(const wxDataFormat& format, size_t len, const void * buf) { QByteArray bytearray((const char*)buf, len); - m_qtMimeData.setData(format.m_MimeType, bytearray); + m_qtMimeData->setData(wxQtConvertString(format.m_MimeType), bytearray); return true; } diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 2a17e94726..78e406e0d8 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -13,6 +13,8 @@ #endif #include +#include +#include #ifndef WX_PRECOMP #include "wx/icon.h" @@ -47,6 +49,8 @@ wxQtDCImpl::wxQtDCImpl( wxDC *owner ) m_clippingRegion = new wxRegion; m_qtImage = NULL; m_rasterColourOp = wxQtNONE; + m_qtPenColor = new QColor; + m_qtBrushColor = new QColor; m_ok = true; } @@ -60,8 +64,10 @@ wxQtDCImpl::~wxQtDCImpl() } delete m_qtPainter; } - if ( m_clippingRegion != NULL ) - delete m_clippingRegion; + + delete m_clippingRegion; + delete m_qtPenColor; + delete m_qtBrushColor; } void wxQtDCImpl::QtPreparePainter( ) @@ -197,6 +203,10 @@ void wxQtDCImpl::SetBackgroundMode(int mode) m_backgroundMode = mode; } +#include +#include +#include +#include #if wxUSE_PALETTE void wxQtDCImpl::SetPalette(const wxPalette& WXUNUSED(palette)) @@ -284,8 +294,8 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function) m_rasterColourOp = rasterColourOp; // Restore original colours and apply new mode - SetPenColour( m_qtPainter, m_qtPenColor ); - SetBrushColour( m_qtPainter, m_qtPenColor ); + SetPenColour( m_qtPainter, *m_qtPenColor ); + SetBrushColour( m_qtPainter, *m_qtPenColor ); ApplyRasterColourOp(); } @@ -294,8 +304,8 @@ void wxQtDCImpl::SetLogicalFunction(wxRasterOperationMode function) void wxQtDCImpl::ApplyRasterColourOp() { // Save colours - m_qtPenColor = m_qtPainter->pen().color(); - m_qtBrushColor = m_qtPainter->brush().color(); + *m_qtPenColor = m_qtPainter->pen().color(); + *m_qtBrushColor = m_qtPainter->brush().color(); // Apply op switch ( m_rasterColourOp ) @@ -309,8 +319,8 @@ void wxQtDCImpl::ApplyRasterColourOp() SetBrushColour( m_qtPainter, QColor( Qt::black ) ); break; case wxQtINVERT: - SetPenColour( m_qtPainter, QColor( ~m_qtPenColor.rgb() ) ); - SetBrushColour( m_qtPainter, QColor( ~m_qtBrushColor.rgb() ) ); + SetPenColour( m_qtPainter, QColor( ~m_qtPenColor->rgb() ) ); + SetBrushColour( m_qtPainter, QColor( ~m_qtBrushColor->rgb() ) ); break; case wxQtNONE: // No op diff --git a/src/qt/dcclient.cpp b/src/qt/dcclient.cpp index 0a69244bfd..eea8088a42 100644 --- a/src/qt/dcclient.cpp +++ b/src/qt/dcclient.cpp @@ -22,6 +22,8 @@ #include "wx/dcclient.h" #include "wx/qt/dcclient.h" +#include +#include //############################################################################## diff --git a/src/qt/dcmemory.cpp b/src/qt/dcmemory.cpp index 3609241a0e..2898270d7f 100644 --- a/src/qt/dcmemory.cpp +++ b/src/qt/dcmemory.cpp @@ -11,6 +11,8 @@ #include "wx/dcmemory.h" #include "wx/qt/dcmemory.h" +#include + wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxQtDCImpl( owner ) { diff --git a/src/qt/dialog.cpp b/src/qt/dialog.cpp index 3d655cba4b..892f52cc44 100644 --- a/src/qt/dialog.cpp +++ b/src/qt/dialog.cpp @@ -12,6 +12,7 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/winevent.h" +#include class wxQtDialog : public wxQtEventSignalHandler< QDialog, wxDialog > { @@ -58,7 +59,9 @@ bool wxDialog::Create( wxWindow *parent, wxWindowID id, style |= wxTAB_TRAVERSAL; m_qtWindow = new wxQtDialog( parent, this ); + PostCreation(); + return wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ); } @@ -66,24 +69,25 @@ int wxDialog::ShowModal() { wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" ); - return GetHandle()->exec() ? wxID_OK : wxID_CANCEL; + return GetDialogHandle()->exec() ? wxID_OK : wxID_CANCEL; } void wxDialog::EndModal(int retCode) { - wxCHECK_RET( GetHandle() != NULL, "Invalid dialog" ); - - GetHandle()->done( retCode ); + wxCHECK_RET( GetDialogHandle() != NULL, "Invalid dialog" ); + + SetReturnCode(retCode); + GetDialogHandle()->done( retCode ); } bool wxDialog::IsModal() const { - wxCHECK_MSG( GetHandle() != NULL, false, "Invalid dialog" ); + wxCHECK_MSG( GetDialogHandle() != NULL, false, "Invalid dialog" ); - return GetHandle()->isModal(); + return GetDialogHandle()->isModal(); } -QDialog *wxDialog::GetHandle() const +QDialog *wxDialog::GetDialogHandle() const { return static_cast(m_qtWindow); } diff --git a/src/qt/evtloop.cpp b/src/qt/evtloop.cpp index 853dd6e7b3..97ca3a98ba 100644 --- a/src/qt/evtloop.cpp +++ b/src/qt/evtloop.cpp @@ -16,6 +16,23 @@ #include #include #include +#include + +#include + +class wxQtIdleTimer : public QTimer +{ + +public: + wxQtIdleTimer( wxQtEventLoopBase *eventLoop ); + virtual bool eventFilter( QObject * watched, QEvent * event ); + +private: + void idle(); + +private: + wxQtEventLoopBase *m_eventLoop; +}; wxQtIdleTimer::wxQtIdleTimer( wxQtEventLoopBase *eventLoop ) { diff --git a/src/qt/filedlg.cpp b/src/qt/filedlg.cpp index d721e66e36..4fb0920ff8 100644 --- a/src/qt/filedlg.cpp +++ b/src/qt/filedlg.cpp @@ -113,7 +113,7 @@ wxString wxFileDialog::GetPath() const void wxFileDialog::GetPaths(wxArrayString& paths) const { - QStringList selectedfiles = GetHandle()->selectedFiles(); + QStringList selectedfiles = GetQFileDialog()->selectedFiles(); foreach (QString file, selectedfiles) paths.Add(wxQtConvertString(file)); } @@ -130,7 +130,7 @@ wxString wxFileDialog::GetFilename() const void wxFileDialog::GetFilenames(wxArrayString& files) const { - QStringList selectedfiles = GetHandle()->selectedFiles(); + QStringList selectedfiles = GetQFileDialog()->selectedFiles(); foreach (QString file, selectedfiles ) { wxFileName fn = wxQtConvertString(file); @@ -141,9 +141,9 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const int wxFileDialog::GetFilterIndex() const { int index = 0; - foreach (QString filter, GetHandle()->nameFilters()) + foreach (QString filter, GetQFileDialog()->nameFilters()) { - if (filter == GetHandle()->selectedNameFilter()) + if (filter == GetQFileDialog()->selectedNameFilter()) return index; index++; } @@ -153,17 +153,17 @@ int wxFileDialog::GetFilterIndex() const void wxFileDialog::SetMessage(const wxString& message) { - GetHandle()->setLabelText(QFileDialog::LookIn, wxQtConvertString(message)); + GetQFileDialog()->setLabelText(QFileDialog::LookIn, wxQtConvertString(message)); } void wxFileDialog::SetPath(const wxString& path) { - GetHandle()->selectFile(wxQtConvertString(path)); + GetQFileDialog()->selectFile(wxQtConvertString(path)); } void wxFileDialog::SetDirectory(const wxString& dir) { - GetHandle()->setDirectory(wxQtConvertString(dir)); + GetQFileDialog()->setDirectory(wxQtConvertString(dir)); } void wxFileDialog::SetFilename(const wxString& name) @@ -173,19 +173,19 @@ void wxFileDialog::SetFilename(const wxString& name) void wxFileDialog::SetWildcard(const wxString& wildCard) { - GetHandle()->setNameFilter(wxQtConvertString(wildCard)); + GetQFileDialog()->setNameFilter(wxQtConvertString(wildCard)); } void wxFileDialog::SetFilterIndex(int filterIndex) { - QStringList filters = GetHandle()->nameFilters(); + QStringList filters = GetQFileDialog()->nameFilters(); if (filterIndex < 0 || filterIndex >= filters.size()) return; - GetHandle()->setNameFilter(filters.at(filterIndex)); + GetQFileDialog()->setNameFilter(filters.at(filterIndex)); } -QFileDialog *wxFileDialog::GetHandle() const +QFileDialog *wxFileDialog::GetQFileDialog() const { return static_cast(m_qtWindow); } @@ -237,7 +237,7 @@ bool wxDirDialog::Create(wxWindow *parent, wxString wxDirDialog::GetPath() const { - QStringList selectedfiles = GetHandle()->selectedFiles(); + QStringList selectedfiles = GetQFileDialog()->selectedFiles(); if (selectedfiles.size() > 0) return wxQtConvertString(selectedfiles.first()); @@ -246,10 +246,10 @@ wxString wxDirDialog::GetPath() const void wxDirDialog::SetPath(const wxString& path) { - GetHandle()->selectFile(wxQtConvertString(path)); + GetQFileDialog()->selectFile(wxQtConvertString(path)); } -QFileDialog *wxDirDialog::GetHandle() const +QFileDialog *wxDirDialog::GetQFileDialog() const { return static_cast(m_qtWindow); } diff --git a/src/qt/fontdlg.cpp b/src/qt/fontdlg.cpp index 679cbebde5..361dcf08af 100644 --- a/src/qt/fontdlg.cpp +++ b/src/qt/fontdlg.cpp @@ -11,6 +11,8 @@ #include "wx/qt/private/winevent.h" #include "wx/fontdlg.h" +#include + class wxQtFontDialog : public wxQtEventSignalHandler< QFontDialog, wxFontDialog > { public: @@ -31,7 +33,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); bool wxFontDialog::DoCreate(wxWindow *parent) { m_qtWindow = new wxQtFontDialog( parent, this ); - GetHandle()->setCurrentFont(m_fontData.GetInitialFont().GetHandle()); + static_cast(m_qtWindow)->setCurrentFont(m_fontData.GetInitialFont().GetHandle()); return wxFontDialogBase::DoCreate(parent); } diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp index 7b54944924..3f33119c4a 100644 --- a/src/qt/frame.cpp +++ b/src/qt/frame.cpp @@ -12,8 +12,6 @@ #pragma hdrstop #endif -#include - #ifndef WX_PRECOMP #include "wx/menu.h" #include "wx/toolbar.h" @@ -24,6 +22,9 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include +#include +#include class wxQtMainWindow : public wxQtEventSignalHandler< QMainWindow, wxFrame > { @@ -56,7 +57,7 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString& title, wxFrame::~wxFrame() { // central widget should be deleted by qt when the main window is destroyed - QtStoreWindowPointer( GetHandle()->centralWidget(), NULL ); + QtStoreWindowPointer( GetQMainWindow()->centralWidget(), NULL ); } bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -67,7 +68,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString& title, // TODO: Could we use a wxPanel as the central widget? If so then we could // remove wxWindow::QtReparent. - GetHandle()->setCentralWidget( new wxQtCentralWidget( parent, this ) ); + GetQMainWindow()->setCentralWidget( new wxQtCentralWidget( parent, this ) ); PostCreation(); @@ -83,13 +84,13 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) wxCHECK_RET( menuBar->GetHandle(), "Using a replaced menu bar is not supported in wxQT"); // Warning: Qt main window takes ownership of the QMenuBar pointer: - GetHandle()->setMenuBar( menuBar->GetHandle() ); + GetQMainWindow()->setMenuBar( menuBar->GetQMenuBar() ); } else { // Creating an empty menu bar should hide it and free the previous: QMenuBar *qmenubar = new QMenuBar(GetHandle()); - GetHandle()->setMenuBar( qmenubar ); + GetQMainWindow()->setMenuBar( qmenubar ); } wxFrameBase::SetMenuBar( menuBar ); } @@ -100,14 +101,14 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar ) // TODO: add a mechanism like Detach in menus to avoid issues if ( statusBar != NULL ) { - GetHandle()->setStatusBar( statusBar->GetHandle() ); + GetQMainWindow()->setStatusBar( statusBar->GetQStatusBar() ); // Update statusbar sizes now that it has a size statusBar->Refresh(); } else { // Remove the current status bar - GetHandle()->setStatusBar(NULL); + GetQMainWindow()->setStatusBar(NULL); } wxFrameBase::SetStatusBar( statusBar ); } @@ -122,11 +123,11 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) if (toolbar->HasFlag(wxTB_TOP)) area |= Qt::TopToolBarArea; if (toolbar->HasFlag(wxTB_BOTTOM)) area |= Qt::BottomToolBarArea; - GetHandle()->addToolBar((Qt::ToolBarArea)area, toolbar->GetHandle()); + GetQMainWindow()->addToolBar((Qt::ToolBarArea)area, toolbar->GetQToolBar()); } else if ( m_frameToolBar != NULL ) { - GetHandle()->removeToolBar(m_frameToolBar->GetHandle()); + GetQMainWindow()->removeToolBar(m_frameToolBar->GetQToolBar()); } wxFrameBase::SetToolBar( toolbar ); } @@ -135,7 +136,7 @@ void wxFrame::SetWindowStyleFlag( long style ) { wxWindow::SetWindowStyleFlag( style ); - Qt::WindowFlags qtFlags = GetHandle()->windowFlags(); + Qt::WindowFlags qtFlags = GetQMainWindow()->windowFlags(); if ( HasFlag( wxFRAME_TOOL_WINDOW ) ) { @@ -143,14 +144,14 @@ void wxFrame::SetWindowStyleFlag( long style ) qtFlags |= Qt::Tool; } - GetHandle()->setWindowFlags( qtFlags ); + GetQMainWindow()->setWindowFlags( qtFlags ); } void wxFrame::AddChild( wxWindowBase *child ) { // Make sure all children are children of the central widget: - QtReparent( child->GetHandle(), GetHandle()->centralWidget() ); + QtReparent( child->GetHandle(), GetQMainWindow()->centralWidget() ); wxFrameBase::AddChild( child ); } @@ -160,9 +161,9 @@ void wxFrame::RemoveChild( wxWindowBase *child ) wxFrameBase::RemoveChild( child ); } -QAbstractScrollArea *wxFrame::QtGetScrollBarsContainer() const +QScrollArea *wxFrame::QtGetScrollBarsContainer() const { - return dynamic_cast (GetHandle()->centralWidget() ); + return dynamic_cast (GetQMainWindow()->centralWidget() ); } void wxFrame::DoGetClientSize(int *width, int *height) const @@ -179,6 +180,11 @@ void wxFrame::DoGetClientSize(int *width, int *height) const } } +QMainWindow *wxFrame::GetQMainWindow() const +{ + return static_cast(m_qtWindow); +} + //============================================================================= wxQtMainWindow::wxQtMainWindow( wxWindow *parent, wxFrame *handler ) diff --git a/src/qt/gauge.cpp b/src/qt/gauge.cpp index da3bbc9687..ffa1c0963d 100644 --- a/src/qt/gauge.cpp +++ b/src/qt/gauge.cpp @@ -12,6 +12,7 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include class wxQtProgressBar : public wxQtEventSignalHandler< QProgressBar, wxGauge > { @@ -62,7 +63,7 @@ bool wxGauge::Create(wxWindow *parent, } -QProgressBar *wxGauge::GetHandle() const +QWidget *wxGauge::GetHandle() const { return m_qtProgressBar; } diff --git a/src/qt/glcanvas.cpp b/src/qt/glcanvas.cpp index 13acf97448..0106d8620b 100644 --- a/src/qt/glcanvas.cpp +++ b/src/qt/glcanvas.cpp @@ -12,6 +12,8 @@ #include "wx/qt/private/winevent.h" #include "wx/glcanvas.h" +#include + class wxQtGLWidget : public wxQtEventSignalHandler< QGLWidget, wxGLCanvas > { public: @@ -378,7 +380,7 @@ bool wxGLCanvas::Create(wxWindow *parent, bool wxGLCanvas::SwapBuffers() { - GetHandle()->swapBuffers(); + static_cast(m_qtWindow)->swapBuffers(); return true; } diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp index 1d63f39a9c..d465e4ce0e 100644 --- a/src/qt/listbox.cpp +++ b/src/qt/listbox.cpp @@ -11,6 +11,7 @@ #include "wx/listbox.h" #include "wx/qt/private/winevent.h" +#include class wxQtListWidget : public wxQtEventSignalHandler< QListWidget, wxListBox > { @@ -225,7 +226,7 @@ void wxListBox::DoDeleteOneItem(unsigned int pos) delete item; } -QListWidget *wxListBox::GetHandle() const +QWidget *wxListBox::GetHandle() const { return m_qtListWidget; } diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index ad8ecf2b8b..9444cfdde7 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -22,6 +22,7 @@ #include "wx/imaglist.h" #include "wx/qt/private/winevent.h" +#include class wxQtTreeWidget : public wxQtEventSignalHandler< QTreeWidget, wxListCtrl > { @@ -916,7 +917,7 @@ int wxListCtrl::OnGetItemColumnImage(long item, long column) const return -1; } -QTreeWidget *wxListCtrl::GetHandle() const +QWidget *wxListCtrl::GetHandle() const { return m_qtTreeWidget; } diff --git a/src/qt/mdi.cpp b/src/qt/mdi.cpp index edfaea9d5f..3655a355de 100644 --- a/src/qt/mdi.cpp +++ b/src/qt/mdi.cpp @@ -14,7 +14,9 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" + #include +#include // Main MDI window helper @@ -69,7 +71,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent, if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) ) return false; - GetHandle()->setCentralWidget( client->GetHandle() ); + GetQMainWindow()->setCentralWidget( client->GetHandle() ); PostCreation(); @@ -116,7 +118,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, if (ok) { // Add the window to the internal MDI client area: - static_cast(parent->GetHandle()->centralWidget())->addSubWindow(GetHandle()); + static_cast(parent->GetQMainWindow()->centralWidget())->addSubWindow(GetHandle()); } return ok; } diff --git a/src/qt/menu.cpp b/src/qt/menu.cpp index f07668b9c6..a0433d7229 100644 --- a/src/qt/menu.cpp +++ b/src/qt/menu.cpp @@ -12,6 +12,8 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/converter.h" +#include +#include static void ApplyStyle( QMenu *qtMenu, long style ) { @@ -245,7 +247,7 @@ void wxMenuBar::Detach() wxMenuBarBase::Detach(); } -QMenuBar *wxMenuBar::GetHandle() const +QWidget *wxMenuBar::GetHandle() const { return m_qtMenuBar; } diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index 5d7bac2ec2..eab049e342 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -15,6 +15,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include +#include class wxQtAction : public QAction, public wxQtSignalHandler< wxMenuItem > { diff --git a/src/qt/msgdlg.cpp b/src/qt/msgdlg.cpp index 7b57eb9e5b..b80c004564 100644 --- a/src/qt/msgdlg.cpp +++ b/src/qt/msgdlg.cpp @@ -27,39 +27,40 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message, const wxString& caption, long style, const wxPoint& pos ) : wxMessageDialogBase( parent, message, caption, style ) { - m_qtWindow = new wxQtMessageDialog( parent, this ); + wxQtMessageDialog *dlg = new wxQtMessageDialog( parent, this ); + m_qtWindow = dlg; // Set properties Move( pos ); - GetHandle()->setText( wxQtConvertString( message ) ); - GetHandle()->setWindowTitle( wxQtConvertString( caption ) ); + dlg->setText( wxQtConvertString( message ) ); + dlg->setWindowTitle( wxQtConvertString( caption ) ); // Apply the style SetWindowStyleFlag( style ); // Buttons if ( style & wxOK ) - GetHandle()->addButton( QMessageBox::Ok ); + dlg->addButton( QMessageBox::Ok ); if ( style & wxCANCEL ) - GetHandle()->addButton( QMessageBox::Cancel ); + dlg->addButton( QMessageBox::Cancel ); if ( style & wxYES_NO ) { - GetHandle()->addButton( QMessageBox::Yes ); - GetHandle()->addButton( QMessageBox::No ); + dlg->addButton( QMessageBox::Yes ); + dlg->addButton( QMessageBox::No ); } // Default button if ( style & wxNO_DEFAULT ) - GetHandle()->setDefaultButton( QMessageBox::No ); + dlg->setDefaultButton( QMessageBox::No ); else if ( style & wxCANCEL_DEFAULT ) - GetHandle()->setDefaultButton( QMessageBox::Cancel ); + dlg->setDefaultButton( QMessageBox::Cancel ); else { // Default to OK or Yes if ( style & wxOK ) - GetHandle()->setDefaultButton( QMessageBox::Ok ); + dlg->setDefaultButton( QMessageBox::Ok ); else - GetHandle()->setDefaultButton( QMessageBox::Yes ); + dlg->setDefaultButton( QMessageBox::Yes ); } // Icon @@ -67,31 +68,31 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message, if ( style & wxICON_NONE ) { numIcons++; - GetHandle()->setIcon( QMessageBox::NoIcon ); + dlg->setIcon( QMessageBox::NoIcon ); } if ( style & wxICON_EXCLAMATION ) { numIcons++; - GetHandle()->setIcon( QMessageBox::Warning ); + dlg->setIcon( QMessageBox::Warning ); } if ( style & wxICON_ERROR || style & wxICON_HAND ) { numIcons++; - GetHandle()->setIcon( QMessageBox::Critical ); + dlg->setIcon( QMessageBox::Critical ); } if ( style & wxICON_QUESTION ) { numIcons++; - GetHandle()->setIcon( QMessageBox::Question ); + dlg->setIcon( QMessageBox::Question ); } if ( style & wxICON_INFORMATION ) { numIcons++; - GetHandle()->setIcon( QMessageBox::Information ); + dlg->setIcon( QMessageBox::Information ); } wxCHECK_RET( numIcons <= 1, "Multiple icon definitions" ); @@ -99,23 +100,23 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message, { // Use default if ( style & wxYES_NO ) - GetHandle()->setIcon( QMessageBox::Question ); + dlg->setIcon( QMessageBox::Question ); else - GetHandle()->setIcon( QMessageBox::Information ); + dlg->setIcon( QMessageBox::Information ); } if ( style & wxSTAY_ON_TOP ) - GetHandle()->setWindowModality( Qt::ApplicationModal ); + dlg->setWindowModality( Qt::ApplicationModal ); PostCreation(); } int wxMessageDialog::ShowModal() { - wxCHECK_MSG( GetHandle(), -1, "Invalid dialog" ); + wxCHECK_MSG( m_qtWindow, -1, "Invalid dialog" ); // Exec may return a wx identifier if a close event is generated - int ret = GetHandle()->exec(); + int ret = static_cast(m_qtWindow)->exec(); switch ( ret ) { case QMessageBox::Ok: @@ -132,11 +133,6 @@ int wxMessageDialog::ShowModal() } } -QMessageBox *wxMessageDialog::GetHandle() const -{ - return static_cast(m_qtWindow); -} - wxMessageDialog::~wxMessageDialog() { } diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp index 2a971f5b95..5a3b8affcf 100644 --- a/src/qt/notebook.cpp +++ b/src/qt/notebook.cpp @@ -13,6 +13,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include + class wxQtTabWidget : public wxQtEventSignalHandler< QTabWidget, wxNotebook > { public: @@ -199,7 +201,7 @@ wxWindow *wxNotebook::DoRemovePage(size_t page) return QtRetrieveWindowPointer( qtWidget ); } -QTabWidget *wxNotebook::GetHandle() const +QWidget *wxNotebook::GetHandle() const { return m_qtTabWidget; } diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index f5c01515bc..da8c90baa6 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -15,7 +15,8 @@ #include #include #include - +#include +#include class wxQtRadioBox : public wxQtEventSignalHandler< QGroupBox, wxRadioBox > { @@ -236,7 +237,7 @@ int wxRadioBox::GetSelection() const return wxNOT_FOUND; } -QGroupBox *wxRadioBox::GetHandle() const +QWidget *wxRadioBox::GetHandle() const { return m_qtGroupBox; } diff --git a/src/qt/radiobut.cpp b/src/qt/radiobut.cpp index 00fafd8a18..64e2100cd4 100644 --- a/src/qt/radiobut.cpp +++ b/src/qt/radiobut.cpp @@ -11,6 +11,8 @@ #include "wx/radiobut.h" #include "wx/qt/private/converter.h" +#include + wxRadioButton::wxRadioButton() { } @@ -52,7 +54,7 @@ bool wxRadioButton::GetValue() const return m_qtRadioButton->isChecked(); } -QRadioButton *wxRadioButton::GetHandle() const +QWidget *wxRadioButton::GetHandle() const { return m_qtRadioButton; } diff --git a/src/qt/region.cpp b/src/qt/region.cpp index b2b0ff4ed1..6cf474023a 100644 --- a/src/qt/region.cpp +++ b/src/qt/region.cpp @@ -215,9 +215,9 @@ bool wxRegion::DoXor(const wxRegion& region) return true; } -QRegion wxRegion::GetHandle() const +const QRegion &wxRegion::GetHandle() const { - wxCHECK_MSG( IsOk(), QRegion(), "Invalid region" ); + wxCHECK_MSG( IsOk(), GetHandle(), "Invalid region" ); return M_REGIONDATA; } diff --git a/src/qt/scrolbar.cpp b/src/qt/scrolbar.cpp index bd445debf8..99db6cc451 100644 --- a/src/qt/scrolbar.cpp +++ b/src/qt/scrolbar.cpp @@ -12,6 +12,7 @@ #include "wx/qt/private/utils.h" #include "wx/qt/private/winevent.h" +#include class wxQtScrollBar : public wxQtEventSignalHandler< QScrollBar, wxScrollBar > { @@ -109,7 +110,7 @@ void wxScrollBar::SetScrollbar(int position, int WXUNUSED(thumbSize), } } -QScrollBar *wxScrollBar::GetHandle() const +QWidget *wxScrollBar::GetHandle() const { return m_qtScrollBar; } diff --git a/src/qt/slider.cpp b/src/qt/slider.cpp index f3d95b5115..9efc54d529 100644 --- a/src/qt/slider.cpp +++ b/src/qt/slider.cpp @@ -12,6 +12,7 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include class wxQtSlider : public wxQtEventSignalHandler< QSlider, wxSlider > { @@ -163,7 +164,7 @@ int wxSlider::GetThumbLength() const } -QSlider *wxSlider::GetHandle() const +QWidget *wxSlider::GetHandle() const { return m_qtSlider; } diff --git a/src/qt/spinbutt.cpp b/src/qt/spinbutt.cpp index 3488a476f8..0fca8ba9e4 100644 --- a/src/qt/spinbutt.cpp +++ b/src/qt/spinbutt.cpp @@ -11,6 +11,7 @@ #include "wx/spinbutt.h" #include "wx/qt/private/winevent.h" +#include class wxQtSpinButton : public wxQtEventSignalHandler< QSpinBox, wxSpinButton > { @@ -81,7 +82,7 @@ void wxSpinButton::SetValue(int val) m_qtSpinBox->setValue( val ); } -QSpinBox *wxSpinButton::GetHandle() const +QWidget *wxSpinButton::GetHandle() const { return m_qtSpinBox; } diff --git a/src/qt/spinctrl.cpp b/src/qt/spinctrl.cpp index de7dfd94d3..9cb720d228 100644 --- a/src/qt/spinctrl.cpp +++ b/src/qt/spinctrl.cpp @@ -15,6 +15,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include + template< typename T, typename Widget > wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() { @@ -117,7 +119,7 @@ void wxSpinCtrlQt< T, Widget >::SetSelection(long WXUNUSED(WXUNUSED(from)), long } template< typename T, typename Widget > -Widget *wxSpinCtrlQt< T, Widget >::GetHandle() const +QWidget *wxSpinCtrlQt< T, Widget >::GetHandle() const { return m_qtSpinBox; } diff --git a/src/qt/statbmp.cpp b/src/qt/statbmp.cpp index faa1540d33..b4dbde30f0 100644 --- a/src/qt/statbmp.cpp +++ b/src/qt/statbmp.cpp @@ -11,6 +11,8 @@ #include "wx/statbmp.h" #include "wx/qt/private/winevent.h" +#include + class wxQtStaticBmp : public wxQtEventSignalHandler< QLabel, wxStaticBitmap > { public: @@ -80,7 +82,7 @@ wxIcon wxStaticBitmap::GetIcon() const return icon; } -QLabel *wxStaticBitmap::GetHandle() const +QWidget *wxStaticBitmap::GetHandle() const { return m_qtLabel; } diff --git a/src/qt/statbox.cpp b/src/qt/statbox.cpp index be9825e0bb..6af3e2ddb6 100644 --- a/src/qt/statbox.cpp +++ b/src/qt/statbox.cpp @@ -50,7 +50,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name ); } -QGroupBox *wxStaticBox::GetHandle() const +QWidget *wxStaticBox::GetHandle() const { return m_qtGroupBox; } diff --git a/src/qt/statline.cpp b/src/qt/statline.cpp index 0e0227904b..444f59c6e7 100644 --- a/src/qt/statline.cpp +++ b/src/qt/statline.cpp @@ -10,6 +10,8 @@ #include "wx/statline.h" +#include + wxStaticLine::wxStaticLine() { } @@ -40,7 +42,7 @@ bool wxStaticLine::Create( wxWindow *parent, return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name ); } -QFrame *wxStaticLine::GetHandle() const +QWidget *wxStaticLine::GetHandle() const { return m_qtFrame; } diff --git a/src/qt/stattext.cpp b/src/qt/stattext.cpp index eed8c97515..c60a6fdd36 100644 --- a/src/qt/stattext.cpp +++ b/src/qt/stattext.cpp @@ -12,6 +12,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include + class wxQtStaticText : public wxQtEventSignalHandler< QLabel, wxStaticText > { public: @@ -60,7 +62,7 @@ void wxStaticText::SetLabel(const wxString& label) m_qtLabel->setText( wxQtConvertString( label ) ); } -QLabel *wxStaticText::GetHandle() const +QWidget *wxStaticText::GetHandle() const { return m_qtLabel; } diff --git a/src/qt/statusbar.cpp b/src/qt/statusbar.cpp index 4056fbfb13..8b0f052628 100644 --- a/src/qt/statusbar.cpp +++ b/src/qt/statusbar.cpp @@ -13,6 +13,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include +#include class wxQtStatusBar : public wxQtEventSignalHandler< QStatusBar, wxStatusBar > { @@ -28,10 +30,17 @@ wxQtStatusBar::wxQtStatusBar( wxWindow *parent, wxStatusBar *handler ) //============================================================================== + +wxStatusBar::wxStatusBar() +{ + Init(); +} + wxStatusBar::wxStatusBar(wxWindow *parent, wxWindowID winid, long style, const wxString& name) { + Init(); Create( parent, winid, style, name ); } @@ -41,6 +50,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID WXUNUSED(winid), wxMISSING_IMPLEMENTATION( "wxStatusBar::Create parameters" ); m_qtStatusBar = new wxQtStatusBar( parent, this ); + m_qtPanes = new QList < QLabel* >; if(style & wxSTB_SIZEGRIP) m_qtStatusBar->setSizeGripEnabled(true); @@ -57,7 +67,7 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const wxCHECK_MSG( (i >= 0) && ((size_t)i < m_panes.GetCount()), false, "invalid statusbar field index" ); - rect = wxQtConvertRect(m_qtPanes[i]->geometry()); + rect = wxQtConvertRect((*m_qtPanes)[i]->geometry()); return true; } @@ -78,7 +88,7 @@ int wxStatusBar::GetBorderY() const void wxStatusBar::DoUpdateStatusText(int number) { - m_qtPanes[number]->setText( wxQtConvertString( m_panes[number].GetText() ) ); + (*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) ); } // Called each time number/size of panes changes @@ -89,14 +99,20 @@ void wxStatusBar::Refresh( bool eraseBackground, const wxRect *rect ) wxWindow::Refresh( eraseBackground, rect ); } +void wxStatusBar::Init() +{ + m_qtPanes = NULL; +} + + void wxStatusBar::UpdateFields() { // is it a good idea to recreate all the panes every update? - while ( !m_qtPanes.isEmpty() ) + while ( !m_qtPanes->isEmpty() ) { //Remove all panes - delete m_qtPanes.takeLast(); + delete m_qtPanes->takeLast(); } for (size_t i = 0; i < m_panes.GetCount(); i++) @@ -105,7 +121,7 @@ void wxStatusBar::UpdateFields() int width = m_panes[i].GetWidth(); QLabel *pane = new QLabel( m_qtStatusBar ); - m_qtPanes.append( pane ); + m_qtPanes->append( pane ); if ( width >= 0 ) { @@ -120,7 +136,7 @@ void wxStatusBar::UpdateFields() } } -QStatusBar *wxStatusBar::GetHandle() const +QWidget *wxStatusBar::GetHandle() const { return m_qtStatusBar; } diff --git a/src/qt/taskbar.cpp b/src/qt/taskbar.cpp index 6b40fe8507..b375afd79f 100644 --- a/src/qt/taskbar.cpp +++ b/src/qt/taskbar.cpp @@ -10,6 +10,8 @@ #include "wx/taskbar.h" +#include + //============================================================================= bool wxTaskBarIconBase::IsAvailable() @@ -23,6 +25,12 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxTaskBarIconBase); wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType WXUNUSED(iconType)) { + m_qtSystemTrayIcon = new QSystemTrayIcon; +} + +wxTaskBarIcon::~wxTaskBarIcon() +{ + delete m_qtSystemTrayIcon; } bool wxTaskBarIcon::SetIcon(const wxIcon& WXUNUSED(icon), diff --git a/src/qt/textctrl.cpp b/src/qt/textctrl.cpp index 166edff9ff..2313df841a 100644 --- a/src/qt/textctrl.cpp +++ b/src/qt/textctrl.cpp @@ -14,6 +14,9 @@ #include "wx/qt/private/winevent.h" #include "wx/qt/private/utils.h" +#include +#include + class wxQtLineEdit : public wxQtEventSignalHandler< QLineEdit, wxTextCtrl > { public: diff --git a/src/qt/tglbtn.cpp b/src/qt/tglbtn.cpp index d89eb54134..f27c72490c 100644 --- a/src/qt/tglbtn.cpp +++ b/src/qt/tglbtn.cpp @@ -21,6 +21,8 @@ #include "wx/qt/private/converter.h" #include "wx/qt/private/winevent.h" +#include + class wxQtToggleButton : public wxQtEventSignalHandler< QPushButton, wxAnyButton > { @@ -94,7 +96,7 @@ bool wxBitmapToggleButton::GetValue() const return m_qtPushButton->isChecked(); } -QPushButton *wxBitmapToggleButton::GetHandle() const +QWidget *wxBitmapToggleButton::GetHandle() const { return m_qtPushButton; } @@ -144,7 +146,7 @@ bool wxToggleButton::GetValue() const return m_qtPushButton->isChecked(); } -QPushButton *wxToggleButton::GetHandle() const +QWidget *wxToggleButton::GetHandle() const { return m_qtPushButton; } diff --git a/src/qt/timer.cpp b/src/qt/timer.cpp index 3b52a44b02..4c991a3549 100644 --- a/src/qt/timer.cpp +++ b/src/qt/timer.cpp @@ -10,7 +10,7 @@ #if wxUSE_TIMER -#include "wx/qt/timer.h" +#include "wx/qt/private/timer.h" #include wxQtTimerImpl::wxQtTimerImpl( wxTimer* timer ) diff --git a/src/qt/toolbar.cpp b/src/qt/toolbar.cpp index 5704942d10..cad52f82cb 100644 --- a/src/qt/toolbar.cpp +++ b/src/qt/toolbar.cpp @@ -25,6 +25,8 @@ #include "wx/qt/private/winevent.h" #include "wx/qt/private/converter.h" +#include + class wxQtToolButton; class wxToolBarTool : public wxToolBarToolBase { @@ -144,7 +146,7 @@ wxQtToolbar::wxQtToolbar( wxWindow *parent, wxToolBar *handler ) } -QToolBar *wxToolBar::GetHandle() const +QWidget *wxToolBar::GetHandle() const { return m_qtToolBar; } @@ -192,7 +194,7 @@ void wxToolBar::SetWindowStyleFlag( long style ) m_qtToolBar->setOrientation( IsVertical() ? Qt::Vertical : Qt::Horizontal); - Qt::ToolButtonStyle buttonStyle = GetButtonStyle(); + Qt::ToolButtonStyle buttonStyle = (Qt::ToolButtonStyle)GetButtonStyle(); // bring the initial state of all the toolbar items in line with the for ( wxToolBarToolsList::const_iterator i = m_tools.begin(); @@ -235,11 +237,11 @@ QActionGroup* wxToolBar::GetActionGroup(size_t pos) { QActionGroup *actionGroup = NULL; if (pos > 0) - actionGroup = GetHandle()->actions().at(pos-1)->actionGroup(); - if (actionGroup == NULL && (int)pos < GetHandle()->actions().size() - 1) - actionGroup = GetHandle()->actions().at(pos+1)->actionGroup(); + actionGroup = m_qtToolBar->actions().at(pos-1)->actionGroup(); + if (actionGroup == NULL && (int)pos < m_qtToolBar->actions().size() - 1) + actionGroup = m_qtToolBar->actions().at(pos+1)->actionGroup(); if (actionGroup == NULL) - actionGroup = new QActionGroup(GetHandle()); + actionGroup = new QActionGroup(m_qtToolBar); return actionGroup; } @@ -247,15 +249,15 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool* tool = static_cast(toolBase); QAction *before = NULL; - if (pos >= 0 && pos < (size_t)GetHandle()->actions().size()) - before = GetHandle()->actions().at(pos); + if (pos >= 0 && pos < (size_t)m_qtToolBar->actions().size()) + before = m_qtToolBar->actions().at(pos); QAction *action; switch ( tool->GetStyle() ) { case wxTOOL_STYLE_BUTTON: tool->m_qtToolButton = new wxQtToolButton(this, tool); - tool->m_qtToolButton->setToolButtonStyle(GetButtonStyle()); + tool->m_qtToolButton->setToolButtonStyle((Qt::ToolButtonStyle)GetButtonStyle()); tool->SetLabel( tool->GetLabel() ); if (!HasFlag(wxTB_NOICONS)) @@ -263,7 +265,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) if (!HasFlag(wxTB_NO_TOOLTIPS)) tool->SetToolTip(); - action = GetHandle()->insertWidget(before, tool->m_qtToolButton); + action = m_qtToolBar->insertWidget(before, tool->m_qtToolButton); switch (tool->GetKind()) { @@ -285,14 +287,14 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) if (tool->IsStretchable()) { QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - GetHandle()->insertWidget(before, spacer); + m_qtToolBar->insertWidget(before, spacer); } else - GetHandle()->insertSeparator(before); + m_qtToolBar->insertSeparator(before); break; case wxTOOL_STYLE_CONTROL: wxWindow* control = tool->GetControl(); - GetHandle()->insertWidget(before, control->GetHandle()); + m_qtToolBar->insertWidget(before, control->GetHandle()); break; } @@ -344,7 +346,7 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control, return new wxToolBarTool(this, control, label); } -Qt::ToolButtonStyle wxToolBar::GetButtonStyle() +long wxToolBar::GetButtonStyle() { if (!HasFlag(wxTB_NOICONS)) { if (HasFlag(wxTB_HORZ_LAYOUT)) diff --git a/src/qt/toplevel.cpp b/src/qt/toplevel.cpp index a5c2466e48..79969cc52d 100644 --- a/src/qt/toplevel.cpp +++ b/src/qt/toplevel.cpp @@ -11,6 +11,7 @@ #include "wx/toplevel.h" #include "wx/qt/private/converter.h" #include +#include wxTopLevelWindowQt::wxTopLevelWindowQt() { diff --git a/src/qt/treectrl.cpp b/src/qt/treectrl.cpp index 2362c6d99d..f73a202612 100644 --- a/src/qt/treectrl.cpp +++ b/src/qt/treectrl.cpp @@ -10,6 +10,8 @@ #include "wx/treectrl.h" +#include + wxTreeCtrl::wxTreeCtrl() { } @@ -348,7 +350,7 @@ wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const return wxTreeItemId(); } -QTreeWidget *wxTreeCtrl::GetHandle() const +QWidget *wxTreeCtrl::GetHandle() const { return m_qtTreeWidget; } diff --git a/src/qt/window.cpp b/src/qt/window.cpp index b29cd08531..07295d7591 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #ifndef WX_PRECOMP #include "wx/dcclient.h" @@ -150,6 +152,7 @@ void wxWindowQt::Init() #if wxUSE_ACCEL m_qtShortcutHandler = new wxQtShortcutHandler( this ); m_processingShortcut = false; + m_qtShortcuts = NULL; #endif m_qtWindow = NULL; m_qtContainer = NULL; @@ -185,6 +188,7 @@ wxWindowQt::~wxWindowQt() #if wxUSE_ACCEL m_qtShortcutHandler->deleteLater(); + delete m_qtShortcuts; #endif // Delete only if the qt widget was created or assigned to this base class @@ -505,7 +509,7 @@ wxScrollBar *wxWindowQt::QtGetScrollBar( int orientation ) const * passed as parameter */ wxScrollBar *wxWindowQt::QtSetScrollBar( int orientation, wxScrollBar *scrollBar ) { - QAbstractScrollArea *scrollArea = QtGetScrollBarsContainer(); + QScrollArea *scrollArea = QtGetScrollBarsContainer(); wxCHECK_MSG( scrollArea, NULL, "Window without scrolling area" ); // Create a new scrollbar if needed @@ -529,12 +533,12 @@ wxScrollBar *wxWindowQt::QtSetScrollBar( int orientation, wxScrollBar *scrollBar // Let Qt handle layout if ( orientation == wxHORIZONTAL ) { - scrollArea->setHorizontalScrollBar( scrollBar->GetHandle() ); + scrollArea->setHorizontalScrollBar( scrollBar->GetQScrollBar() ); m_horzScrollBar = scrollBar; } else { - scrollArea->setVerticalScrollBar( scrollBar->GetHandle() ); + scrollArea->setVerticalScrollBar( scrollBar->GetQScrollBar() ); m_vertScrollBar = scrollBar; } return scrollBar; @@ -932,15 +936,16 @@ void wxWindowQt::SetAcceleratorTable( const wxAcceleratorTable& accel ) wxWindowBase::SetAcceleratorTable( accel ); // Disable previously set accelerators - while ( !m_qtShortcuts.isEmpty() ) - delete m_qtShortcuts.takeFirst(); + while ( !m_qtShortcuts->isEmpty() ) + delete m_qtShortcuts->takeFirst(); // Create new shortcuts (use GetHandle() so all events inside // the window are handled, not only in the container subwindow) + delete m_qtShortcuts; m_qtShortcuts = accel.ConvertShortcutTable( GetHandle() ); // Connect shortcuts to window - Q_FOREACH( QShortcut *s, m_qtShortcuts ) + Q_FOREACH( QShortcut *s, *m_qtShortcuts ) { QObject::connect( s, &QShortcut::activated, m_qtShortcutHandler, &wxQtShortcutHandler::activated ); QObject::connect( s, &QShortcut::activatedAmbiguously, m_qtShortcutHandler, &wxQtShortcutHandler::activated ); @@ -1470,7 +1475,7 @@ QWidget *wxWindowQt::GetHandle() const return m_qtWindow; } -QAbstractScrollArea *wxWindowQt::QtGetScrollBarsContainer() const +QScrollArea *wxWindowQt::QtGetScrollBarsContainer() const { return m_qtContainer; }