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

Allow changing order of open document tabs #640

Merged
merged 4 commits into from
May 11, 2014
Merged

Allow changing order of open document tabs #640

merged 4 commits into from
May 11, 2014

Conversation

sean-h
Copy link
Contributor

@sean-h sean-h commented Apr 15, 2014

Allows a user to reorder open document tabs; closes #407 .

@bjorn
Copy link
Member

bjorn commented Apr 15, 2014

Hmm, there was some reason that I didn't enable this like that. Are you sure everything is working correctly with that change?

@stefanbeller
Copy link
Contributor

If I recall correctly, the either the saving of the documents or the restoring order when restarting tiled was a problem in the discussion we had years ago.

@sean-h
Copy link
Contributor Author

sean-h commented Apr 15, 2014

I didn't notice that it wasn't restoring the modified tab order when restarting. I added a method to reset the ordering of the open documents list. Qt doesn't seem to have any way to respond to a tab reorder event when using QTabWidget so I set it to update whenever the tabs may have been changed since last access (closing the program, closing a tab, switching tabs).

@bjorn
Copy link
Member

bjorn commented Apr 16, 2014

Hmm, this looks a little brute-force to me. Could you try to make a QTabWidget subclass that forwards the tabMoved signal from its QTabBar, and use that? The subclass is necessary because the QTabWidget::tabBar() accessor is protected.

void DocumentManager::documentTabMoved(int from, int to)
{
MapDocument* mapDocument = mDocuments.takeAt(from);
mDocuments.insert(to, mapDocument);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to use mDocuments.move(from, to).

bjorn added a commit that referenced this pull request May 11, 2014
Allow changing order of open document tabs
@bjorn bjorn merged commit ed7eb01 into mapeditor:master May 11, 2014
@bjorn
Copy link
Member

bjorn commented May 11, 2014

Thanks, @sean-h!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow changing order of open document tabs
3 participants