-
Notifications
You must be signed in to change notification settings - Fork 281
New layer is selected after creation #1328
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
New layer is selected after creation #1328
Conversation
Since I don't like the same code repeated in many (four) functions, I now also moved the Q_EMIT to the common function setNewLayerAsSelected(). |
@@ -180,7 +181,7 @@ LayerBitmap* LayerManager::createBitmapLayer(const QString& strLayerName) | |||
const QString& name = nameSuggestLayer(strLayerName); | |||
layer->setName(name); | |||
|
|||
Q_EMIT layerCountChanged(count()); | |||
setNewLayerAsSelected(); | |||
|
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.
Probably not here. load()
is called after a Project is loaded. It looks a bit weird to see aything related to NewLayer 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.
It's not being called in load(), github is showing a slightly confusing image.. the method is only added in createLayer methods.
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.
Ah, got it. sorry my bad.
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.
LGTM.
Alternatively you could have created a getLastLayerIndex() { return count() -1 } and then setCurrentLayer(getLastLayerIndex());
After thinking about it I decided to create a getLastLayerIndex() function, since it may come in handy in other cases. |
Tested and works as expected, well done 👍 |
New layer is selected when created. Only tested on Win10, so it should work on all platforms ;-)
closes #1327