Skip to content
Snippets Groups Projects
Commit 185e66ca authored by BATON Theau's avatar BATON Theau
Browse files

Amélioration de Pixeleraiser

parent da1b6ce4
No related branches found
No related tags found
No related merge requests found
...@@ -2,18 +2,26 @@ ...@@ -2,18 +2,26 @@
namespace tool { namespace tool {
Pixeleraiser::Pixeleraiser(const ColorPickerWidget & cp) Pixeleraiser::Pixeleraiser(const ColorPickerWidget & cp)
: Editable(cp, "Gomme Pixel", QIcon(":/oxygen/16x16/ressource/image/oxygen/icons/16x16/draw-eraser.png")), _leftButton(false) {} : Editable(cp, "Gomme Pixel", QIcon(":/oxygen/16x16/ressource/image/oxygen/icons/16x16/draw-eraser.png")), _leftButton(false), _rightButton(false) {}
void Pixeleraiser::onMousePressed(ui::ImageArea &, QImage &, const QPoint &, const ui::Selection &, const QMouseEvent & e, const ColorPickerWidget &) { void Pixeleraiser::onMousePressed(ui::ImageArea &, QImage &, const QPoint &, const ui::Selection &, const QMouseEvent & e, const ColorPickerWidget &) {
if(e.button() == Qt::LeftButton) { if(e.button() == Qt::LeftButton) {
this->_leftButton = true; this->_leftButton = true;
} }
if(e.button() == Qt::RightButton) {
this->_rightButton = true;
}
} }
void Pixeleraiser::onMouseReleased(ui::ImageArea &, QImage &, const QPoint &, const ui::Selection &, const QMouseEvent & e, const ColorPickerWidget &) { void Pixeleraiser::onMouseReleased(ui::ImageArea &, QImage &, const QPoint &, const ui::Selection &, const QMouseEvent & e, const ColorPickerWidget &) {
if(e.button() == Qt::LeftButton) { if(e.button() == Qt::LeftButton) {
this->_leftButton = false; this->_leftButton = false;
} }
if(e.button() == Qt::RightButton) {
this->_rightButton = false;
}
} }
void Pixeleraiser::onMouseMoved(ui::ImageArea & a, QImage &, const QPoint & p, const ui::Selection & s, const QMouseEvent &, const ColorPickerWidget &, bool hold) { void Pixeleraiser::onMouseMoved(ui::ImageArea & a, QImage &, const QPoint & p, const ui::Selection & s, const QMouseEvent &, const ColorPickerWidget &, bool hold) {
...@@ -25,5 +33,13 @@ namespace tool { ...@@ -25,5 +33,13 @@ namespace tool {
a.setColor(p, QColor(0, 0, 0, 0)); a.setColor(p, QColor(0, 0, 0, 0));
} }
} }
else if(hold && this->_rightButton) {
if(s.empty()) {
a.setColor(p, QColorConstants::White);
}
else if(s.contain(p)) {
a.setColor(p, QColorConstants::White);
}
}
} }
} }
...@@ -6,6 +6,7 @@ namespace tool { ...@@ -6,6 +6,7 @@ namespace tool {
class Pixeleraiser : public Editable { class Pixeleraiser : public Editable {
private: private:
bool _leftButton; bool _leftButton;
bool _rightButton;
public: public:
Pixeleraiser(const ColorPickerWidget &); Pixeleraiser(const ColorPickerWidget &);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment