mirror of
https://github.com/YACReader/yacreader
synced 2026-03-01 18:33:09 -05:00
Initial implementation of theming
This commit is contained in:
@ -71,6 +71,32 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
|
||||
setWindowTitle(tr("Shortcuts settings"));
|
||||
|
||||
setModal(true);
|
||||
|
||||
initTheme(this);
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::applyTheme(const Theme &theme)
|
||||
{
|
||||
updateGroupIcons(theme);
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::updateGroupIcons(const Theme &theme)
|
||||
{
|
||||
// Update icons for all groups based on the mapping
|
||||
for (int i = 0; i < groupsModel->rowCount(); ++i) {
|
||||
QModelIndex idx = groupsModel->index(i, 0);
|
||||
QString groupName = groupsModel->data(idx, Qt::DisplayRole).toString();
|
||||
|
||||
if (groupIconMapping.contains(groupName)) {
|
||||
QIcon newIcon = groupIconMapping[groupName](theme);
|
||||
groupsModel->updateGroupIcon(i, newIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::setGroupIconMapping(const QMap<QString, std::function<QIcon(const Theme &)>> &mapping)
|
||||
{
|
||||
groupIconMapping = mapping;
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group)
|
||||
|
||||
Reference in New Issue
Block a user