-
Notifications
You must be signed in to change notification settings - Fork 22
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
Object Editor Events #153
Object Editor Events #153
Conversation
fundies
commented
Aug 17, 2020
•
edited
Loading
edited
std::unique_ptr<EventData> _event_data; | ||
|
||
static std::unique_ptr<EventData> _event_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a static MainWindow::_instance
with a getter somewhere that I added. You can use it to refer to the main window and stuff for now. Please use it as it makes it easier to refactor the static access of the main window later on if we ever need to.
#include <QSpinBox> | ||
#include <QToolButton> | ||
|
||
EventArgumentsDialog::EventArgumentsDialog(QWidget *parent, const QStringList &arguments) : QDialog(parent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the arguments string and not QVariant or something. Why aren't we using real reflection over the event proto here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they're strings... Arguments are "object", "integer" or "string"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what's in event data? Strings is what the shared event stuff gives you to work with? I don't know why Josh would do it that way and not give an enum or some other typed way of doing it.
|
||
bool EventTypesListSortFilterProxyModel::lessThan(const QModelIndex& source_left, | ||
const QModelIndex& source_right) const { | ||
//Try to sort alpha but keep grouped events together |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's known as a stable sort.
https://en.wikipedia.org/wiki/Category:Stable_sorts
sourceModel()->data(source_right, Qt::DisplayRole).toString(); | ||
} | ||
|
||
return leftGroup < rightGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not store integer ids for events anymore so if you want a specific ordering you will need to hard code it in the sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine, I just wanted to document it, I don't really care. The only thing I might say to do is we should just always put create first, that's the only part of the order that's stuck in my head, that the create is at the top, like a constructor usually is in a class.
My other issue with it is it's not sorted until you close and reopen the frame too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start to the object editor! Still 2-3 small issues that can be fixed after merge.
- Change event doesn't repaint for some reason. Change create to destroy doesn't repaint, and changing destroy to create fails.
- The events aren't sorted until you close and reopen the editor.
- Feature: Delete multiple/ExtendedSelection events.