1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:23:51 +00:00

Merged merge request !39

This commit is contained in:
Marc Zinnschlag 2018-08-25 09:37:21 +02:00
commit 9816643bef
5 changed files with 5 additions and 31 deletions

View file

@ -23,6 +23,7 @@
Bug #3533: GetSpellEffects should detect effects with zero duration Bug #3533: GetSpellEffects should detect effects with zero duration
Bug #3591: Angled hit distance too low Bug #3591: Angled hit distance too low
Bug #3629: DB assassin attack never triggers creature spawning Bug #3629: DB assassin attack never triggers creature spawning
Bug #3681: OpenMW-CS: Clicking Scripts in Preferences spawns many color pickers
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
Bug #3876: Landscape texture painting is misaligned Bug #3876: Landscape texture painting is misaligned
Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3897: Have Goodbye give all choices the effects of Goodbye

View file

@ -1,11 +1,9 @@
#include "coloreditor.hpp" #include "coloreditor.hpp"
#include <QApplication> #include <QApplication>
#include <QColor>
#include <QColorDialog> #include <QColorDialog>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QPainter> #include <QPainter>
#include <QRect>
#include <QShowEvent> #include <QShowEvent>
#include "colorpickerpopup.hpp" #include "colorpickerpopup.hpp"
@ -27,9 +25,7 @@ CSVWidget::ColorEditor::ColorEditor(QWidget *parent, const bool popupOnStart)
mColorPicker(new ColorPickerPopup(this)), mColorPicker(new ColorPickerPopup(this)),
mPopupOnStart(popupOnStart) mPopupOnStart(popupOnStart)
{ {
setCheckable(true);
connect(this, SIGNAL(clicked()), this, SLOT(showPicker())); connect(this, SIGNAL(clicked()), this, SLOT(showPicker()));
connect(mColorPicker, SIGNAL(hid()), this, SLOT(pickerHid()));
connect(mColorPicker, SIGNAL(colorChanged(const QColor &)), this, SLOT(pickerColorChanged(const QColor &))); connect(mColorPicker, SIGNAL(colorChanged(const QColor &)), this, SLOT(pickerColorChanged(const QColor &)));
} }
@ -85,20 +81,7 @@ void CSVWidget::ColorEditor::setColor(const int colorInt)
void CSVWidget::ColorEditor::showPicker() void CSVWidget::ColorEditor::showPicker()
{ {
if (isChecked()) mColorPicker->showPicker(calculatePopupPosition(), mColor);
{
mColorPicker->showPicker(calculatePopupPosition(), mColor);
}
else
{
mColorPicker->hide();
}
}
void CSVWidget::ColorEditor::pickerHid()
{
setChecked(false);
emit pickingFinished();
} }
void CSVWidget::ColorEditor::pickerColorChanged(const QColor &color) void CSVWidget::ColorEditor::pickerColorChanged(const QColor &color)

View file

@ -45,7 +45,6 @@ namespace CSVWidget
private slots: private slots:
void showPicker(); void showPicker();
void pickerHid();
void pickerColorChanged(const QColor &color); void pickerColorChanged(const QColor &color);
signals: signals:

View file

@ -4,7 +4,6 @@
#include <QPushButton> #include <QPushButton>
#include <QEvent> #include <QEvent>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMouseEvent>
#include <QLayout> #include <QLayout>
#include <QStyleOption> #include <QStyleOption>
@ -19,7 +18,6 @@ CSVWidget::ColorPickerPopup::ColorPickerPopup(QWidget *parent)
mColorPicker->setWindowFlags(Qt::Widget); mColorPicker->setWindowFlags(Qt::Widget);
mColorPicker->setOptions(QColorDialog::NoButtons | QColorDialog::DontUseNativeDialog); mColorPicker->setOptions(QColorDialog::NoButtons | QColorDialog::DontUseNativeDialog);
mColorPicker->installEventFilter(this); mColorPicker->installEventFilter(this);
mColorPicker->open();
connect(mColorPicker, connect(mColorPicker,
SIGNAL(currentColorChanged(const QColor &)), SIGNAL(currentColorChanged(const QColor &)),
this, this,
@ -39,8 +37,9 @@ void CSVWidget::ColorPickerPopup::showPicker(const QPoint &position, const QColo
geometry.moveTo(position); geometry.moveTo(position);
setGeometry(geometry); setGeometry(geometry);
mColorPicker->setCurrentColor(initialColor); // Calling getColor() creates a blocking dialog that will continue execution once the user chooses OK or Cancel
show(); QColor color = mColorPicker->getColor(initialColor);
mColorPicker->setCurrentColor(color);
} }
void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event) void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event)
@ -63,12 +62,6 @@ void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event)
QFrame::mousePressEvent(event); QFrame::mousePressEvent(event);
} }
void CSVWidget::ColorPickerPopup::hideEvent(QHideEvent *event)
{
QFrame::hideEvent(event);
emit hid();
}
bool CSVWidget::ColorPickerPopup::eventFilter(QObject *object, QEvent *event) bool CSVWidget::ColorPickerPopup::eventFilter(QObject *object, QEvent *event)
{ {
if (object == mColorPicker && event->type() == QEvent::KeyPress) if (object == mColorPicker && event->type() == QEvent::KeyPress)

View file

@ -20,11 +20,9 @@ namespace CSVWidget
protected: protected:
virtual void mousePressEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event);
virtual void hideEvent(QHideEvent *event);
virtual bool eventFilter(QObject *object, QEvent *event); virtual bool eventFilter(QObject *object, QEvent *event);
signals: signals:
void hid();
void colorChanged(const QColor &color); void colorChanged(const QColor &color);
}; };
} }