ElidingLabel.h
Go to the documentation of this file.
1 #ifndef ElidingLabelH
2 #define ElidingLabelH
3 /*******************************************************************************
4 ** Qt Advanced Docking System
5 ** Copyright (C) 2017 Uwe Kindler
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; If not, see <http://www.gnu.org/licenses/>.
19 ******************************************************************************/
20 
21 
22 //============================================================================
27 //============================================================================
28 
29 //============================================================================
30 // INCLUDES
31 //============================================================================
32 #include <QLabel>
33 
34 #include "ads_globals.h"
35 
36 namespace ads
37 {
38 struct ElidingLabelPrivate;
39 
46 class ADS_EXPORT CElidingLabel : public QLabel
47 {
48  Q_OBJECT
49 private:
51  friend struct ElidingLabelPrivate;
52 
53 protected:
54  virtual void mouseReleaseEvent(QMouseEvent* event) override;
55  virtual void resizeEvent( QResizeEvent *event ) override;
56  virtual void mouseDoubleClickEvent( QMouseEvent *ev ) override;
57 
58 public:
59  using Super = QLabel;
60 
61  CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
62  CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);
63  virtual ~CElidingLabel();
64 
69  Qt::TextElideMode elideMode() const;
70 
74  void setElideMode(Qt::TextElideMode mode);
75 
79  bool isElided() const;
80 
81 public: // reimplements QLabel ----------------------------------------------
82  virtual QSize minimumSizeHint() const override;
83  virtual QSize sizeHint() const override;
84  void setText(const QString &text);
85  QString text() const;
86 
87 signals:
92  void clicked();
93 
97  void doubleClicked();
98 
102  void elidedChanged(bool elided);
103 }; //class CElidingLabel
104 
105 } // namespace QtLabb
106 
107 //---------------------------------------------------------------------------
108 #endif // ElidingLabelH
Declaration of.
#define ADS_EXPORT
Definition: ads_globals.h:50
ElidingLabelPrivate * d
Definition: ElidingLabel.h:50


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:47:34