aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2016-04-30 12:50:43 +0200
committerJean-Baptiste Mardelle <[email protected]>2016-04-30 12:50:43 +0200
commit0c7bc987df013df7a623b5bf4b6a6ebdffed6ba4 (patch)
treec9abb276a1f801867313b146dd5947c6556af64a
parent470dfee4a97655b14ede5a6aea12cf7e57f49436 (diff)
Fix crash on geometry drop, restore some effect parameters label
-rw-r--r--src/effectstack/effectstackview2.cpp2
-rw-r--r--src/effectstack/parametercontainer.cpp9
-rw-r--r--src/effectstack/parametercontainer.h1
-rw-r--r--src/effectstack/positionedit.cpp4
4 files changed, 12 insertions, 4 deletions
diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp
index cf01f76..78b0549 100644
--- a/src/effectstack/effectstackview2.cpp
+++ b/src/effectstack/effectstackview2.cpp
@@ -1239,7 +1239,7 @@ const QString EffectStackView2::getStyleSheet()
// group editable labels
stylesheet.append(QStringLiteral("MyEditableLabel { background-color: transparent; color: palette(bright-text); border-radius: 2px;border: 1px solid transparent;} MyEditableLabel:hover {border: 1px solid palette(highlight);} "));
-
+
// transparent qcombobox
stylesheet.append(QStringLiteral("QComboBox { background-color: transparent;} "));
diff --git a/src/effectstack/parametercontainer.cpp b/src/effectstack/parametercontainer.cpp
index 4e4f8cc..28b3946 100644
--- a/src/effectstack/parametercontainer.cpp
+++ b/src/effectstack/parametercontainer.cpp
@@ -62,6 +62,7 @@
DraggableLabel::DraggableLabel(const QString &text, QWidget *parent):
QLabel(text, parent)
+ , m_dragStarted(false)
{
setContextMenuPolicy(Qt::NoContextMenu);
setToolTip(i18n("Click to copy data to clipboard"));
@@ -72,12 +73,17 @@ void DraggableLabel::mousePressEvent(QMouseEvent *ev)
QLabel::mousePressEvent(ev);
if (ev->button() == Qt::LeftButton) {
m_clickStart = ev->pos();
+ m_dragStarted = false;
}
}
void DraggableLabel::mouseReleaseEvent(QMouseEvent *ev)
{
- QLabel::mouseReleaseEvent(ev);
+ // Don't call mouserelease in cas of drag because label might be deleted by a drop
+ if (!m_dragStarted)
+ QLabel::mouseReleaseEvent(ev);
+ else
+ ev->ignore();
m_clickStart = QPoint();
}
@@ -86,6 +92,7 @@ void DraggableLabel::mouseMoveEvent(QMouseEvent *ev)
QLabel::mouseMoveEvent(ev);
if (!m_clickStart.isNull() && (m_clickStart - ev->pos()).manhattanLength() >= QApplication::startDragDistance()) {
emit startDrag(objectName());
+ m_dragStarted = true;
m_clickStart = QPoint();
}
}
diff --git a/src/effectstack/parametercontainer.h b/src/effectstack/parametercontainer.h
index 70b957d..b0bb605 100644
--- a/src/effectstack/parametercontainer.h
+++ b/src/effectstack/parametercontainer.h
@@ -69,6 +69,7 @@ signals:
void startDrag(const QString &);
private:
QPoint m_clickStart;
+ bool m_dragStarted;
};
class MySpinBox : public QSpinBox
diff --git a/src/effectstack/positionedit.cpp b/src/effectstack/positionedit.cpp
index 47cf229..ffe9160 100644
--- a/src/effectstack/positionedit.cpp
+++ b/src/effectstack/positionedit.cpp
@@ -30,7 +30,7 @@ PositionEdit::PositionEdit(const QString &name, int pos, int min, int max, const
QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
- QLabel label(name, this);
+ QLabel *label = new QLabel(name, this);
m_slider = new QSlider(Qt::Horizontal);
m_slider->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
m_slider->setRange(min, max);
@@ -39,7 +39,7 @@ PositionEdit::PositionEdit(const QString &name, int pos, int min, int max, const
m_display->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
m_display->setRange(min, max);
- layout->addWidget(&label);
+ layout->addWidget(label);
layout->addWidget(m_slider);
layout->addWidget(m_display);