upgrade to qt 6 compliance

This commit is contained in:
itsmattkc
2022-10-28 19:42:14 -07:00
parent 2a595cb4c7
commit 4d80044d6d
69 changed files with 152 additions and 130 deletions
+14 -2
View File
@@ -103,14 +103,26 @@ void SliderBase::changeEvent(QEvent *e)
super::changeEvent(e);
}
bool SliderBase::GetLabelSubstitution(const QVariant &v, QString *out) const
{
for (auto it=label_substitutions_.constBegin(); it!=label_substitutions_.constEnd(); it++) {
if (it->first == v) {
*out = it->second;
return true;
}
}
return false;
}
void SliderBase::UpdateLabel()
{
QString s;
if (tristate_) {
s = tr("---");
} else if (label_substitutions_.contains(GetValueInternal())) {
s = label_substitutions_.value(GetValueInternal());
} else if (GetLabelSubstitution(GetValueInternal(), &s)) {
// String will already be set, just pass through
} else {
s = GetFormattedValueToString();
}
+4 -2
View File
@@ -51,7 +51,7 @@ public:
void InsertLabelSubstitution(const QVariant &value, const QString &label)
{
label_substitutions_.insert(value, label);
label_substitutions_.append({value, label});
UpdateLabel();
}
@@ -90,6 +90,8 @@ protected:
virtual void changeEvent(QEvent* e) override;
private:
bool GetLabelSubstitution(const QVariant &v, QString *out) const;
SliderLabel* label_;
FocusableLineEdit* editor_;
@@ -103,7 +105,7 @@ private:
bool format_plural_;
QMap<QVariant, QString> label_substitutions_;
QVector<QPair<QVariant, QString> > label_substitutions_;
private slots:
void LineEditConfirmed();
+1 -1
View File
@@ -42,7 +42,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
QFrame(parent, Qt::Popup)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
setFrameShape(QFrame::Box);