Debian Codegraph @

src/Gui/ElideLabel.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /****************************************************************************
3 * *
4 * Copyright (c) 2025 Alfredo Monclus <[email protected]> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 ***************************************************************************/
23
24 // This custom widget adds the missing ellipsize functionality in QT5
25
26 #ifndef ELIDELABEL_H
27 #define ELIDELABEL_H
28
29 #include <QLabel>
30 #include <QPainter>
31 #include <QFontMetrics>
32
33 #include <FCGlobal.h>
34
35 namespace Gui
36 {
37
38 class GuiExport ElideLabel: public QLabel
39 {
40 Q_OBJECT
41
42 public:
43 explicit ElideLabel(QWidget* parent = nullptr);
44 ~ElideLabel() override = default;
45
46 protected:
47 void paintEvent(QPaintEvent* event) override;
48 QSize sizeHint() const override;
49 QSize minimumSizeHint() const override;
50 };
51
52 } // namespace Gui
53
54 #endif // ELIDELABEL_H