qt5base-lts/examples/widgets/elidedlabel/elidedlabel.h
2011-06-01 15:55:15 +02:00

37 lines
735 B
C++

#ifndef ELIDEDLABEL_H
#define ELIDEDLABEL_H
#include <QtWidgets/QFrame>
#include <QtCore/QRect>
#include <QtGui/QResizeEvent>
#include <QtCore/QString>
#include <QtWidgets/QWidget>
//! [0]
class ElidedLabel : public QFrame
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(bool isElided READ isElided)
public:
ElidedLabel(const QString &text, QWidget *parent = 0);
void setText(const QString &text);
const QString & text() const { return content; }
bool isElided() const { return elided; }
protected:
void paintEvent(QPaintEvent *event);
signals:
void elisionChanged(bool elided);
private:
bool elided;
QString content;
};
//! [0]
#endif // TEXTWRAPPINGWIDGET_H