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);
|
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)
|
CommandWidget::CommandWidget(amuse::SoundMacro::ICmd* cmd, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing)
|
||||||
: QWidget(nullptr), m_cmd(cmd), m_introspection(amuse::SoundMacro::GetCmdIntrospection(op))
|
: 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);
|
headLayout->addWidget(&m_titleLabel);
|
||||||
if (op != amuse::SoundMacro::CmdOp::End)
|
if (op != amuse::SoundMacro::CmdOp::End)
|
||||||
{
|
{
|
||||||
m_deleteButton.setFixedSize(21, 21);
|
m_deleteButton.setVisible(true);
|
||||||
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()));
|
connect(&m_deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteClicked()));
|
||||||
headLayout->addWidget(&m_deleteButton);
|
headLayout->addWidget(&m_deleteButton);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,22 @@ public:
|
||||||
void cancel();
|
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
|
class CommandWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class SoundMacroListing;
|
friend class SoundMacroListing;
|
||||||
QFont m_numberFont;
|
QFont m_numberFont;
|
||||||
QLabel m_titleLabel;
|
QLabel m_titleLabel;
|
||||||
QPushButton m_deleteButton;
|
SoundMacroDeleteButton m_deleteButton;
|
||||||
QStaticText m_numberText;
|
QStaticText m_numberText;
|
||||||
int m_index = -1;
|
int m_index = -1;
|
||||||
amuse::SoundMacro::ICmd* m_cmd;
|
amuse::SoundMacro::ICmd* m_cmd;
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.1" language="de_DE">
|
<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>
|
<context>
|
||||||
<name>MainWindow</name>
|
<name>MainWindow</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -437,7 +429,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>QUndoStack</name>
|
<name>QUndoStack</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SoundMacroEditor.cpp" line="+162"/>
|
<location filename="../SoundMacroEditor.cpp" line="+342"/>
|
||||||
<source>Change %1</source>
|
<source>Change %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -531,6 +523,14 @@
|
||||||
<translation>Befehle zum Steuern der Lautstärke der Stimme</translation>
|
<translation>Befehle zum Steuern der Lautstärke der Stimme</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SoundMacroDeleteButton</name>
|
||||||
|
<message>
|
||||||
|
<location line="-847"/>
|
||||||
|
<source>Delete this SoundMacro</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>StatusBarWidget</name>
|
<name>StatusBarWidget</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -542,7 +542,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>TargetButton</name>
|
<name>TargetButton</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SoundMacroEditor.cpp" line="-955"/>
|
<location filename="../SoundMacroEditor.cpp" line="-118"/>
|
||||||
<source>Set step with target click</source>
|
<source>Set step with target click</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Loading…
Reference in New Issue