mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-25 19:30:02 +00:00
Fix alignment bug and applied many clang format warnings (#2448)
* Fix alignment bug and applied many clang format warnings * removed nodiscard from slot
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
TextConfig::TextConfig(QWidget* parent)
|
TextConfig::TextConfig(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_layout(nullptr)
|
, m_layout(new QVBoxLayout(this))
|
||||||
, m_fontsCB(nullptr)
|
, m_fontsCB(new QComboBox())
|
||||||
, m_strikeOutButton(nullptr)
|
, m_strikeOutButton(nullptr)
|
||||||
, m_underlineButton(nullptr)
|
, m_underlineButton(nullptr)
|
||||||
, m_weightButton(nullptr)
|
, m_weightButton(nullptr)
|
||||||
@@ -22,10 +22,9 @@ TextConfig::TextConfig(QWidget* parent)
|
|||||||
, m_centerAlignButton(nullptr)
|
, m_centerAlignButton(nullptr)
|
||||||
, m_rightAlignButton(nullptr)
|
, m_rightAlignButton(nullptr)
|
||||||
{
|
{
|
||||||
m_layout = new QVBoxLayout(this);
|
|
||||||
|
|
||||||
QFontDatabase fontDB;
|
QFontDatabase fontDB;
|
||||||
m_fontsCB = new QComboBox();
|
|
||||||
connect(m_fontsCB,
|
connect(m_fontsCB,
|
||||||
&QComboBox::currentTextChanged,
|
&QComboBox::currentTextChanged,
|
||||||
this,
|
this,
|
||||||
@@ -121,29 +120,30 @@ void TextConfig::setFontFamily(const QString& fontFamily)
|
|||||||
m_fontsCB->findText(fontFamily.isEmpty() ? font().family() : fontFamily));
|
m_fontsCB->findText(fontFamily.isEmpty() ? font().family() : fontFamily));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextConfig::setUnderline(const bool u)
|
void TextConfig::setUnderline(const bool underline)
|
||||||
{
|
{
|
||||||
m_underlineButton->setChecked(u);
|
m_underlineButton->setChecked(underline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextConfig::setStrikeOut(const bool s)
|
void TextConfig::setStrikeOut(const bool strikeout)
|
||||||
{
|
{
|
||||||
m_strikeOutButton->setChecked(s);
|
m_strikeOutButton->setChecked(strikeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextConfig::setWeight(const int w)
|
void TextConfig::setWeight(const int weight)
|
||||||
{
|
{
|
||||||
m_weightButton->setChecked(static_cast<QFont::Weight>(w) == QFont::Bold);
|
m_weightButton->setChecked(static_cast<QFont::Weight>(weight) ==
|
||||||
|
QFont::Bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextConfig::setItalic(const bool i)
|
void TextConfig::setItalic(const bool italic)
|
||||||
{
|
{
|
||||||
m_italicButton->setChecked(i);
|
m_italicButton->setChecked(italic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextConfig::weightButtonPressed(const bool w)
|
void TextConfig::weightButtonPressed(const bool weight)
|
||||||
{
|
{
|
||||||
if (w) {
|
if (weight) {
|
||||||
emit fontWeightChanged(QFont::Bold);
|
emit fontWeightChanged(QFont::Bold);
|
||||||
} else {
|
} else {
|
||||||
emit fontWeightChanged(QFont::Normal);
|
emit fontWeightChanged(QFont::Normal);
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ public:
|
|||||||
explicit TextConfig(QWidget* parent = nullptr);
|
explicit TextConfig(QWidget* parent = nullptr);
|
||||||
|
|
||||||
void setFontFamily(const QString& fontFamily);
|
void setFontFamily(const QString& fontFamily);
|
||||||
void setUnderline(const bool u);
|
void setUnderline(bool underline);
|
||||||
void setStrikeOut(const bool s);
|
void setStrikeOut(bool strikeout);
|
||||||
void setWeight(const int w);
|
void setWeight(int weight);
|
||||||
void setItalic(const bool i);
|
void setItalic(bool italic);
|
||||||
void setTextAlignment(Qt::AlignmentFlag alignment);
|
void setTextAlignment(Qt::AlignmentFlag alignment);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -32,7 +32,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void weightButtonPressed(const bool w);
|
void weightButtonPressed(bool weight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ TextTool::TextTool(QObject* parent)
|
|||||||
if (!fontFamily.isEmpty()) {
|
if (!fontFamily.isEmpty()) {
|
||||||
m_font.setFamily(ConfigHandler().fontFamily());
|
m_font.setFamily(ConfigHandler().fontFamily());
|
||||||
}
|
}
|
||||||
m_alignment = Qt::AlignRight;
|
m_alignment = Qt::AlignLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextTool::~TextTool()
|
TextTool::~TextTool()
|
||||||
@@ -161,34 +161,36 @@ QWidget* TextTool::configurationWidget()
|
|||||||
|
|
||||||
CaptureTool* TextTool::copy(QObject* parent)
|
CaptureTool* TextTool::copy(QObject* parent)
|
||||||
{
|
{
|
||||||
auto* tt = new TextTool(parent);
|
auto* textTool = new TextTool(parent);
|
||||||
if (m_confW) {
|
if (m_confW != nullptr) {
|
||||||
connect(
|
connect(m_confW,
|
||||||
m_confW, &TextConfig::fontFamilyChanged, tt, &TextTool::updateFamily);
|
&TextConfig::fontFamilyChanged,
|
||||||
|
textTool,
|
||||||
|
&TextTool::updateFamily);
|
||||||
connect(m_confW,
|
connect(m_confW,
|
||||||
&TextConfig::fontItalicChanged,
|
&TextConfig::fontItalicChanged,
|
||||||
tt,
|
textTool,
|
||||||
&TextTool::updateFontItalic);
|
&TextTool::updateFontItalic);
|
||||||
connect(m_confW,
|
connect(m_confW,
|
||||||
&TextConfig::fontStrikeOutChanged,
|
&TextConfig::fontStrikeOutChanged,
|
||||||
tt,
|
textTool,
|
||||||
&TextTool::updateFontStrikeOut);
|
&TextTool::updateFontStrikeOut);
|
||||||
connect(m_confW,
|
connect(m_confW,
|
||||||
&TextConfig::fontUnderlineChanged,
|
&TextConfig::fontUnderlineChanged,
|
||||||
tt,
|
textTool,
|
||||||
&TextTool::updateFontUnderline);
|
&TextTool::updateFontUnderline);
|
||||||
connect(m_confW,
|
connect(m_confW,
|
||||||
&TextConfig::fontWeightChanged,
|
&TextConfig::fontWeightChanged,
|
||||||
tt,
|
textTool,
|
||||||
&TextTool::updateFontWeight);
|
&TextTool::updateFontWeight);
|
||||||
|
|
||||||
connect(m_confW,
|
connect(m_confW,
|
||||||
&TextConfig::alignmentChanged,
|
&TextConfig::alignmentChanged,
|
||||||
tt,
|
textTool,
|
||||||
&TextTool::updateAlignment);
|
&TextTool::updateAlignment);
|
||||||
}
|
}
|
||||||
copyParams(this, tt);
|
copyParams(this, textTool);
|
||||||
return tt;
|
return textTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::process(QPainter& painter, const QPixmap& pixmap)
|
void TextTool::process(QPainter& painter, const QPixmap& pixmap)
|
||||||
@@ -215,7 +217,7 @@ void TextTool::process(QPainter& painter, const QPixmap& pixmap)
|
|||||||
painter.setFont(orig_font);
|
painter.setFont(orig_font);
|
||||||
painter.setPen(orig_pen);
|
painter.setPen(orig_pen);
|
||||||
|
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setAlignment(m_alignment);
|
m_widget->setAlignment(m_alignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,14 +237,14 @@ void TextTool::paintMousePreview(QPainter& painter,
|
|||||||
Q_UNUSED(context)
|
Q_UNUSED(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::drawEnd(const QPoint& p)
|
void TextTool::drawEnd(const QPoint& point)
|
||||||
{
|
{
|
||||||
m_textArea.moveTo(p);
|
m_textArea.moveTo(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::drawMove(const QPoint& p)
|
void TextTool::drawMove(const QPoint& point)
|
||||||
{
|
{
|
||||||
m_widget->move(p);
|
m_widget->move(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::drawStart(const CaptureContext& context)
|
void TextTool::drawStart(const CaptureContext& context)
|
||||||
@@ -257,11 +259,11 @@ void TextTool::pressed(CaptureContext& context)
|
|||||||
Q_UNUSED(context)
|
Q_UNUSED(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::onColorChanged(const QColor& c)
|
void TextTool::onColorChanged(const QColor& color)
|
||||||
{
|
{
|
||||||
m_color = c;
|
m_color = color;
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setTextColor(c);
|
m_widget->setTextColor(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,23 +271,23 @@ void TextTool::onSizeChanged(int size)
|
|||||||
{
|
{
|
||||||
m_size = size;
|
m_size = size;
|
||||||
m_font.setPointSize(m_size + BASE_POINT_SIZE);
|
m_font.setPointSize(m_size + BASE_POINT_SIZE);
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::updateText(const QString& s)
|
void TextTool::updateText(const QString& newText)
|
||||||
{
|
{
|
||||||
m_text = s;
|
m_text = newText;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::updateFamily(const QString& s)
|
void TextTool::updateFamily(const QString& text)
|
||||||
{
|
{
|
||||||
m_font.setFamily(s);
|
m_font.setFamily(text);
|
||||||
if (m_textOld.isEmpty()) {
|
if (m_textOld.isEmpty()) {
|
||||||
ConfigHandler().setFontFamily(m_font.family());
|
ConfigHandler().setFontFamily(m_font.family());
|
||||||
}
|
}
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,23 +295,23 @@ void TextTool::updateFamily(const QString& s)
|
|||||||
void TextTool::updateFontUnderline(const bool underlined)
|
void TextTool::updateFontUnderline(const bool underlined)
|
||||||
{
|
{
|
||||||
m_font.setUnderline(underlined);
|
m_font.setUnderline(underlined);
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::updateFontStrikeOut(const bool s)
|
void TextTool::updateFontStrikeOut(const bool strikeout)
|
||||||
{
|
{
|
||||||
m_font.setStrikeOut(s);
|
m_font.setStrikeOut(strikeout);
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::updateFontWeight(const QFont::Weight w)
|
void TextTool::updateFontWeight(const QFont::Weight weight)
|
||||||
{
|
{
|
||||||
m_font.setWeight(w);
|
m_font.setWeight(weight);
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,7 +319,7 @@ void TextTool::updateFontWeight(const QFont::Weight w)
|
|||||||
void TextTool::updateFontItalic(const bool italic)
|
void TextTool::updateFontItalic(const bool italic)
|
||||||
{
|
{
|
||||||
m_font.setItalic(italic);
|
m_font.setItalic(italic);
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setFont(m_font);
|
m_widget->setFont(m_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +332,7 @@ void TextTool::move(const QPoint& pos)
|
|||||||
void TextTool::updateAlignment(Qt::AlignmentFlag alignment)
|
void TextTool::updateAlignment(Qt::AlignmentFlag alignment)
|
||||||
{
|
{
|
||||||
m_alignment = alignment;
|
m_alignment = alignment;
|
||||||
if (m_widget) {
|
if (m_widget != nullptr) {
|
||||||
m_widget->setAlignment(m_alignment);
|
m_widget->setAlignment(m_alignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,12 +343,12 @@ const QPoint* TextTool::pos()
|
|||||||
return &m_currentPos;
|
return &m_currentPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextTool::setEditMode(bool b)
|
void TextTool::setEditMode(bool editMode)
|
||||||
{
|
{
|
||||||
if (b) {
|
if (editMode) {
|
||||||
m_textOld = m_text;
|
m_textOld = m_text;
|
||||||
}
|
}
|
||||||
CaptureTool::setEditMode(b);
|
CaptureTool::setEditMode(editMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextTool::isChanged()
|
bool TextTool::isChanged()
|
||||||
|
|||||||
@@ -15,17 +15,18 @@ class TextTool : public CaptureTool
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TextTool(QObject* parent = nullptr);
|
explicit TextTool(QObject* parent = nullptr);
|
||||||
~TextTool();
|
~TextTool() override;
|
||||||
|
|
||||||
bool isValid() const override;
|
[[nodiscard]] bool isValid() const override;
|
||||||
bool closeOnButtonPressed() const override;
|
[[nodiscard]] bool closeOnButtonPressed() const override;
|
||||||
bool isSelectable() const override;
|
[[nodiscard]] bool isSelectable() const override;
|
||||||
bool showMousePreview() const override;
|
[[nodiscard]] bool showMousePreview() const override;
|
||||||
QRect boundingRect() const override;
|
[[nodiscard]] QRect boundingRect() const override;
|
||||||
|
|
||||||
QIcon icon(const QColor& background, bool inEditor) const override;
|
[[nodiscard]] QIcon icon(const QColor& background,
|
||||||
QString name() const override;
|
bool inEditor) const override;
|
||||||
QString description() const override;
|
[[nodiscard]] QString name() const override;
|
||||||
|
[[nodiscard]] QString description() const override;
|
||||||
QString info() override;
|
QString info() override;
|
||||||
|
|
||||||
QWidget* widget() override;
|
QWidget* widget() override;
|
||||||
@@ -39,29 +40,29 @@ public:
|
|||||||
const QPoint* pos() override;
|
const QPoint* pos() override;
|
||||||
void drawObjectSelection(QPainter& painter) override;
|
void drawObjectSelection(QPainter& painter) override;
|
||||||
|
|
||||||
void setEditMode(bool b) override;
|
void setEditMode(bool editMode) override;
|
||||||
bool isChanged() override;
|
bool isChanged() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void copyParams(const TextTool* from, TextTool* to);
|
void copyParams(const TextTool* from, TextTool* to);
|
||||||
CaptureTool::Type type() const override;
|
[[nodiscard]] CaptureTool::Type type() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void drawEnd(const QPoint& p) override;
|
void drawEnd(const QPoint& point) override;
|
||||||
void drawMove(const QPoint& p) override;
|
void drawMove(const QPoint& point) override;
|
||||||
void drawStart(const CaptureContext& context) override;
|
void drawStart(const CaptureContext& context) override;
|
||||||
void pressed(CaptureContext& context) override;
|
void pressed(CaptureContext& context) override;
|
||||||
void onColorChanged(const QColor& c) override;
|
void onColorChanged(const QColor& color) override;
|
||||||
void onSizeChanged(int size) override;
|
void onSizeChanged(int size) override;
|
||||||
virtual int size() const override { return m_size; };
|
int size() const override { return m_size; };
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateText(const QString& s);
|
void updateText(const QString& string);
|
||||||
void updateFamily(const QString& s);
|
void updateFamily(const QString& string);
|
||||||
void updateFontUnderline(const bool underlined);
|
void updateFontUnderline(bool underlined);
|
||||||
void updateFontStrikeOut(const bool s);
|
void updateFontStrikeOut(bool strikeout);
|
||||||
void updateFontWeight(const QFont::Weight w);
|
void updateFontWeight(QFont::Weight weight);
|
||||||
void updateFontItalic(const bool italic);
|
void updateFontItalic(bool italic);
|
||||||
void updateAlignment(Qt::AlignmentFlag alignment);
|
void updateAlignment(Qt::AlignmentFlag alignment);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
#include "src/utils/pathinfo.h"
|
#include "src/utils/pathinfo.h"
|
||||||
#include "utilitypanel.h"
|
#include "utilitypanel.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug> // TODO remove
|
|
||||||
#include <QFormLayout>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -23,9 +21,10 @@
|
|||||||
|
|
||||||
SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
|
SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
, m_layout(new QVBoxLayout(this))
|
||||||
, m_pixmap(p)
|
, m_pixmap(p)
|
||||||
{
|
{
|
||||||
m_layout = new QVBoxLayout(this);
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->installEventFilter(this);
|
parent->installEventFilter(this);
|
||||||
}
|
}
|
||||||
@@ -109,7 +108,7 @@ void SidePanelWidget::onColorChanged(const QColor& c)
|
|||||||
m_colorWheel->setColor(c);
|
m_colorWheel->setColor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SidePanelWidget::onToolSizeChanged(const int& t)
|
void SidePanelWidget::onToolSizeChanged(int t)
|
||||||
{
|
{
|
||||||
m_toolSize = qBound(0, t, maxToolSize);
|
m_toolSize = qBound(0, t, maxToolSize);
|
||||||
m_toolSizeSlider->setValue(m_toolSize);
|
m_toolSizeSlider->setValue(m_toolSize);
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ public:
|
|||||||
explicit SidePanelWidget(QPixmap* p, QWidget* parent = nullptr);
|
explicit SidePanelWidget(QPixmap* p, QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void colorChanged(const QColor& c);
|
void colorChanged(const QColor& color);
|
||||||
void toolSizeChanged(int t);
|
void toolSizeChanged(int tootl);
|
||||||
void togglePanel();
|
void togglePanel();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onToolSizeChanged(const int& t);
|
void onToolSizeChanged(int tool);
|
||||||
void onColorChanged(const QColor& c);
|
void onColorChanged(const QColor& color);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startColorGrab();
|
void startColorGrab();
|
||||||
@@ -43,14 +43,14 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void finalizeGrab();
|
void finalizeGrab();
|
||||||
void updateColorNoWheel(const QColor& c);
|
void updateColorNoWheel(const QColor& color);
|
||||||
|
|
||||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
void hideEvent(QHideEvent* event) override;
|
void hideEvent(QHideEvent* event) override;
|
||||||
|
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
QPushButton* m_colorGrabButton;
|
QPushButton* m_colorGrabButton;
|
||||||
ColorGrabWidget* m_colorGrabber;
|
ColorGrabWidget* m_colorGrabber{};
|
||||||
color_widgets::ColorWheel* m_colorWheel;
|
color_widgets::ColorWheel* m_colorWheel;
|
||||||
QLabel* m_colorLabel;
|
QLabel* m_colorLabel;
|
||||||
QLineEdit* m_colorHex;
|
QLineEdit* m_colorHex;
|
||||||
@@ -58,5 +58,5 @@ private:
|
|||||||
QColor m_color;
|
QColor m_color;
|
||||||
QColor m_revertColor;
|
QColor m_revertColor;
|
||||||
QSlider* m_toolSizeSlider;
|
QSlider* m_toolSizeSlider;
|
||||||
int m_toolSize;
|
int m_toolSize{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,31 +53,31 @@ QWidget* UtilityPanel::toolWidget() const
|
|||||||
return m_toolWidget;
|
return m_toolWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilityPanel::setToolWidget(QWidget* w)
|
void UtilityPanel::setToolWidget(QWidget* widget)
|
||||||
{
|
{
|
||||||
if (m_toolWidget) {
|
if (m_toolWidget != nullptr) {
|
||||||
m_toolWidget->hide();
|
m_toolWidget->hide();
|
||||||
m_toolWidget->setParent(this);
|
m_toolWidget->setParent(this);
|
||||||
m_toolWidget->deleteLater();
|
m_toolWidget->deleteLater();
|
||||||
}
|
}
|
||||||
if (w) {
|
if (widget != nullptr) {
|
||||||
m_toolWidget = w;
|
m_toolWidget = widget;
|
||||||
m_toolWidget->setSizePolicy(QSizePolicy::Ignored,
|
m_toolWidget->setSizePolicy(QSizePolicy::Ignored,
|
||||||
QSizePolicy::Preferred);
|
QSizePolicy::Preferred);
|
||||||
m_upLayout->addWidget(w);
|
m_upLayout->addWidget(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilityPanel::clearToolWidget()
|
void UtilityPanel::clearToolWidget()
|
||||||
{
|
{
|
||||||
if (m_toolWidget) {
|
if (m_toolWidget != nullptr) {
|
||||||
m_toolWidget->deleteLater();
|
m_toolWidget->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilityPanel::pushWidget(QWidget* w)
|
void UtilityPanel::pushWidget(QWidget* widget)
|
||||||
{
|
{
|
||||||
m_layout->insertWidget(m_layout->count() - 1, w);
|
m_layout->insertWidget(m_layout->count() - 1, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilityPanel::show()
|
void UtilityPanel::show()
|
||||||
@@ -193,7 +193,7 @@ void UtilityPanel::initInternalPanel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UtilityPanel::fillCaptureTools(
|
void UtilityPanel::fillCaptureTools(
|
||||||
QList<QPointer<CaptureTool>> captureToolObjects)
|
const QList<QPointer<CaptureTool>>& captureToolObjects)
|
||||||
{
|
{
|
||||||
int currentSelection = m_captureTools->currentRow();
|
int currentSelection = m_captureTools->currentRow();
|
||||||
m_captureTools->clear();
|
m_captureTools->clear();
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class QPropertyAnimation;
|
|||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class CaptureTool;
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class CaptureWidget;
|
class CaptureWidget;
|
||||||
|
|
||||||
@@ -22,14 +21,14 @@ class UtilityPanel : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit UtilityPanel(CaptureWidget* captureWidget);
|
explicit UtilityPanel(CaptureWidget* captureWidget);
|
||||||
|
|
||||||
QWidget* toolWidget() const;
|
[[nodiscard]] QWidget* toolWidget() const;
|
||||||
void setToolWidget(QWidget* w);
|
void setToolWidget(QWidget* weight);
|
||||||
void clearToolWidget();
|
void clearToolWidget();
|
||||||
void pushWidget(QWidget* w);
|
void pushWidget(QWidget* widget);
|
||||||
void hide();
|
void hide();
|
||||||
void show();
|
void show();
|
||||||
void fillCaptureTools(
|
void fillCaptureTools(
|
||||||
QList<QPointer<CaptureTool>> captureToolObjectsHistory);
|
const QList<QPointer<CaptureTool>>& captureToolObjectsHistory);
|
||||||
void setActiveLayer(int index);
|
void setActiveLayer(int index);
|
||||||
int activeLayerIndex();
|
int activeLayerIndex();
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user