Merge branch 'qt-build'
Minor wxQt API fixes and simplifications. See https://github.com/wxWidgets/wxWidgets/pull/962
This commit is contained in:
@@ -63,16 +63,14 @@ public:
|
||||
return wxItemContainer::GetStringSelection();
|
||||
}
|
||||
|
||||
virtual void Clear() wxOVERRIDE
|
||||
{
|
||||
wxTextEntry::Clear();
|
||||
wxItemContainer::Clear();
|
||||
}
|
||||
virtual void Clear() wxOVERRIDE;
|
||||
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
virtual void SetValue(const wxString& value) wxOVERRIDE;
|
||||
|
||||
virtual void Popup();
|
||||
virtual void Dismiss();
|
||||
|
||||
|
@@ -32,7 +32,6 @@ public:
|
||||
|
||||
virtual ~wxToolBar();
|
||||
|
||||
void Init();
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@@ -44,23 +43,27 @@ public:
|
||||
virtual QToolBar *GetQToolBar() const { return m_qtToolBar; }
|
||||
|
||||
virtual void SetWindowStyleFlag( long style ) wxOVERRIDE;
|
||||
|
||||
virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE;
|
||||
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
|
||||
|
||||
virtual bool Realize() wxOVERRIDE;
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(int toolid,
|
||||
const wxString& label,
|
||||
const wxBitmap& bmpNormal,
|
||||
const wxBitmap& bmpDisabled,
|
||||
wxItemKind kind,
|
||||
wxObject *clientData,
|
||||
const wxString& shortHelp,
|
||||
const wxString& longHelp) wxOVERRIDE;
|
||||
const wxBitmap& bmpDisabled = wxNullBitmap,
|
||||
wxItemKind kind = wxITEM_NORMAL,
|
||||
wxObject *clientData = NULL,
|
||||
const wxString& shortHelp = wxEmptyString,
|
||||
const wxString& longHelp = wxEmptyString) wxOVERRIDE;
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(wxControl *control,
|
||||
const wxString& label) wxOVERRIDE;
|
||||
QWidget *GetHandle() const wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
QActionGroup* GetActionGroup(size_t pos);
|
||||
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;
|
||||
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;
|
||||
@@ -69,6 +72,8 @@ protected:
|
||||
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
long GetButtonStyle();
|
||||
|
||||
QToolBar *m_qtToolBar;
|
||||
|
@@ -86,7 +86,7 @@ QList< QShortcut* > *wxAcceleratorTable::ConvertShortcutTable( QWidget *parent )
|
||||
{
|
||||
QList< QShortcut* > *qtList = new QList< QShortcut* >;
|
||||
|
||||
for ( wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() )
|
||||
for ( wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
qtList->push_back(ConvertAccelerator( node->GetData(), parent ));
|
||||
}
|
||||
|
@@ -118,6 +118,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
void wxComboBox::SetValue(const wxString& value)
|
||||
{
|
||||
if ( HasFlag(wxCB_READONLY) )
|
||||
SetStringSelection(value);
|
||||
else
|
||||
wxTextEntry::SetValue(value);
|
||||
}
|
||||
|
||||
wxString wxComboBox::DoGetValue() const
|
||||
{
|
||||
return wxQtConvertString( m_qtComboBox->currentText() );
|
||||
@@ -133,6 +141,12 @@ void wxComboBox::Dismiss()
|
||||
static_cast<QComboBox *>(GetHandle())->hidePopup();
|
||||
}
|
||||
|
||||
void wxComboBox::Clear()
|
||||
{
|
||||
wxTextEntry::Clear();
|
||||
wxItemContainer::Clear();
|
||||
}
|
||||
|
||||
void wxComboBox::SetSelection( long from, long to )
|
||||
{
|
||||
// SelectAll uses -1 to -1, adjust for qt:
|
||||
|
@@ -185,6 +185,41 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
|
||||
{
|
||||
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
|
||||
if ( tool )
|
||||
{
|
||||
(void)tool->SetShortHelp(helpString);
|
||||
//TODO - other qt actions for tool tip string
|
||||
// if (tool->m_item)
|
||||
// {}
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
|
||||
{
|
||||
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
|
||||
if ( tool )
|
||||
{
|
||||
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||
|
||||
tool->SetNormalBitmap(bitmap);
|
||||
tool->SetIcon();
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
|
||||
{
|
||||
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
|
||||
if ( tool )
|
||||
{
|
||||
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||
|
||||
tool->SetDisabledBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolBar::SetWindowStyleFlag( long style )
|
||||
{
|
||||
wxToolBarBase::SetWindowStyleFlag(style);
|
||||
@@ -249,7 +284,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
||||
{
|
||||
wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
|
||||
QAction *before = NULL;
|
||||
if (pos >= 0 && pos < (size_t)m_qtToolBar->actions().size())
|
||||
if (pos < (size_t)m_qtToolBar->actions().size())
|
||||
before = m_qtToolBar->actions().at(pos);
|
||||
|
||||
QAction *action;
|
||||
|
@@ -194,8 +194,7 @@ wxWindowQt::~wxWindowQt()
|
||||
// Delete only if the qt widget was created or assigned to this base class
|
||||
if (m_qtWindow)
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow=%p"),
|
||||
(const char*)GetName(), m_qtWindow);
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow=%p"), GetName(), m_qtWindow);
|
||||
// Avoid sending further signals (i.e. if deleting the current page)
|
||||
m_qtWindow->blockSignals(true);
|
||||
// Reset the pointer to avoid handling pending event and signals
|
||||
@@ -206,8 +205,7 @@ wxWindowQt::~wxWindowQt()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"),
|
||||
(const char*)GetName());
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,8 +258,7 @@ void wxWindowQt::PostCreation(bool generic)
|
||||
// store pointer to the QWidget subclass (to be used in the destructor)
|
||||
m_qtWindow = GetHandle();
|
||||
}
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Create %s m_qtWindow=%p"),
|
||||
(const char*)GetName(), m_qtWindow);
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Create %s m_qtWindow=%p"), GetName(), m_qtWindow);
|
||||
|
||||
// set the background style after creation (not before like in wxGTK)
|
||||
// (only for generic controls, to use qt defaults elsewere)
|
||||
@@ -395,7 +392,7 @@ void wxWindowQt::WarpPointer(int x, int y)
|
||||
|
||||
void wxWindowQt::Update()
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Update %s"), (const char*)GetName());
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Update %s"), GetName());
|
||||
// send the paint event to the inner widget in scroll areas:
|
||||
if ( QtGetScrollBarsContainer() )
|
||||
{
|
||||
@@ -422,14 +419,13 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect )
|
||||
if ( rect != NULL )
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s rect %d %d %d %d"),
|
||||
(const char*)GetName(),
|
||||
GetName(),
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
widget->update( wxQtConvertRect( *rect ));
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"),
|
||||
(const char*)GetName());
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"), GetName());
|
||||
widget->update();
|
||||
}
|
||||
}
|
||||
@@ -1083,7 +1079,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
|
||||
if ( UseBgCol() && !GetHandle()->autoFillBackground() )
|
||||
{
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s clearing DC to %s"),
|
||||
(const char*)GetName(), GetBackgroundColour().GetAsString()
|
||||
GetName(), GetBackgroundColour().GetAsString()
|
||||
);
|
||||
dc.SetBackground(GetBackgroundColour());
|
||||
dc.Clear();
|
||||
@@ -1132,8 +1128,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
|
||||
else
|
||||
{
|
||||
// Painter didn't begun, not handled by wxWidgets:
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"),
|
||||
(const char*)GetName() );
|
||||
wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"), GetName() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user