Files
wxWidgets/src/qt/stattext.cpp
Vadim Zeitlin a51af03670 Revert "Add support for alignment flags to wxStaticText in wxQt"
This reverts commit 0f49825d64 because it
accidentally included unrelated changes. It will be re-committed again
soon.

See https://github.com/wxWidgets/wxWidgets/pull/1381
2019-07-03 23:47:09 +02:00

75 lines
2.0 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/stattext.cpp
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/stattext.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QLabel>
class wxQtStaticText : public wxQtEventSignalHandler< QLabel, wxStaticText >
{
public:
wxQtStaticText( wxWindow *parent, wxStaticText *handler ):
wxQtEventSignalHandler< QLabel, wxStaticText >( parent, handler ){}
};
wxStaticText::wxStaticText() :
m_qtLabel(NULL)
{
}
wxStaticText::wxStaticText(wxWindow *parent,
wxWindowID id,
const wxString &label,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name)
{
Create( parent, id, label, pos, size, style, name );
}
bool wxStaticText::Create(wxWindow *parent,
wxWindowID id,
const wxString &label,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name)
{
m_qtLabel = new wxQtStaticText( parent, this );
m_qtLabel->setText( wxQtConvertString( label ) );
// Set the buddy to itself to get the mnemonic key but ensure that we don't have
// any unwanted side effects, so disable the interaction:
m_qtLabel->setBuddy( m_qtLabel );
m_qtLabel->setTextInteractionFlags( Qt::NoTextInteraction );
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
}
void wxStaticText::SetLabel(const wxString& label)
{
m_qtLabel->setText( wxQtConvertString( label ) );
}
wxString wxStaticText::GetLabel() const
{
return wxQtConvertString( m_qtLabel->text() );
}
QWidget *wxStaticText::GetHandle() const
{
return m_qtLabel;
}