fix IA6AU3【主题制作工坊】【次要】【图标主题】创建系统设置主题后安装应用,控制面板首页各选项图标与上传的图片不对应

This commit is contained in:
like 2024-06-21 09:53:11 +08:00
parent 0e364fb132
commit 4968be1048
1 changed files with 25 additions and 6 deletions

View File

@ -382,15 +382,34 @@ void IconThemeWidget::initSystemEditWidget()
QVBoxLayout *mainLayout = new QVBoxLayout(viewportWidget);
viewportWidget->setLayout(mainLayout);
QMap<QString,QString>* appicon_name_CH = new QMap<QString,QString>;
QList<QString> keys = m_systemiconpathmap->keys();
appicon_name_CH = m_preview->initSystemIconName(appicon_name_CH,keys);
QList<QPair<QString, QString>> sortedList1;
for (auto it = m_systemiconpathmap->begin(); it != m_systemiconpathmap->end(); ++it) {
const QString& widgetName = it.key();
const QString& filePath = it.value();
sortedList1.append(qMakePair(it.key(), it.value()));
}
std::sort(sortedList1.begin(), sortedList1.end(), [](const QPair<QString, QString>& pair1, const QPair<QString, QString>& pair2){
// 按照指定顺序进行排序
QStringList order = QStringList() << "kylin-settings-account" << "kylin-settings-system" << "kylin-settings-devices" << "kylin-settings-network" << "kylin-settings-personalized"
<< "kylin-settings-datetime"<< "kylin-settings-update" << "kylin-settings-security"
<< "kylin-settings-application" << "kylin-settings-search" << "kylin-settings-commoninfo";
return order.indexOf(pair1.first) < order.indexOf(pair2.first);
});
QMap<QString,QString>* appicon_name_CH = new QMap<QString,QString>;
QList<QString> keys;
keys << "kylin-settings-account" << "kylin-settings-system" << "kylin-settings-devices" << "kylin-settings-network" << "kylin-settings-personalized"
<< "kylin-settings-datetime"<< "kylin-settings-update" << "kylin-settings-security"
<< "kylin-settings-application" << "kylin-settings-search" << "kylin-settings-commoninfo";;
appicon_name_CH = m_preview->initSystemIconName(appicon_name_CH,keys);
for (const auto& pair : sortedList1) {
qDebug()<<pair.first<<"-------------------------------------"<<pair.second;
const QString& widgetName = pair.first;
const QString& filePath = pair.second;
IconEditWidget* widget = new IconEditWidget(viewportWidget);
widget->setdefaulticon(filePath);
widget->setdefaulticonname(appicon_name_CH->value(it.key()));
widget->setdefaulticonname(appicon_name_CH->value(pair.first));
// widget->setdefaulticonname(tr(widgetName));
widget->setProperty("widgetname",widgetName);
QPushButton *line = new QPushButton();
line->setDisabled(true);