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

Unable to move around (drag-drop) 4 tabs: Database-Browse-Edit Pragma-Execute SQL #1675

Closed
SilvioGrosso opened this issue Dec 20, 2018 · 16 comments
Assignees
Labels
enhancement Feature requests. gui

Comments

@SilvioGrosso
Copy link

SilvioGrosso commented Dec 20, 2018

Hello everyone,

Just only out of sheer curiosity...
I am wondering why I can easily change each position of some tabs (e.g. SQL log, plot, schema) as opposed to the 4 the tabs related to: Database Structure, Browse Filter, Edit Pragmas, Execute SQL which are stuck on their fixed position. More precisely, I have tried to change their fixed order (not simply moving some tabs a bit...).

Is it done on purpose or is it simply a feature not implemented for the 4 aforementioned tabs?

I have tested this behaviour both on Linux (kde desktop) - Windows 10 with different QT and Db Browser versions.

Here is a screenshot on Windows 10 (latest beta build) where I drag and drop the Plot tab:
drag_drop tabs png

Sorry for asking such trifles questions :-)

@justinclift
Copy link
Member

Pretty sure it's just a legacy thing, from the way the application was first created. No idea personally how hard or easy it would be to change. 😄

@SilvioGrosso
Copy link
Author

SilvioGrosso commented Dec 20, 2018 via email

@MKleusberg
Copy link
Member

I can confirm that it's for legacy reasons. In version 2.0 there were only three tabs (DB Structure, Browse Data, Execute SQL) and none of the movable docks. When new features were added, most of the time they were put into separate movable docks.

However, that doesn't mean it's super easy to change the current approach. That's because much of the code depends on the four main tabs to be there all the time, i.e. especially making them closable would mean a good amount of work. On the other hand, this would probably improve the overall code quality because it separates the different bits in a stricter way than now. So we might actually want to do that 😄

The main thing I'm worrying about is beginner users who might accidentally close or hide one of the more important tabs then and don't know what option to look for to show it again. Any ideas here?

@SilvioGrosso
Copy link
Author

SilvioGrosso commented Dec 20, 2018 via email

@mgrojo
Copy link
Member

mgrojo commented Dec 20, 2018

We could convert all the tabs to Dock Widgets but disable the Closable feature. With that I think we avoid problems with both users and with our own logic. Users could then move docks, make them floatable.

There's a problem, reading the documentation:

Constant Value Description
QDockWidget::DockWidgetClosable 0x01 The dock widget can be closed. On some systems the dock widget always has a close button when it's floating (for example on MacOS 10.5).

We'd have to disable the floatable feature too, at least in MacOS.

@chrisjlocke
Copy link
Member

Is it a forced close though? I know nothing about Qt - my background is VB. When you close a form in VB, the form has a 'hey, I'm closing!' event, which you can add code too, including a cancel, which cancels the close event. So, for Qt, maybe it has support for cancelling the close event?

@mgrojo mgrojo added enhancement Feature requests. gui labels Dec 21, 2018
@mgrojo
Copy link
Member

mgrojo commented Dec 21, 2018

Yes, it can also be ignored in Qt. So we could theoretically implement the floatable dock feature also in MacOS by ignoring the close event when user presses the close button.

@mgrojo mgrojo self-assigned this Dec 23, 2018
mgrojo added a commit that referenced this issue Dec 23, 2018
The movable attribute for the main tabs is enabled and the code is adapted
to use widget references instead of indices.

This allows user to move tabs and set a preferred order, but the order is
still not saved.

See issue #1675
@mgrojo
Copy link
Member

mgrojo commented Dec 24, 2018

I've seen it's relatively easy to allow the user to move the tabs. It only requires an attribute in the tabbed widget and prepare the code for referencing the tab widgets and not their indexes. But saving the order is not automatic like the docks, but I guess won't require much more work. So I think we can go through this path, at least on the short term.

They could be made closable if we also like it. Then they could be reactivated through the View menu.

@SilvioGrosso The next nightly build will allow you to move the tabs around, but not to save their positions for the next session. I'll take a look to that later.

@SilvioGrosso
Copy link
Author

Hello @mgrojo

Just tested this new option on Windows 10 (64 bit), with the nightly build (DB.Browser.for.SQLite-win64)

I can now drag-around any of the 4 uppermost tabs at will. Thanks a a lot!

BTW, I also confirm the crashes for the Plot tool (issue 1679) with today's build.

Here is a screenshot:

move_tabs png

mgrojo added a commit that referenced this issue Dec 25, 2018
Main tabs are made closable, so they can be closed by the user. New entries
are added to the View menu for toggling their open/closed state.

Spartan users can closed all tabs but their preferred, and then the tab bar
is hidden saving some space.

