src: applied clang-format
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
|
||||
QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent)
|
||||
: QtIconButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help.png"),
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help_hover.png"),
|
||||
parent)
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help.png"),
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help_hover.png"),
|
||||
parent)
|
||||
, m_helpTitle(helpTitle)
|
||||
, m_helpText(helpText)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setMouseTracking(true);
|
||||
|
||||
setToolTip("help");
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include "QtIconButton.h"
|
||||
|
||||
class QtHelpButton
|
||||
: public QtIconButton
|
||||
class QtHelpButton: public QtIconButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -19,4 +18,4 @@ private:
|
||||
QString m_helpText;
|
||||
};
|
||||
|
||||
#endif // QT_HELP_BUTTON_H
|
||||
#endif // QT_HELP_BUTTON_H
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include "QtHoverButton.h"
|
||||
|
||||
QtHoverButton::QtHoverButton(QWidget* parent)
|
||||
: QPushButton("", parent)
|
||||
QtHoverButton::QtHoverButton(QWidget* parent): QPushButton("", parent)
|
||||
{
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void QtHoverButton::enterEvent(QEvent *event)
|
||||
void QtHoverButton::enterEvent(QEvent* event)
|
||||
{
|
||||
if (isEnabled())
|
||||
{
|
||||
@@ -15,7 +14,7 @@ void QtHoverButton::enterEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtHoverButton::leaveEvent(QEvent *event)
|
||||
void QtHoverButton::leaveEvent(QEvent* event)
|
||||
{
|
||||
if (isEnabled())
|
||||
{
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
class QtHoverButton
|
||||
: public QPushButton
|
||||
class QtHoverButton: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -16,8 +15,8 @@ signals:
|
||||
void hoveredOut(QPushButton*);
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void enterEvent(QEvent* event);
|
||||
void leaveEvent(QEvent* event);
|
||||
};
|
||||
|
||||
#endif // QT_HOVER_BUTTON_H
|
||||
#endif // QT_HOVER_BUTTON_H
|
||||
|
||||
@@ -11,7 +11,7 @@ QtIconButton::QtIconButton(const FilePath& iconPath, const FilePath& hoveredIcon
|
||||
, m_color(Qt::transparent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
|
||||
if (!m_hoveredIconPath.empty())
|
||||
{
|
||||
@@ -27,7 +27,7 @@ void QtIconButton::setColor(QColor color)
|
||||
leaveEvent(nullptr);
|
||||
}
|
||||
|
||||
void QtIconButton::enterEvent(QEvent *event)
|
||||
void QtIconButton::enterEvent(QEvent* event)
|
||||
{
|
||||
if (!m_hoveredIconPath.empty() && isEnabled())
|
||||
{
|
||||
@@ -35,7 +35,7 @@ void QtIconButton::enterEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtIconButton::leaveEvent(QEvent *event)
|
||||
void QtIconButton::leaveEvent(QEvent* event)
|
||||
{
|
||||
if (!m_iconPath.empty())
|
||||
{
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
class QtIconButton
|
||||
: public QPushButton
|
||||
class QtIconButton: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -16,8 +15,8 @@ public:
|
||||
void setColor(QColor color);
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void enterEvent(QEvent* event);
|
||||
void leaveEvent(QEvent* event);
|
||||
|
||||
private:
|
||||
void setIconFromPath(const FilePath& path);
|
||||
@@ -28,4 +27,4 @@ private:
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
#endif // QT_ICON_BUTTON_H
|
||||
#endif // QT_ICON_BUTTON_H
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
|
||||
#include "utilityQt.h"
|
||||
|
||||
QtIconStateButton::QtIconStateButton(QWidget* parent)
|
||||
: QPushButton("", parent)
|
||||
QtIconStateButton::QtIconStateButton(QWidget* parent): QPushButton("", parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setMouseTracking(true);
|
||||
|
||||
setObjectName("iconStateButton");
|
||||
@@ -39,7 +38,7 @@ void QtIconStateButton::hoverOut()
|
||||
leaveEvent(nullptr);
|
||||
}
|
||||
|
||||
void QtIconStateButton::changeEvent(QEvent *event)
|
||||
void QtIconStateButton::changeEvent(QEvent* event)
|
||||
{
|
||||
if (event->type() != QEvent::EnabledChange)
|
||||
{
|
||||
@@ -53,7 +52,7 @@ void QtIconStateButton::changeEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtIconStateButton::enterEvent(QEvent *event)
|
||||
void QtIconStateButton::enterEvent(QEvent* event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
{
|
||||
@@ -72,7 +71,7 @@ void QtIconStateButton::enterEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtIconStateButton::leaveEvent(QEvent *event)
|
||||
void QtIconStateButton::leaveEvent(QEvent* event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
{
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
class QtIconStateButton
|
||||
: public QPushButton
|
||||
class QtIconStateButton: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -36,9 +35,9 @@ signals:
|
||||
void hoveredOut(QPushButton*);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void changeEvent(QEvent* event);
|
||||
void enterEvent(QEvent* event);
|
||||
void leaveEvent(QEvent* event);
|
||||
|
||||
private:
|
||||
void setState(State state);
|
||||
@@ -46,4 +45,4 @@ private:
|
||||
std::map<ButtonState, State> m_states;
|
||||
};
|
||||
|
||||
#endif // QT_ICON_STATE_BUTTON_H
|
||||
#endif // QT_ICON_STATE_BUTTON_H
|
||||
|
||||
@@ -5,20 +5,16 @@
|
||||
#include "utilityQt.h"
|
||||
|
||||
QtSelfRefreshIconButton::QtSelfRefreshIconButton(
|
||||
const QString& text, const FilePath& iconPath, const std::string& buttonKey, QWidget* parent
|
||||
)
|
||||
: QPushButton(text, parent)
|
||||
, m_text(text)
|
||||
, m_iconPath(iconPath)
|
||||
, m_buttonKey(buttonKey)
|
||||
const QString& text, const FilePath& iconPath, const std::string& buttonKey, QWidget* parent)
|
||||
: QPushButton(text, parent), m_text(text), m_iconPath(iconPath), m_buttonKey(buttonKey)
|
||||
{
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
refresh();
|
||||
|
||||
m_updateTimer.setSingleShot(true);
|
||||
m_blockTimer.setSingleShot(true);
|
||||
connect(&m_updateTimer, &QTimer::timeout, [this](){ updateText(width()); });
|
||||
connect(&m_blockTimer, &QTimer::timeout, [this](){ m_blockUpdate = false; });
|
||||
connect(&m_updateTimer, &QTimer::timeout, [this]() { updateText(width()); });
|
||||
connect(&m_blockTimer, &QTimer::timeout, [this]() { m_blockUpdate = false; });
|
||||
}
|
||||
|
||||
void QtSelfRefreshIconButton::setText(const QString& text)
|
||||
@@ -48,10 +44,7 @@ void QtSelfRefreshIconButton::setAutoElide(bool autoElide)
|
||||
|
||||
void QtSelfRefreshIconButton::handleMessage(MessageRefreshUI* message)
|
||||
{
|
||||
m_onQtThread([this]()
|
||||
{
|
||||
refresh();
|
||||
});
|
||||
m_onQtThread([this]() { refresh(); });
|
||||
}
|
||||
|
||||
void QtSelfRefreshIconButton::refresh()
|
||||
@@ -62,7 +55,7 @@ void QtSelfRefreshIconButton::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
void QtSelfRefreshIconButton::resizeEvent(QResizeEvent *event)
|
||||
void QtSelfRefreshIconButton::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
if (m_autoElide)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,10 @@ class QtSelfRefreshIconButton
|
||||
{
|
||||
public:
|
||||
QtSelfRefreshIconButton(
|
||||
const QString& text, const FilePath& iconPath, const std::string& buttonKey, QWidget* parent = nullptr);
|
||||
const QString& text,
|
||||
const FilePath& iconPath,
|
||||
const std::string& buttonKey,
|
||||
QWidget* parent = nullptr);
|
||||
~QtSelfRefreshIconButton() = default;
|
||||
|
||||
void setText(const QString& text);
|
||||
@@ -28,7 +31,7 @@ protected:
|
||||
|
||||
virtual void refresh();
|
||||
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
private:
|
||||
void updateText(int width);
|
||||
@@ -45,4 +48,4 @@ private:
|
||||
QTimer m_blockTimer;
|
||||
};
|
||||
|
||||
#endif // QT_SELF_REFRESH_ICON_BUTTON_H
|
||||
#endif // QT_SELF_REFRESH_ICON_BUTTON_H
|
||||
|
||||
Reference in New Issue
Block a user