Use customContextMenu for changing the display type
This commit is contained in:
@@ -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_);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user