Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ElidedLabel.h « widgets « gui « src - github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7694b5a108d9df336dc16a375b3d80a3a4cd219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 *  Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 or (at your option)
 *  version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef KEEPASSX_ELIDEDLABEL_H
#define KEEPASSX_ELIDEDLABEL_H

#include <QLabel>

class QResizeEvent;

class ElidedLabel : public QLabel
{
    Q_OBJECT
    Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode NOTIFY elideModeChanged)
    Q_PROPERTY(QString rawText READ rawText WRITE setRawText NOTIFY rawTextChanged)
    Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
public:
    explicit ElidedLabel(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());
    explicit ElidedLabel(const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());

    Qt::TextElideMode elideMode() const;
    QString rawText() const;
    QString url() const;

public slots:
    void setElideMode(Qt::TextElideMode elideMode);
    void setRawText(const QString& rawText);
    void setUrl(const QString& url);
    void clear();

signals:
    void elideModeChanged(Qt::TextElideMode elideMode);
    void rawTextChanged(QString rawText);
    void urlChanged(QString url);

private slots:
    void updateElidedText();

private:
    void resizeEvent(QResizeEvent* event);

    Qt::TextElideMode m_elideMode;
    QString m_rawText;
    QString m_url;
};

#endif // KEEPASSX_ELIDEDLABEL_H