mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
refactor: Remove unused file
This commit is contained in:
@@ -568,8 +568,6 @@ add_library(gui SHARED
|
|||||||
editors/validationindicator.cpp
|
editors/validationindicator.cpp
|
||||||
editors/validationindicator.h
|
editors/validationindicator.h
|
||||||
editors/validationindicator.ui
|
editors/validationindicator.ui
|
||||||
elidedpushbutton.cpp
|
|
||||||
elidedpushbutton.h
|
|
||||||
enablefordockwidgetinfoarea.cpp
|
enablefordockwidgetinfoarea.cpp
|
||||||
enablefordockwidgetinfoarea.h
|
enablefordockwidgetinfoarea.h
|
||||||
enableforframelesswindow.cpp
|
enableforframelesswindow.cpp
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
#include "elidedpushbutton.h"
|
|
||||||
|
|
||||||
#include <QFontMetrics>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QTextLine>
|
|
||||||
|
|
||||||
namespace swift::gui
|
|
||||||
{
|
|
||||||
CElidedPushButton::CElidedPushButton(QWidget *parent) : QPushButton(parent) {}
|
|
||||||
|
|
||||||
CElidedPushButton::CElidedPushButton(const QString &text, QWidget *parent)
|
|
||||||
: QPushButton(parent), m_elided(false), m_content(text)
|
|
||||||
{
|
|
||||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CElidedPushButton::setText(const QString &newText)
|
|
||||||
{
|
|
||||||
m_content = newText;
|
|
||||||
this->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CElidedPushButton::paintEvent(QPaintEvent *event)
|
|
||||||
{
|
|
||||||
QPainter painter(this);
|
|
||||||
const QFontMetrics fontMetrics = painter.fontMetrics();
|
|
||||||
const int usableWidth = qRound(0.9 * this->width());
|
|
||||||
|
|
||||||
const QString elidedText = fontMetrics.elidedText(m_content, Qt::ElideRight, usableWidth);
|
|
||||||
m_elided = (elidedText != m_content);
|
|
||||||
QPushButton::setText(elidedText);
|
|
||||||
QPushButton::paintEvent(event);
|
|
||||||
}
|
|
||||||
} // namespace swift::gui
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
// 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 SWIFT_GUI_ELIDEDPUSHBUTTON_H
|
|
||||||
#define SWIFT_GUI_ELIDEDPUSHBUTTON_H
|
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
namespace swift::gui
|
|
||||||
{
|
|
||||||
/*!
|
|
||||||
* 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;
|
|
||||||
};
|
|
||||||
} // namespace swift::gui
|
|
||||||
|
|
||||||
#endif // SWIFT_GUI_ELIDEDPUSHBUTTON_H
|
|
||||||
Reference in New Issue
Block a user