mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-28 18:33:45 +08:00
eefc084302
version: sunnypilot v2025.003.000 (dev) date: 2025-12-18T05:48:43 master commit: 16c052af0835f049a67b80251d8cc1114fc08bb4
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_;
|
|
};
|