Fix crash on geometry drop, restore some effect parameters label

parent 470dfee4
......@@ -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;} "));
......
......@@ -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();
}
}
......
......@@ -69,6 +69,7 @@ signals:
void startDrag(const QString &);
private:
QPoint m_clickStart;
bool m_dragStarted;
};
class MySpinBox : public QSpinBox
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment