From e0f4fdd9592bde252b478e76d92b328d118f235b Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 28 Jul 2018 21:09:30 -0700 Subject: [PATCH] Add hover state to Macro Delete button --- Editor/SoundMacroEditor.cpp | 9 ++- .../resources/IconSoundMacroDeleteHovered.svg | 78 +++++++++++++++++++ Editor/resources/lang_de.ts | 4 +- Editor/resources/resources.qrc | 1 + 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 Editor/resources/IconSoundMacroDeleteHovered.svg diff --git a/Editor/SoundMacroEditor.cpp b/Editor/SoundMacroEditor.cpp index 55ea1e4..6fcbf5b 100644 --- a/Editor/SoundMacroEditor.cpp +++ b/Editor/SoundMacroEditor.cpp @@ -158,7 +158,14 @@ CommandWidget::CommandWidget(amuse::SoundMacro::ICmd* cmd, amuse::SoundMacro::Cm if (op != amuse::SoundMacro::CmdOp::End) { m_deleteButton.setFixedSize(21, 21); - m_deleteButton.setIcon(QIcon(QStringLiteral(":/icons/IconSoundMacroDelete.svg"))); + m_deleteButton.setStyleSheet("QPushButton {\n" + " background-image: url(\":/icons/IconSoundMacroDelete.svg\");\n" + " background-repeat: no-repeat;\n" + "}\n" + "QPushButton:hover {\n" + " background-image: url(\":/icons/IconSoundMacroDeleteHovered.svg\");\n" + " background-repeat: no-repeat;\n" + "}"); m_deleteButton.setFlat(true); m_deleteButton.setToolTip(tr("Delete this SoundMacro")); connect(&m_deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteClicked())); diff --git a/Editor/resources/IconSoundMacroDeleteHovered.svg b/Editor/resources/IconSoundMacroDeleteHovered.svg new file mode 100644 index 0000000..d44a37b --- /dev/null +++ b/Editor/resources/IconSoundMacroDeleteHovered.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/Editor/resources/lang_de.ts b/Editor/resources/lang_de.ts index 86b4c75..94c930f 100644 --- a/Editor/resources/lang_de.ts +++ b/Editor/resources/lang_de.ts @@ -4,7 +4,7 @@ CommandWidget - + Delete this SoundMacro @@ -542,7 +542,7 @@ TargetButton - + Set step with target click diff --git a/Editor/resources/resources.qrc b/Editor/resources/resources.qrc index b922d77..5c1c4d4 100644 --- a/Editor/resources/resources.qrc +++ b/Editor/resources/resources.qrc @@ -20,6 +20,7 @@ IconCurve.svg IconNewCurve.svg IconSoundMacroDelete.svg + IconSoundMacroDeleteHovered.svg IconSoundMacroTarget.svg IconSoundMacroTargetDisabled.svg IconKill.svg