The set of open tabs and their order is automatically saved in the settings
on application exit and restored on application start.

Tab labels are stored in the statusTip attribute in order to restore them,
since those labels are not stored anywhere else.

See issues #1675 and #459
@mgrojo
Copy link
Member

mgrojo commented Dec 25, 2018

@SilvioGrosso You can now close tabs and save the order/open tabs automaticcally.

The main thing I'm worrying about is beginner users who might accidentally close or hide one of the more important tabs then and don't know what option to look for to show it again. Any ideas here?

They can be restored through the View menu. I hope users will find the way, because I find this is very convenient for advanced users. Do you guys find that in this way users could be lost?

There are still two possible improvements:

  • Saving the open tabs / order in the project files (they currently save the current tab and that might now interfere with the new setting). I think if we save both, then it will make sense again (except for old project files, if user has previously changed the tabs too, unless we restore the default layout for old files - those lacking the new setting).
  • Deciding about the Alt+[1-4]. See discussion started in 73f7cc8

@mgrojo mgrojo added this to the 3.12.0 - Future release milestone Dec 25, 2018
@SilvioGrosso
Copy link
Author

Hello @mgrojo

They can be restored through the View menu. I hope users will find the way, because I find this is very convenient for advanced users. Do you guys find that in this way users could be lost?

If I can crack a joke, no matter what you do, there will always be someone "who shoot himself in the foot", as the saying goes :-)
Usually, to avoid this problem, you need to write everything down in the documentation (wiki etc) but, again, it is a well proven fact that most casual users don't read the documentation either: they consider it "boring" :-)

Just a hint: maybe it is worthwhile adding some "Restore default" setting, somewhere (Preferencese?) to visualize all closed tabs again.

@justinclift
Copy link
Member

justinclift commented Dec 25, 2018

Just a hint: maybe it is worthwhile adding some "Restore default" setting, somewhere (Preferencese?) to visualize all closed tabs again.

It's in the bottom left corner of the Preferences dialog:

db4s_preference_setting

@SilvioGrosso
Copy link
Author

Hello @justinclift,

It's in the bottom left corner of the Preferences dialog

Yep. I know :-)
But currently, whenever you press this button it doesn't restore the tabs in the GUIs (e.g. their "natural" fiexed order for the 4 uppermost tabs).
In essence, If I drag the "Execute SQL" tab in the first position and then I press the button "Restore defaults", this tab (Execute) is not moved to its fourth old position (which is its "classical" position).

@justinclift
Copy link
Member

Ahhh. Understood. 😄

mgrojo added a commit that referenced this issue Dec 26, 2018
The ordered set of open tabs is saved in the project file using a new
element main_tabs with attributes open (ordered list of open tabs like the
"MainWindow/openTabs" setting) and current (the current index inside that
set).

When the project load code finds the old element (current_tab) it falls
back to restoring all the main tabs and then setting that tab index as
current. In this way, old project files are restored as they were saved,
even when the user has closed or moved some tabs.

See issue #1675.
mgrojo added a commit that referenced this issue Dec 26, 2018
- New action (Alt+0) in View menu for resetting window layout (main tabs,
toolbars and docks).
- Shortcuts for tabs use positional meaning: after moving the tabs, the
number always refers to the position of the tab, and not the identity.
- Avoid using statusTip for restoring the original tab label and use
accesibleName, which is believed to be either neutral, when set, or
beneficial.
- Assure the tab is open when some function switches to it: browse table
and SQLite checks.
- Avoid flickering while clearing and adding tabs.

See issue #1675
@mgrojo
Copy link
Member

mgrojo commented Dec 26, 2018

I've implemented the saving of tabs layout in project files, the Reset Window Layout action (bound to Alt+0) and now the shortcuts for tabs (Alt+[1-4]) always select tabs by position.

I've noticed an issue in the Reset Window Layout action: the first time it is invoked does not restore the original tab order. I think is some weirdness in Qt. It could be worked around by calling two times to restore the original tab order, but didn't want to commited until knowing if this is something happening with other Qt versions (mine is 5.9.5).

mgrojo added a commit that referenced this issue Dec 28, 2018
If there are no settings previously stored for the MainWindow/openTabs, the
default empty string was converted to a list of one empty string and
consequently all tabs were cleared and none added.

This fixes all possible cases where the list of open tabs is empty. It
means: do not make changes, as originally designed (since the setting for
all tabs closed doesn't make sense).

See issue #1692 (and #1675 for the enhancement).
@chrisjlocke
Copy link
Member

I'll close this, as the main issue has now been resolved. The 'side issues' and improvements can be worked on when the issues count have dropped down to single figures... ;)
Thanks for implementing this @mgrojo 💓

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

No branches or pull requests

5 participants