pawelsalawa / sqlitestudio

A free, open source, multi-platform SQLite database manager.
https://sqlitestudio.pl
Other
4.67k stars 571 forks source link

Grid view, entering a cell for modification #5083

Closed marcpley closed 1 week ago

marcpley commented 3 weeks ago

Details

To replace the value of a cell we have to focus the cell and simply type the new value. It's good. Capture d’écran du 2024-10-30 18-34-56

To modify the value of a cell we have to focus the cell and entering it CAM01737 and the value is totally selected. It's not usefull because if I enter in the cell I don't want to replace it or copy it. Most often it's the end of the value that have to be modified. So, placing the cursor at the end of the value would be more ergonomic for the db users.

pawelsalawa commented 3 weeks ago

I agree your proposal is more intuitive.

marcpley commented 2 weeks ago

../guiSQLiteStudio/datagrid/fkcombobox.cpp line 113 Comment this 2 lines:

if (!value.isNull() && isEditable())
    lineEdit()->selectAll();
pawelsalawa commented 2 weeks ago

This fix alone will apply only for columns with Foreign Key (as fkcombobox is used there). It's good, but it's not complete solution yet.

pawelsalawa commented 2 weeks ago

According to https://forum.qt.io/topic/51878/solved-remove-text-selection-when-qlineedit-gets-focus/4 we have to switch from vanilla QLineEdit to our own class that extends QLineEdit and overrides focusInEvent.

pawelsalawa commented 2 weeks ago

I will try that solution.

marcpley commented 1 week ago

I agree my proposal isn't good. And even for fk it's not good when wanting to replace the entire value. In fact I mixed up this enhancement and bug 5082.

pawelsalawa commented 1 week ago

I got the expected behavior by extending QLineEdit and selecting contents conditionally (depending on how the edition was triggered).

marcpley commented 1 week ago

With this db: test.sqlite3.tar.gz

browse "Cultures" table, click on "Hors serre-6B" in column "Planche" image

type "no" with keyboard, auto-completion works and propose "nord-1"

if mouse click to open the foreign table grid, it's ok (corrected part of the bug).

but if you don't open the foreign table grid and type keydown key to have "Nord-1A" it don't work, you will have the first row of the foreign table: "Fruitiers-1"

pawelsalawa commented 5 days ago

Okay, I found a way to fix it. You can git pull and verify on your side.