Fix bitmap accessor for the buttons in wxQt
Return the bitmap previously set with SetBitmap(). This fixes unit tests using GetBitmap(). Closes https://github.com/wxWidgets/wxWidgets/pull/1035
This commit is contained in:
committed by
Vadim Zeitlin
parent
29f771ab82
commit
5e089badc0
@@ -26,11 +26,12 @@ public:
|
||||
// --------------
|
||||
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
|
||||
|
||||
virtual QWidget *GetHandle() const;
|
||||
|
||||
protected:
|
||||
virtual wxBitmap DoGetBitmap(State state) const wxOVERRIDE;
|
||||
virtual void DoSetBitmap(const wxBitmap& bitmap, State which) wxOVERRIDE;
|
||||
|
||||
QPushButton *m_qtPushButton;
|
||||
|
||||
@@ -39,6 +40,7 @@ protected:
|
||||
|
||||
private:
|
||||
typedef wxAnyButtonBase base_type;
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
|
||||
};
|
||||
|
@@ -58,6 +58,8 @@ void wxAnyButton::QtSetBitmap( const wxBitmap &bitmap )
|
||||
QPixmap *pixmap = bitmap.GetHandle();
|
||||
m_qtPushButton->setIcon( QIcon( *pixmap ));
|
||||
m_qtPushButton->setIconSize( pixmap->rect().size() );
|
||||
|
||||
m_bitmap = bitmap;
|
||||
}
|
||||
|
||||
void wxAnyButton::SetLabel( const wxString &label )
|
||||
@@ -70,6 +72,11 @@ QWidget *wxAnyButton::GetHandle() const
|
||||
return m_qtPushButton;
|
||||
}
|
||||
|
||||
wxBitmap wxAnyButton::DoGetBitmap(State state) const
|
||||
{
|
||||
return state == State_Normal ? m_bitmap : wxNullBitmap;
|
||||
}
|
||||
|
||||
void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which)
|
||||
{
|
||||
switch ( which )
|
||||
|
Reference in New Issue
Block a user