Panda3DS/include/panda_qt/elided_label.hpp
wheremyfoodat aa7a6bfe7a
s/ellided/elided (#510)
* s/ellided/elided

* Fix header name
2024-05-08 03:20:39 +03:00

21 lines
No EOL
520 B
C++

#pragma once
#include <QFontMetrics>
#include <QLabel>
#include <QString>
#include <QWidget>
class ElidedLabel : public QLabel {
Q_OBJECT
public:
explicit ElidedLabel(Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);
explicit ElidedLabel(QString text, Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);
void setText(QString text);
protected:
void resizeEvent(QResizeEvent* event);
private:
void updateText();
QString m_text;
Qt::TextElideMode m_elideMode;
};