Go to the documentation of this file.
17 #include <qdrawutil.h>
20 #include <qstyleoption.h>
30 const int ph = w->style()->pixelMetric(
31 QStyle::PM_ButtonShiftHorizontal, &option, w );
32 const int pv = w->style()->pixelMetric(
33 QStyle::PM_ButtonShiftVertical, &option, w );
34 return QSize( ph, pv );
66 const bool doUpdate = updatesEnabled();
68 setUpdatesEnabled(
false );
77 setUpdatesEnabled(
true );
115 const int flags = Qt::AlignLeft | Qt::AlignVCenter
116 | Qt::TextExpandTabs | Qt::TextWordWrap;
139 ? Qt::TabFocus : Qt::NoFocus );
167 if (
icon.width() > 0 )
225 const bool isBlocked = signalsBlocked();
226 blockSignals(
true );
230 blockSignals( isBlocked );
274 sz.setHeight( qMax( sz.height(),
m_data->
icon.height() + 4 ) );
288 const QRect cr = contentsRect();
290 QPainter painter(
this );
291 painter.setClipRegion( e->region() );
295 qDrawWinButton( &painter, 0, 0, width(), height(),
304 painter.translate( shiftSize.width(), shiftSize.height() );
307 painter.setClipRect( cr );
314 iconRect.setX( iconRect.x() +
margin() );
319 iconRect.setSize(
m_data->
icon.size() / devicePixelRatio );
320 iconRect.moveCenter( QPoint( iconRect.center().x(), cr.center().y() ) );
331 if ( e->button() == Qt::LeftButton )
348 QwtTextLabel::mousePressEvent( e );
354 if ( e->button() == Qt::LeftButton )
370 QwtTextLabel::mouseReleaseEvent( e );
376 if ( e->key() == Qt::Key_Space )
382 if ( !e->isAutoRepeat() )
388 if ( !e->isAutoRepeat() )
396 QwtTextLabel::keyPressEvent( e );
402 if ( e->key() == Qt::Key_Space )
408 if ( !e->isAutoRepeat() )
420 QwtTextLabel::keyReleaseEvent( e );
424 #include "moc_qwt_legend_label.cpp"
Attributes of an entry on a legend.
const QwtLegendData & data() const
Mode
Mode defining how a legend entry interacts.
void setData(const QwtLegendData &)
QSize qwtExpandedToGlobalStrut(const QSize &size)
void pressed()
Signal, when the legend item has been pressed.
bool hasRole(int role) const
void setItemMode(QwtLegendData::Mode)
bool isChecked() const
Return true, if the item is checked.
void clicked()
Signal, when the legend item has been clicked.
const QwtText & text() const
Return the text.
int indent
Return label's text indent in pixels.
void setRenderFlags(int)
Change the render flags.
virtual QSize sizeHint() const QWT_OVERRIDE
Return a size hint.
QwtLegendData::Mode itemMode() const
void setDown(bool)
Set the item being down.
QwtLegendLabel(QWidget *parent=0)
virtual void paintEvent(QPaintEvent *) QWT_OVERRIDE
Paint event.
static QSize buttonShift(const QwtLegendLabel *w)
void checked(bool)
Signal, when the legend item has been toggled.
virtual void keyPressEvent(QKeyEvent *) QWT_OVERRIDE
Handle key press events.
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
A class representing a text.
QwtLegendData::Mode itemMode
A Widget which displays a QwtText.
@ Clickable
The legend item is clickable, like a push button.
A widget representing something on a QwtLegend.
static const int ButtonFrame
virtual void keyReleaseEvent(QKeyEvent *) QWT_OVERRIDE
Handle key release events.
virtual ~QwtLegendLabel()
Destructor.
QPixmap toPixmap(qreal devicePixelRatio=0.0) const
Convert the graphic to a QPixmap.
virtual void drawContents(QPainter *)
Redraw the text and focus indicator.
void setIcon(const QPixmap &)
void released()
Signal, when the legend item has been released.
virtual void mouseReleaseEvent(QMouseEvent *) QWT_OVERRIDE
Handle mouse release events.
bool isDown() const
Return true, if the item is down.
virtual void mousePressEvent(QMouseEvent *) QWT_OVERRIDE
Handle mouse press events.
@ Checkable
The legend item is checkable, like a checkable button.
virtual void setText(const QwtText &) QWT_OVERRIDE
virtual QSize sizeHint() const QWT_OVERRIDE
Return a size hint.
void setSpacing(int spacing)
Change the spacing between icon and text.
void setText(const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
static qreal devicePixelRatio(const QPaintDevice *)
@ ReadOnly
The legend item is not interactive, like a label.
int margin
Return label's text margin in pixels.
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45