feat(SvgButton): Allow custom color (#6268)
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
#include "widgets/buttons/Button.hpp"
|
||||
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
|
||||
#include <optional>
|
||||
|
||||
class QSvgRenderer;
|
||||
|
||||
namespace chatterino {
|
||||
@@ -41,6 +44,13 @@ public:
|
||||
/// Setter for #source()
|
||||
void setSource(Src source);
|
||||
|
||||
/// Sets a custom color to render over the SVG.
|
||||
/// This allows you to change the color of a button to a solid color
|
||||
/// of your choice without using multiple SVG resources.
|
||||
///
|
||||
/// Set to std::nullopt to not override the color.
|
||||
void setColor(std::optional<QColor> color);
|
||||
|
||||
/// @brief Returns the padding inside the button.
|
||||
///
|
||||
/// `width` is the padding applied horizontally (left and right).
|
||||
@@ -65,6 +75,7 @@ private:
|
||||
Src source_;
|
||||
QSvgRenderer *svg_;
|
||||
QSize padding_;
|
||||
std::optional<QColor> color_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user