Merge branch 'qt-fixes'
Fix bugs preventing GUI tests from working with wxQt and provide native
implementations of wx{Date,Time}Ctrl in this port.
See #23925.
This commit is contained in:
commit
c601bf4279
41 changed files with 663 additions and 286 deletions
|
|
@ -89,6 +89,10 @@ typedef wxDatePickerCtrlCommonBase<wxDateTimePickerCtrl> wxDatePickerCtrlBase;
|
|||
#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/osx/datectrl.h"
|
||||
|
||||
#define wxHAS_NATIVE_DATEPICKCTRL
|
||||
#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/qt/datectrl.h"
|
||||
|
||||
#define wxHAS_NATIVE_DATEPICKCTRL
|
||||
#else
|
||||
#include "wx/generic/datectrl.h"
|
||||
|
|
|
|||
|
|
@ -31,12 +31,10 @@ public:
|
|||
#include "wx/msw/palette.h"
|
||||
#elif defined(__WXX11__)
|
||||
#include "wx/x11/palette.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#elif defined(__WXGTK__) || defined(__WXQT__)
|
||||
#include "wx/generic/paletteg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/osx/palette.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/palette.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ protected:
|
|||
virtual wxString DoGetValue() const override;
|
||||
|
||||
private:
|
||||
void SetActualValue(const wxString& value);
|
||||
bool IsReadOnly() const;
|
||||
|
||||
// From wxTextEntry:
|
||||
|
|
|
|||
62
include/wx/qt/datectrl.h
Normal file
62
include/wx/qt/datectrl.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/datectrl.h
|
||||
// Purpose: wxDatePickerCtrl for Qt
|
||||
// Author: Ali Kettab
|
||||
// Modified by:
|
||||
// Created: 2023-10-12
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_DATECTRL_H_
|
||||
#define _WX_QT_DATECTRL_H_
|
||||
|
||||
class QDateEdit;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDatePickerCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxDatePickerCtrl() = default;
|
||||
|
||||
wxDatePickerCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& dt = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxDatePickerCtrlNameStr)
|
||||
{
|
||||
Create(parent, id, dt, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& dt = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxDatePickerCtrlNameStr);
|
||||
|
||||
// Override this one to add date-specific (and time-ignoring) checks.
|
||||
virtual void SetValue(const wxDateTime& dt) override;
|
||||
virtual wxDateTime GetValue() const override;
|
||||
|
||||
// Implement the base class pure virtuals.
|
||||
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) override;
|
||||
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const override;
|
||||
|
||||
virtual QWidget *GetHandle() const override;
|
||||
|
||||
private:
|
||||
QDateEdit* m_qtDateEdit;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl);
|
||||
};
|
||||
|
||||
#endif // _WX_QT_DATECTRL_H_
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/palette.h
|
||||
// Author: Peter Most
|
||||
// Copyright: (c) Peter Most
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_PALETTE_H_
|
||||
#define _WX_QT_PALETTE_H_
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase
|
||||
{
|
||||
public:
|
||||
wxPalette();
|
||||
wxPalette(int n, unsigned char *red, unsigned char *green, unsigned char *blue);
|
||||
|
||||
bool Create(int n, unsigned char *red, unsigned char *green, unsigned char *blue);
|
||||
|
||||
bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
|
||||
int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
|
||||
|
||||
protected:
|
||||
virtual wxGDIRefData *CreateGDIRefData() const override;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxPalette);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WX_QT_PALETTE_H_
|
||||
|
|
@ -70,10 +70,14 @@ inline QColor wxQtConvertColour(const wxColour &colour)
|
|||
|
||||
class WXDLLIMPEXP_FWD_BASE wxDateTime;
|
||||
class QDate;
|
||||
class QTime;
|
||||
|
||||
wxDateTime wxQtConvertDate(const QDate& date);
|
||||
QDate wxQtConvertDate(const wxDateTime& date);
|
||||
|
||||
wxDateTime wxQtConvertTime(const QTime& Time);
|
||||
QTime wxQtConvertTime(const wxDateTime& time);
|
||||
|
||||
#endif // wxUSE_DATETIME
|
||||
|
||||
inline wxSize wxQtConvertSize( const QSize &size )
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ protected:
|
|||
virtual void DoSetValue(const wxString& value, int flags=0) override;
|
||||
|
||||
virtual wxWindow *GetEditableWindow() override;
|
||||
|
||||
// Block/unblock the corresponding Qt signal.
|
||||
virtual void EnableTextChangedEvents(bool enable) override;
|
||||
};
|
||||
|
||||
#endif // _WX_QT_TEXTENTRY_H_
|
||||
|
|
|
|||
57
include/wx/qt/timectrl.h
Normal file
57
include/wx/qt/timectrl.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/timectrl.h
|
||||
// Purpose: wxTimePickerCtrl for Qt.
|
||||
// Author: Ali Kettab
|
||||
// Created: 2023-10-13
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_TIMECTRL_H_
|
||||
#define _WX_QT_TIMECTRL_H_
|
||||
|
||||
class QTimeEdit;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimePickerCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxTimePickerCtrl() = default;
|
||||
|
||||
wxTimePickerCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& dt = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTP_DEFAULT,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTimePickerCtrlNameStr)
|
||||
{
|
||||
Create(parent, id, dt, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& dt = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTP_DEFAULT,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTimePickerCtrlNameStr);
|
||||
|
||||
// Override this one to add time-specific (and date-ignoring) checks.
|
||||
virtual void SetValue(const wxDateTime& dt) override;
|
||||
virtual wxDateTime GetValue() const override;
|
||||
|
||||
virtual QWidget *GetHandle() const override;
|
||||
|
||||
private:
|
||||
QTimeEdit* m_qtTimeEdit;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl);
|
||||
};
|
||||
|
||||
#endif // _WX_QT_TIMECTRL_H_
|
||||
|
|
@ -136,10 +136,6 @@ public:
|
|||
virtual bool SetBackgroundColour(const wxColour& colour) override;
|
||||
virtual bool SetForegroundColour(const wxColour& colour) override;
|
||||
|
||||
// Min/max sizes
|
||||
virtual void SetMinSize(const wxSize& minSize) override;
|
||||
virtual void SetMaxSize(const wxSize& maxSize) override;
|
||||
|
||||
QWidget *GetHandle() const override;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
|
@ -229,11 +225,6 @@ protected:
|
|||
// itself.
|
||||
virtual QWidget* QtGetParentWidget() const { return GetHandle(); }
|
||||
|
||||
// Set{Min,Max}Size() and DoSetSizeHints() overrides call these functions
|
||||
// to transfer min/max size information to Qt.
|
||||
void QtSetMinSize(const wxSize& minSize);
|
||||
void QtSetMaxSize(const wxSize& maxSize);
|
||||
|
||||
QWidget *m_qtWindow;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ typedef wxTimePickerCtrlCommonBase<wxDateTimePickerCtrl> wxTimePickerCtrlBase;
|
|||
#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/osx/timectrl.h"
|
||||
|
||||
#define wxHAS_NATIVE_TIMEPICKERCTRL
|
||||
#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/qt/timectrl.h"
|
||||
|
||||
#define wxHAS_NATIVE_TIMEPICKERCTRL
|
||||
#else
|
||||
#include "wx/generic/timectrl.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue