1
0
Fork 0
forked from suyu/suyu

shared_widget: Use a better icon

This one looks more relevant on Windows.
This commit is contained in:
lat9nq 2023-05-18 16:07:48 -04:00
parent 4ff8255e4a
commit f055f2dcf4

View file

@ -26,7 +26,7 @@ namespace ConfigurationShared {
QPushButton* Widget::CreateRestoreGlobalButton(Settings::BasicSetting& setting, QWidget* parent) { QPushButton* Widget::CreateRestoreGlobalButton(Settings::BasicSetting& setting, QWidget* parent) {
QStyle* style = parent->style(); QStyle* style = parent->style();
QIcon* icon = new QIcon(style->standardIcon(QStyle::SP_DialogResetButton)); QIcon* icon = new QIcon(style->standardIcon(QStyle::SP_LineEditClearButton));
QPushButton* restore_button = new QPushButton(*icon, QStringLiteral(""), parent); QPushButton* restore_button = new QPushButton(*icon, QStringLiteral(""), parent);
restore_button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); restore_button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@ -271,7 +271,7 @@ void Widget::CreateSlider(const QString& label, bool reversed, float multiplier,
restore_button->setVisible(false); restore_button->setVisible(false);
}); });
QObject::connect(slider, &QAbstractSlider::sliderMoved, [=](int) { QObject::connect(slider, &QAbstractSlider::valueChanged, [=]() {
restore_button->setEnabled(true); restore_button->setEnabled(true);
restore_button->setVisible(true); restore_button->setVisible(true);
}); });
@ -461,8 +461,7 @@ void Widget::CreateDateTimeEdit(const QString& label, std::function<void()>& loa
return; return;
} }
other_setting->LoadString( setting.LoadString(std::to_string(date_time_edit->dateTime().toSecsSinceEpoch()));
std::to_string(date_time_edit->dateTime().toSecsSinceEpoch()));
}; };
} else { } else {
if (!has_checkbox) { if (!has_checkbox) {
@ -473,7 +472,7 @@ void Widget::CreateDateTimeEdit(const QString& label, std::function<void()>& loa
auto get_clear_val = [=]() { auto get_clear_val = [=]() {
return QDateTime::fromSecsSinceEpoch([=]() { return QDateTime::fromSecsSinceEpoch([=]() {
if (restrict && checkbox->checkState() == Qt::Checked) { if (restrict && checkbox->checkState() == Qt::Checked) {
return std::stoll(other_setting->ToStringGlobal()); return std::stoll(setting.ToStringGlobal());
} }
return current_time; return current_time;
}()); }());
@ -498,8 +497,7 @@ void Widget::CreateDateTimeEdit(const QString& label, std::function<void()>& loa
const bool using_global = !restore_button->isEnabled(); const bool using_global = !restore_button->isEnabled();
other_setting->SetGlobal(using_global); other_setting->SetGlobal(using_global);
if (!using_global) { if (!using_global) {
other_setting->LoadString( setting.LoadString(std::to_string(date_time_edit->dateTime().toSecsSinceEpoch()));
std::to_string(date_time_edit->dateTime().toSecsSinceEpoch()));
} }
}; };
} }