Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automation crash (#6711) #6718

Merged
merged 5 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 9 additions & 26 deletions include/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,18 @@ class LMMS_EXPORT Model : public QObject
{
Q_OBJECT
public:
Model( Model * _parent, QString _display_name = QString(),
bool _default_constructed = false ) :
QObject( _parent ),
m_displayName( _display_name ),
m_defaultConstructed( _default_constructed )
{
}
Model(Model * _parent, QString _display_name = QString(),
bool _default_constructed = false );

~Model() override = default;

bool isDefaultConstructed()
{
return m_defaultConstructed;
}

Model* parentModel() const
{
return static_cast<Model *>( parent() );
}

virtual QString displayName() const
{
return m_displayName;
}

virtual void setDisplayName( const QString& displayName )
{
m_displayName = displayName;
}
bool isDefaultConstructed() const;

Model* parentModel() const;

virtual QString displayName() const;

virtual void setDisplayName(const QString& displayName);

virtual QString fullDisplayName() const;

Expand Down
27 changes: 27 additions & 0 deletions src/core/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@
namespace lmms
{

Model::Model(Model * _parent, QString _display_name, bool _default_constructed) :
QObject( _parent ),
m_displayName( _display_name ),
m_defaultConstructed( _default_constructed )
{
}

bool Model::isDefaultConstructed() const
{
return m_defaultConstructed;
}

Model* Model::parentModel() const
{
return dynamic_cast<Model *>( parent() );
}

QString Model::displayName() const
{
return m_displayName;
}

void Model::setDisplayName( const QString& displayName )
{
m_displayName = displayName;
}

QString Model::fullDisplayName() const
{
const QString & n = displayName();
Expand Down