mirror of https://github.com/AxioDL/amuse.git
Subclass delete button rather than use QSS
This commit is contained in:
parent
708ed599ae
commit
f00904dd76
|
@ -126,6 +126,26 @@ FieldSoundMacroStep::FieldSoundMacroStep(FieldProjectNode* macroField, QWidget*
|
|||
setLayout(layout);
|
||||
}
|
||||
|
||||
void SoundMacroDeleteButton::enterEvent(QEvent* event)
|
||||
{
|
||||
setIcon(QIcon(QStringLiteral(":/icons/IconSoundMacroDeleteHovered.svg")));
|
||||
}
|
||||
|
||||
void SoundMacroDeleteButton::leaveEvent(QEvent* event)
|
||||
{
|
||||
setIcon(QIcon(QStringLiteral(":/icons/IconSoundMacroDelete.svg")));
|
||||
}
|
||||
|
||||
SoundMacroDeleteButton::SoundMacroDeleteButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
setVisible(false);
|
||||
setFixedSize(21, 21);
|
||||
setFlat(true);
|
||||
setToolTip(tr("Delete this SoundMacro"));
|
||||
setIcon(QIcon(QStringLiteral(":/icons/IconSoundMacroDelete.svg")));
|
||||
}
|
||||
|
||||
CommandWidget::CommandWidget(amuse::SoundMacro::ICmd* cmd, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing)
|
||||
: QWidget(nullptr), m_cmd(cmd), m_introspection(amuse::SoundMacro::GetCmdIntrospection(op))
|
||||
{
|
||||
|
@ -157,17 +177,7 @@ CommandWidget::CommandWidget(amuse::SoundMacro::ICmd* cmd, amuse::SoundMacro::Cm
|
|||
headLayout->addWidget(&m_titleLabel);
|
||||
if (op != amuse::SoundMacro::CmdOp::End)
|
||||
{
|
||||
m_deleteButton.setFixedSize(21, 21);
|
||||
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"));
|
||||
m_deleteButton.setVisible(true);
|
||||
connect(&m_deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteClicked()));
|
||||
headLayout->addWidget(&m_deleteButton);
|
||||
}
|
||||
|
|
|
@ -78,13 +78,22 @@ public:
|
|||
void cancel();
|
||||
};
|
||||
|
||||
class SoundMacroDeleteButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SoundMacroDeleteButton(QWidget* parent = Q_NULLPTR);
|
||||
void enterEvent(QEvent* event);
|
||||
void leaveEvent(QEvent* event);
|
||||
};
|
||||
|
||||
class CommandWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SoundMacroListing;
|
||||
QFont m_numberFont;
|
||||
QLabel m_titleLabel;
|
||||
QPushButton m_deleteButton;
|
||||
SoundMacroDeleteButton m_deleteButton;
|
||||
QStaticText m_numberText;
|
||||
int m_index = -1;
|
||||
amuse::SoundMacro::ICmd* m_cmd;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="de_DE">
|
||||
<context>
|
||||
<name>CommandWidget</name>
|
||||
<message>
|
||||
<location filename="../SoundMacroEditor.cpp" line="+170"/>
|
||||
<source>Delete this SoundMacro</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
|
@ -437,7 +429,7 @@
|
|||
<context>
|
||||
<name>QUndoStack</name>
|
||||
<message>
|
||||
<location filename="../SoundMacroEditor.cpp" line="+162"/>
|
||||
<location filename="../SoundMacroEditor.cpp" line="+342"/>
|
||||
<source>Change %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -531,6 +523,14 @@
|
|||
<translation>Befehle zum Steuern der Lautstärke der Stimme</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SoundMacroDeleteButton</name>
|
||||
<message>
|
||||
<location line="-847"/>
|
||||
<source>Delete this SoundMacro</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StatusBarWidget</name>
|
||||
<message>
|
||||
|
@ -542,7 +542,7 @@
|
|||
<context>
|
||||
<name>TargetButton</name>
|
||||
<message>
|
||||
<location filename="../SoundMacroEditor.cpp" line="-955"/>
|
||||
<location filename="../SoundMacroEditor.cpp" line="-118"/>
|
||||
<source>Set step with target click</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue