Use customContextMenu for changing the display type

This commit is contained in:
Thomas Wilshaw
2021-04-12 10:35:44 +01:00
parent a297dd0e53
commit 6a4f292ae2
3 changed files with 6 additions and 2 deletions
+1
View File
@@ -32,6 +32,7 @@ RationalSlider::RationalSlider(QWidget *parent) :
connect(this, SIGNAL(ValueChanged(QVariant)), this, SLOT(ConvertValue(QVariant)));
connect(this, &SliderBase::changeRationalDisplayType, this, &RationalSlider::changeDisplayType);
connect(Core::instance(), &Core::TimecodeDisplayChanged, this, &RationalSlider::ChangeTimecodeDisplayType);
connect(SliderBase::label(), &SliderLabel::customContextMenuRequested, this, &RationalSlider::changeDisplayType);
SetDisplayType(display_type_);
+2
View File
@@ -85,6 +85,8 @@ protected:
void UpdateLabel(const QVariant& v);
QLabel* label() { return label_; }
virtual double AdjustDragDistanceInternal(const double& start, const double& drag);
virtual QString ValueToString(const QVariant &v) = 0;
+3 -2
View File
@@ -47,6 +47,9 @@ SliderLabel::SliderLabel(QWidget *parent) :
// Allow users to tab to this widget
setFocusPolicy(Qt::TabFocus);
// Add ccustom context menu
setContextMenuPolicy(Qt::CustomContextMenu);
}
void SliderLabel::mousePressEvent(QMouseEvent *e)
@@ -57,8 +60,6 @@ void SliderLabel::mousePressEvent(QMouseEvent *e)
} else {
emit LabelPressed();
}
} else if (e->button() == Qt::RightButton) {
emit ChangeSliderType();
}
}