Files
pilotclient/src/blackgui/elidedpushbutton.h
Lars Toenning bcc4bdd31e Add SPDX identifiers for REUSE compliance
Co-authored-by: Mat Sutcliffe <oktal3700@gmail.com>
2023-10-03 09:29:49 +02:00

48 lines
1.1 KiB
C++

// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
//! \file
#ifndef BLACKGUI_ELIDEDPUSHBUTTON_H
#define BLACKGUI_ELIDEDPUSHBUTTON_H
#include <QPushButton>
namespace BlackGui
{
/*!
* Push button with elided text
* \remark based on http://doc.qt.io/qt-5/qtwidgets-widgets-elidedlabel-example.html
*/
class CElidedPushButton : public QPushButton
{
Q_OBJECT
public:
//! Constructor
explicit CElidedPushButton(QWidget *parent = nullptr);
//! Constructor
explicit CElidedPushButton(const QString &text, QWidget *parent = nullptr);
//! Text
void setText(const QString &text);
//! Text
const QString &text() const { return m_content; }
//! Elided?
bool isElided() const { return m_elided; }
protected:
//! \copydoc QPushButton::paintEvent
void paintEvent(QPaintEvent *event) override;
private:
bool m_elided = false;
QString m_content;
};
} // ns
#endif // guard