20 #ifndef __PALETTEWORKSPACE_H__ 21 #define __PALETTEWORKSPACE_H__ 27 class AbstractPaletteController;
28 class PaletteWorkspace;
50 : QObject(parent), _controller(controller), _paletteIndex(paletteIndex), _type(type) {}
55 Q_INVOKABLE
void open();
66 Q_PROPERTY(
bool canDropElements READ canDropElements CONSTANT)
68 virtual
bool canDropElements()
const {
return false; }
80 Q_INVOKABLE
virtual Qt::DropAction
dropAction(
const QVariantMap& mimeData, Qt::DropAction proposedAction,
const QModelIndex& parent,
bool internal)
const 82 Q_UNUSED(mimeData); Q_UNUSED(proposedAction); Q_UNUSED(parent); Q_UNUSED(
internal);
83 return Qt::IgnoreAction;
86 Q_INVOKABLE
virtual bool move(
const QModelIndex& sourceParent,
int sourceRow,
const QModelIndex& destinationParent,
int destinationChild) = 0;
87 Q_INVOKABLE
virtual bool insert(
const QModelIndex& parent,
int row,
const QVariantMap& mimeData, Qt::DropAction action) = 0;
88 Q_INVOKABLE
virtual bool insertNewItem(
const QModelIndex& parent,
int row) = 0;
89 Q_INVOKABLE
virtual void remove(
const QModelIndex&) = 0;
90 Q_INVOKABLE
virtual void removeSelection(
const QModelIndexList&,
const QModelIndex& parent) = 0;
92 Q_INVOKABLE
virtual bool canEdit(
const QModelIndex&)
const {
return false; }
97 Q_INVOKABLE
virtual bool applyPaletteElement(
const QModelIndex& index, Qt::KeyboardModifiers modifiers) { Q_UNUSED(index); Q_UNUSED(modifiers);
return false; }
112 bool _visible =
true;
113 bool _custom =
false;
114 bool _filterCustom =
false;
116 bool _userEditable =
true;
120 void showHideOrDeleteDialog(
const QString& question, std::function<
void(
RemoveAction)> resultHandler)
const;
121 void queryRemove(
const QModelIndexList&,
int customCount);
126 CustomPaletteHideDeleteConfirmation
132 QAbstractItemModel*
model() {
return _model; }
133 const QAbstractItemModel*
model()
const {
return _model; }
142 void setCustom(
bool val) { _custom = val; _filterCustom =
true; }
144 Qt::DropAction dropAction(
const QVariantMap& mimeData, Qt::DropAction proposedAction,
const QModelIndex& parent,
bool internal)
const override;
146 bool move(
const QModelIndex& sourceParent,
int sourceRow,
const QModelIndex& destinationParent,
int destinationChild)
override;
147 bool insert(
const QModelIndex& parent,
int row,
const QVariantMap& mimeData, Qt::DropAction action)
override;
148 bool insertNewItem(
const QModelIndex& parent,
int row)
override;
149 void remove(
const QModelIndex& index)
override;
150 void removeSelection(
const QModelIndexList&,
const QModelIndex& parent)
override;
152 void editPaletteProperties(
const QModelIndex& index)
override;
153 void editCellProperties(
const QModelIndex& index)
override;
158 bool canEdit(
const QModelIndex&)
const override;
160 bool applyPaletteElement(
const QModelIndex& index, Qt::KeyboardModifiers modifiers)
override;
174 QAbstractItemModel* mainPalette =
nullptr;
182 Q_PROPERTY(QAbstractItemModel* mainPaletteModel READ mainPaletteModel CONSTANT)
188 QAbstractItemModel* mainPaletteModel();
195 CustomRole = Qt::UserRole + 1,
200 void userPaletteChanged();
206 Q_INVOKABLE QModelIndex customElementsPaletteIndex(
const QModelIndex& index);
213 Q_INVOKABLE QAbstractItemModel* availableExtraPalettesModel();
214 Q_INVOKABLE
bool addPalette(
const QPersistentModelIndex&);
215 Q_INVOKABLE
bool removeCustomPalette(
const QPersistentModelIndex&);
217 Q_INVOKABLE
bool resetPalette(
const QModelIndex&);
219 Q_INVOKABLE
bool savePalette(
const QModelIndex&);
220 Q_INVOKABLE
bool loadPalette(
const QModelIndex&);
224 void setUserPaletteTree(std::unique_ptr<PaletteTree> tree);
225 void setDefaultPaletteTree(std::unique_ptr<PaletteTree> tree);
Definition: paletteworkspace.h:167
PalettesModelRoles
Definition: paletteworkspace.h:194
void updateCellsState(const Selection &)
Definition: palettemodel.cpp:795
bool canDropElements() const override
Definition: paletteworkspace.h:118
void retranslate()
Definition: paletteworkspace.h:230
QPersistentModelIndex _paletteIndex
Definition: paletteworkspace.h:38
bool custom() const
Definition: paletteworkspace.h:141
PaletteTreeModel * masterPalette
Definition: paletteworkspace.h:171
PaletteTreeModel * defaultPalette
Definition: paletteworkspace.h:172
Definition: paletteworkspace.h:124
Base class of score layout elements.
Definition: element.h:158
Definition: paletteworkspace.h:125
Definition: palettemodel.h:181
PaletteTreeModel * _userPalette
Definition: paletteworkspace.h:110
Type
Definition: palettetree.h:98
PaletteElementEditor(AbstractPaletteController *controller, QPersistentModelIndex paletteIndex, PalettePanel::Type type, QObject *parent=nullptr)
Definition: paletteworkspace.h:49
bool userEditable() const
Definition: paletteworkspace.h:155
virtual Q_INVOKABLE void editCellProperties(const QModelIndex &index)
Definition: paletteworkspace.h:95
Definition: paletteworkspace.h:34
QAbstractItemModel * _model
Definition: paletteworkspace.h:109
AbstractPaletteController * _controller
Definition: paletteworkspace.h:37
Definition: paletteworkspace.h:62
void setCustom(bool val)
Definition: paletteworkspace.h:142
RemoveActionConfirmationType
Definition: paletteworkspace.h:123
PaletteTreeModel * userPaletteModel()
Definition: paletteworkspace.h:211
QString actionName() const
Definition: palettemodel.h:86
Definition: aeolus.cpp:26
AbstractPaletteController(QObject *parent=nullptr)
Definition: paletteworkspace.h:78
UserPaletteController(QAbstractItemModel *m, PaletteTreeModel *userPalette, QObject *parent=nullptr)
Definition: paletteworkspace.h:136
bool visible() const
Definition: paletteworkspace.h:139
bool paletteChanged() const
Definition: paletteworkspace.h:222
PaletteTreeModel * userPalette
Definition: paletteworkspace.h:170
void setVisible(bool val)
Definition: paletteworkspace.h:140
QAbstractItemModel * model()
Definition: paletteworkspace.h:132
virtual Q_INVOKABLE Qt::DropAction dropAction(const QVariantMap &mimeData, Qt::DropAction proposedAction, const QModelIndex &parent, bool internal) const
Definition: paletteworkspace.h:80
void setUserEditable(bool val)
Definition: paletteworkspace.h:156
virtual Q_INVOKABLE void editPaletteProperties(const QModelIndex &index)
Definition: paletteworkspace.h:94
virtual Q_INVOKABLE bool applyPaletteElement(const QModelIndex &index, Qt::KeyboardModifiers modifiers)
Definition: paletteworkspace.h:97
virtual Q_INVOKABLE bool canEdit(const QModelIndex &) const
Definition: paletteworkspace.h:92
bool paletteTreeChanged() const
Definition: palettemodel.h:137
void retranslate()
Definition: palettemodel.cpp:839
Q_INVOKABLE void open()
Definition: paletteworkspace.cpp:91
PalettePanel::Type _type
Definition: paletteworkspace.h:39
void updateCellsState(const Selection &sel)
Definition: paletteworkspace.h:229
Definition: paletteworkspace.h:106
void onElementAdded(const Element *)
Definition: paletteworkspace.cpp:75
RemoveAction
Definition: paletteworkspace.h:71
const QAbstractItemModel * model() const
Definition: paletteworkspace.h:133