Improve build and widget storage

There are no longer any qt headers included in wx/qt headers.
Applications do not need to link with qt librarys anymore, only wxqt libraries.
wxWindow and derived widgets only contain one pointer to their qtwidget, no longer
  carrying both base and derived pointers in parallel as was before.
This commit is contained in:
Sean D'Epagnier 2016-08-25 11:56:00 -04:00 committed by Vadim Zeitlin
parent 88e134ef81
commit 35bc8f449b
102 changed files with 446 additions and 305 deletions

2
configure vendored
View File

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

View File

@ -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
],
[

View File

@ -9,9 +9,6 @@
#ifndef _WX_QT_ACCEL_H_
#define _WX_QT_ACCEL_H_
#include <QtCore/QList>
#include <QtWidgets/QShortcut>
/* 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;

View File

@ -9,7 +9,7 @@
#ifndef _WX_QT_ANYBUTTON_H_
#define _WX_QT_ANYBUTTON_H_
#include <QtWidgets/QPushButton>
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:

View File

@ -9,8 +9,7 @@
#ifndef _WX_QT_APP_H_
#define _WX_QT_APP_H_
#include <QtWidgets/QApplication>
class QApplication;
class WXDLLIMPEXP_CORE wxApp : public wxAppBase
{
public:

View File

@ -8,8 +8,6 @@
#ifndef _WX_QT_BRUSH_H_
#define _WX_QT_BRUSH_H_
#include <QtCore/Qt>
class QBrush;
class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase

View File

@ -11,7 +11,7 @@
#define _WX_QT_CALCTRL_H_
#include "wx/calctrl.h"
#include <QtWidgets/QCalendarWidget>
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();

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_CHECKBOX_H_
#define _WX_QT_CHECKBOX_H_
#include <QtWidgets/QCheckBox>
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);

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_CHOICE_H_
#define _WX_QT_CHOICE_H_
#include <QtWidgets/QComboBox>
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,

View File

@ -10,7 +10,7 @@
#include "wx/dialog.h"
#include <QtWidgets/QColorDialog>
class QColorDialog;
class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog
{
@ -23,9 +23,8 @@ public:
wxColourData &GetColourData();
QColorDialog *GetHandle() const { return static_cast<QColorDialog *>(m_qtWindow); }
private:
QColorDialog *GetQColorDialog() const;
wxColourData m_data;
};

View File

@ -9,7 +9,7 @@
#define _WX_QT_COMBOBOX_H_
#include "wx/choice.h"
#include <QtWidgets/QComboBox>
class QComboBox;
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, public wxTextEntry
{

View File

@ -10,7 +10,7 @@
#include "wx/image.h"
#include <QtGui/QCursor>
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;

View File

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

View File

@ -8,12 +8,13 @@
#ifndef _WX_QT_DATAOBJ_H_
#define _WX_QT_DATAOBJ_H_
#include <QMimeData>
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_

View File

@ -8,8 +8,7 @@
#ifndef _WX_QT_DC_H_
#define _WX_QT_DC_H_
#include <QtGui/QPainter>
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();
};

View File

@ -9,7 +9,7 @@
#define _WX_QT_DIALOG_H_
#include "wx/dialog.h"
#include <QtWidgets/QDialog>
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:

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_DIRDLG_H_
#define _WX_QT_DIRDLG_H_
#include <QtWidgets/QFileDialog>
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);
};

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_EVTLOOP_H_
#define _WX_QT_EVTLOOP_H_
#include <QtCore/QTimer>
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_

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_FILEDLG_H_
#define _WX_QT_FILEDLG_H_
#include <QtWidgets/QFileDialog>
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:

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_FONTDLG_H_
#define _WX_QT_FONTDLG_H_
#include <QtWidgets/QFontDialog>
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<QFontDialog *>(m_qtWindow); }
protected:
bool DoCreate(wxWindow *parent);

View File

@ -12,8 +12,9 @@
#define _WX_QT_FRAME_H_
#include "wx/frame.h"
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QScrollArea>
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<QMainWindow*>(m_qtWindow);
}
virtual QAbstractScrollArea *QtGetScrollBarsContainer() const;
QMainWindow *GetQMainWindow() const;
virtual QScrollArea *QtGetScrollBarsContainer() const;
protected:
virtual void DoGetClientSize(int *width, int *height) const;

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_GAUGE_H_
#define _WX_QT_GAUGE_H_
#include <QtWidgets/QProgressBar>
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);

View File

@ -8,7 +8,11 @@
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include <QtOpenGL/QGLWidget>
#include <GL/gl.h>
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<QGLWidget *>(m_qtWindow); }
private:
// wxDECLARE_EVENT_TABLE();

View File

@ -8,7 +8,9 @@
#ifndef _WX_QT_LISTBOX_H_
#define _WX_QT_LISTBOX_H_
#include <QtWidgets/QListWidget>
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);

View File

@ -9,7 +9,9 @@
#define _WX_QT_LISTCTRL_H_
#include "wx/textctrl.h"
#include <QtWidgets/QTreeWidget>
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();

View File

@ -8,8 +8,8 @@
#ifndef _WX_QT_MENU_H_
#define _WX_QT_MENU_H_
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
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();

View File

@ -9,7 +9,7 @@
#define _WX_QT_MENUITEM_H_
#include "wx/menuitem.h"
#include <QtWidgets/QAction>
class QAction;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxMenu;

View File

@ -10,7 +10,7 @@
#include "wx/msgdlg.h"
#include <QtWidgets/QMessageBox>
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_

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_NOTEBOOK_H_
#define _WX_QT_NOTEBOOK_H_
#include <QtWidgets/QTabWidget>
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);

View File

@ -8,8 +8,6 @@
#ifndef _WX_QT_PEN_H_
#define _WX_QT_PEN_H_
#include <QtCore/Qt>
class QPen;
class WXDLLIMPEXP_CORE wxPen : public wxPenBase

View File

@ -10,14 +10,14 @@
#if wxUSE_TIMER
#include "wx/private/timer.h"
#include <QtCore/QObject>
#include "wx/private/timer.h"
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
class QTimerEvent;
class WXDLLIMPEXP_CORE wxQtTimerImpl : public wxTimerImpl, QObject
{
public:

View File

@ -11,13 +11,15 @@
#ifndef _WX_QT_EVENTSIGNALFORWARDER_H_
#define _WX_QT_EVENTSIGNALFORWARDER_H_
#include <QtCore/QEvent>
#include <QtGui/QCloseEvent>
#include "wx/log.h"
#include "wx/window.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/utils.h"
#include <QtCore/QEvent>
#include <QtGui/QPaintEvent>
class QPaintEvent;
template< typename Handler >
class wxQtSignalHandler

View File

@ -8,9 +8,9 @@
#ifndef _WX_QT_RADIOBOX_H_
#define _WX_QT_RADIOBOX_H_
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QVBoxLayout>
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:

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_RADIOBUT_H_
#define _WX_QT_RADIOBUT_H_
#include <QtWidgets/QRadioButton>
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:

View File

@ -9,7 +9,9 @@
#ifndef _WX_QT_REGION_H_
#define _WX_QT_REGION_H_
#include <QtGui/QRegion>
class QRegion;
class QRect;
template<class T> 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;
};

View File

@ -10,7 +10,7 @@
#include "wx/scrolbar.h"
#include <QtWidgets/QScrollBar>
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;

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_SLIDER_H_
#define _WX_QT_SLIDER_H_
#include <QtWidgets/QSlider>
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;

View File

@ -9,7 +9,7 @@
#define _WX_QT_SPINBUTT_H_
#include "wx/spinbutt.h"
#include <QtWidgets/QSpinBox>
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;

View File

@ -8,8 +8,8 @@
#ifndef _WX_QT_SPINCTRL_H_
#define _WX_QT_SPINCTRL_H_
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QDoubleSpinBox>
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;

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_STATBMP_H_
#define _WX_QT_STATBMP_H_
#include <QtWidgets/QLabel>
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:

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_STATBOX_H_
#define _WX_QT_STATBOX_H_
#include <QtWidgets/QGroupBox>
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:

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_STATLINE_H_
#define _WX_QT_STATLINE_H_
#include <QtWidgets/QFrame>
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;

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_STATTEXT_H_
#define _WX_QT_STATTEXT_H_
#include <QtWidgets/QLabel>
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;

View File

@ -10,13 +10,15 @@
#include "wx/statusbr.h"
#include <QtWidgets/QLabel>
#include <QtWidgets/QStatusBar>
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);
};

View File

@ -8,12 +8,13 @@
#ifndef _WX_QT_TASKBAR_H_
#define _WX_QT_TASKBAR_H_
#include <QtWidgets/QSystemTrayIcon>
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);
};

View File

@ -8,8 +8,9 @@
#ifndef _WX_QT_TEXTCTRL_H_
#define _WX_QT_TEXTCTRL_H_
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QTextEdit>
class QLineEdit;
class QTextEdit;
class QScrollArea;
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
{

View File

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

View File

@ -5,7 +5,7 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <QtWidgets/QToolBar>
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;

View File

@ -8,7 +8,7 @@
#ifndef _WX_QT_TREECTRL_H_
#define _WX_QT_TREECTRL_H_
#include <QtWidgets/QTreeWidget>
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;

View File

@ -9,8 +9,27 @@
#ifndef _WX_QT_WINDOW_H_
#define _WX_QT_WINDOW_H_
#include <QtWidgets/QWidget>
#include <QtWidgets/QScrollArea>
#include <list>
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

View File

@ -12,6 +12,7 @@
#include "wx/list.h"
#include "wx/qt/private/converter.h"
#include <QtCore/QVariant>
#include <QtWidgets/QShortcut>
// ----------------------------------------------------------------------------
// 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;

View File

@ -14,11 +14,12 @@
#include "wx/anybutton.h"
#endif
#include <QtWidgets/QPushButton>
#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;
}

View File

@ -13,6 +13,7 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/converter.h"
#include <QtCore/QStringList>
#include <QtWidgets/QApplication>
wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxAppBase);

View File

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

View File

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

View File

@ -21,6 +21,7 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QPushButton>
wxButton::wxButton()
{

View File

@ -22,7 +22,7 @@
#include "wx/qt/private/winevent.h"
#include <QtGui/QTextCharFormat>
#include <QtWidgets/QCalendarWidget>
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;
}

View File

@ -13,6 +13,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QCheckBox>
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;
}

View File

@ -10,6 +10,8 @@
#include "wx/checklst.h"
#include <QtWidgets/QListWidgetItem>
wxCheckListBox::wxCheckListBox()
{
}

View File

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

View File

@ -20,6 +20,7 @@
#include "wx/scopeguard.h"
#include "wx/qt/private/converter.h"
#include <QtCore/QMimeData>
// ----------------------------------------------------------------------------
// 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<wxTextDataObject*>(&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)

View File

@ -11,6 +11,8 @@
#include "wx/qt/private/winevent.h"
#include "wx/colordlg.h"
#include <QtWidgets/QColorDialog>
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<QColorDialog*>(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; i<wxColourData::NUM_CUSTOM; i++)
m_data.SetCustomColour(i, GetHandle()->customColor(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<QColorDialog *>(m_qtWindow);
}

View File

@ -12,7 +12,9 @@
#include "wx/window.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QComboBox>
#include <QtWidgets/QLineEdit>
class wxQtComboBox : public wxQtEventSignalHandler< QComboBox, wxComboBox >
{
@ -123,12 +125,12 @@ wxString wxComboBox::DoGetValue() const
void wxComboBox::Popup()
{
GetHandle()->showPopup();
static_cast<QComboBox *>(GetHandle())->showPopup();
}
void wxComboBox::Dismiss()
{
GetHandle()->hidePopup();
static_cast<QComboBox *>(GetHandle())->hidePopup();
}
void wxComboBox::SetSelection( long from, long to )

View File

@ -11,6 +11,8 @@
#include "wx/control.h"
#include "wx/qt/private/converter.h"
#include <QtWidgets/QWidget>
wxIMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow);
wxControl::wxControl()

View File

@ -12,18 +12,17 @@
#pragma hdrstop
#endif
#include <QObject>
#include "wx/qt/private/converter.h"
#include "wx/qt/private/utils.h"
#include "wx/dataobj.h"
#include <QtCore/QMimeData>
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;
}

View File

@ -13,6 +13,8 @@
#endif
#include <QtGui/QBitmap>
#include <QtGui/QPen>
#include <QtGui/QPainter>
#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 <QtGui/QPen>
#include <QtGui/QPainter>
#include <QtGui/QScreen>
#include <QtWidgets/QApplication>
#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

View File

@ -22,6 +22,8 @@
#include "wx/dcclient.h"
#include "wx/qt/dcclient.h"
#include <QtWidgets/QScrollArea>
#include <QtGui/QPainter>
//##############################################################################

View File

@ -11,6 +11,8 @@
#include "wx/dcmemory.h"
#include "wx/qt/dcmemory.h"
#include <QtGui/QPainter>
wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
: wxQtDCImpl( owner )
{

View File

@ -12,6 +12,7 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QDialog>
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<QDialog*>(m_qtWindow);
}

View File

@ -16,6 +16,23 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QSocketNotifier>
#include <QtCore/QTimer>
#include <QtWidgets/QApplication>
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 )
{

View File

@ -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<QFileDialog *>(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<QFileDialog *>(m_qtWindow);
}

View File

@ -11,6 +11,8 @@
#include "wx/qt/private/winevent.h"
#include "wx/fontdlg.h"
#include <QtWidgets/QFontDialog>
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<QFontDialog*>(m_qtWindow)->setCurrentFont(m_fontData.GetInitialFont().GetHandle());
return wxFontDialogBase::DoCreate(parent);
}

View File

@ -12,8 +12,6 @@
#pragma hdrstop
#endif
#include <QtWidgets/QScrollArea>
#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 <QtWidgets/QScrollArea>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
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 <QAbstractScrollArea *> (GetHandle()->centralWidget() );
return dynamic_cast <QScrollArea *> (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<QMainWindow*>(m_qtWindow);
}
//=============================================================================
wxQtMainWindow::wxQtMainWindow( wxWindow *parent, wxFrame *handler )

View File

@ -12,6 +12,7 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QProgressBar>
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;
}

View File

@ -12,6 +12,8 @@
#include "wx/qt/private/winevent.h"
#include "wx/glcanvas.h"
#include <QtOpenGL/QGLWidget>
class wxQtGLWidget : public wxQtEventSignalHandler< QGLWidget, wxGLCanvas >
{
public:
@ -378,7 +380,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
bool wxGLCanvas::SwapBuffers()
{
GetHandle()->swapBuffers();
static_cast<QGLWidget *>(m_qtWindow)->swapBuffers();
return true;
}

View File

@ -11,6 +11,7 @@
#include "wx/listbox.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QListWidget>
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;
}

View File

@ -22,6 +22,7 @@
#include "wx/imaglist.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QTreeWidget>
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;
}

View File

@ -14,7 +14,9 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMainWindow>
// 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<QMdiArea*>(parent->GetHandle()->centralWidget())->addSubWindow(GetHandle());
static_cast<QMdiArea*>(parent->GetQMainWindow()->centralWidget())->addSubWindow(GetHandle());
}
return ok;
}

View File

@ -12,6 +12,8 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/converter.h"
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
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;
}

View File

@ -15,6 +15,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QAction>
#include <QtWidgets/QMenuBar>
class wxQtAction : public QAction, public wxQtSignalHandler< wxMenuItem >
{

View File

@ -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<QDialog*>(m_qtWindow)->exec();
switch ( ret )
{
case QMessageBox::Ok:
@ -132,11 +133,6 @@ int wxMessageDialog::ShowModal()
}
}
QMessageBox *wxMessageDialog::GetHandle() const
{
return static_cast<QMessageBox*>(m_qtWindow);
}
wxMessageDialog::~wxMessageDialog()
{
}

View File

@ -13,6 +13,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QTabWidget>
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;
}

View File

@ -15,7 +15,8 @@
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QBoxLayout>
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;
}

View File

@ -11,6 +11,8 @@
#include "wx/radiobut.h"
#include "wx/qt/private/converter.h"
#include <QtWidgets/QRadioButton>
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;
}

View File

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

View File

@ -12,6 +12,7 @@
#include "wx/qt/private/utils.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QScrollBar>
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;
}

View File

@ -12,6 +12,7 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QSlider>
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;
}

View File

@ -11,6 +11,7 @@
#include "wx/spinbutt.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QSpinBox>
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;
}

View File

@ -15,6 +15,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QSpinBox>
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;
}

View File

@ -11,6 +11,8 @@
#include "wx/statbmp.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QLabel>
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;
}

View File

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

View File

@ -10,6 +10,8 @@
#include "wx/statline.h"
#include <QtWidgets/QFrame>
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;
}

View File

@ -12,6 +12,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QLabel>
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;
}

View File

@ -13,6 +13,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QLabel>
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;
}

View File

@ -10,6 +10,8 @@
#include "wx/taskbar.h"
#include <QtWidgets/QSystemTrayIcon>
//=============================================================================
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),

View File

@ -14,6 +14,9 @@
#include "wx/qt/private/winevent.h"
#include "wx/qt/private/utils.h"
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QTextEdit>
class wxQtLineEdit : public wxQtEventSignalHandler< QLineEdit, wxTextCtrl >
{
public:

View File

@ -21,6 +21,8 @@
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QPushButton>
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;
}

View File

@ -10,7 +10,7 @@
#if wxUSE_TIMER
#include "wx/qt/timer.h"
#include "wx/qt/private/timer.h"
#include <QtCore/QTimerEvent>
wxQtTimerImpl::wxQtTimerImpl( wxTimer* timer )

View File

@ -25,6 +25,8 @@
#include "wx/qt/private/winevent.h"
#include "wx/qt/private/converter.h"
#include <QtWidgets/QToolBar>
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<wxToolBarTool*>(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))

View File

@ -11,6 +11,7 @@
#include "wx/toplevel.h"
#include "wx/qt/private/converter.h"
#include <QtGui/QIcon>
#include <QtWidgets/QWidget>
wxTopLevelWindowQt::wxTopLevelWindowQt()
{

Some files were not shown because too many files have changed in this diff Show More