mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 03:22:07 +08:00
33d5cfc393
date: 2025-12-18T23:23:16 master commit: 3cdee7b54718ee14bd85befd6c5bad3d699c5479
26 lines
527 B
C++
26 lines
527 B
C++
#pragma once
|
|
|
|
#include <QLabel>
|
|
#include <QMouseEvent>
|
|
|
|
class ElidedLabel : public QLabel {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ElidedLabel(QWidget *parent = 0);
|
|
explicit ElidedLabel(const QString &text, QWidget *parent = 0);
|
|
|
|
signals:
|
|
void clicked();
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override {
|
|
if (rect().contains(event->pos())) {
|
|
emit clicked();
|
|
}
|
|
}
|
|
QString lastText_, elidedText_;
|
|
};
|