1 /* elided_label.h 2 * 3 * Wireshark - Network traffic analyzer 4 * By Gerald Combs <gerald@wireshark.org> 5 * Copyright 1998 Gerald Combs 6 * 7 * SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 10 #ifndef ELIDED_LABEL_H 11 #define ELIDED_LABEL_H 12 13 #include <QLabel> 14 15 class ElidedLabel : public QLabel 16 { 17 Q_OBJECT 18 public: 19 explicit ElidedLabel(QWidget *parent = 0); 20 void setUrl(const QString &url); 21 void setSmallText(bool small_text = true) { small_text_ = small_text; } 22 23 protected: 24 virtual bool event(QEvent *event); 25 virtual void resizeEvent(QResizeEvent *); 26 27 private: 28 bool small_text_; 29 QString full_text_; 30 QString url_; 31 32 void updateText(); 33 34 signals: 35 36 public slots: 37 void clear(); 38 void setText(const QString &text); 39 }; 40 41 #endif // ELIDED_LABEL_H 42