qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

Typing into sql (or any expression box) is broken on some Linux distributions #33581

Closed Isaacson33 closed 3 years ago

Isaacson33 commented 4 years ago

After update to 3.10 typing into any expression box is broken. The screenshot below shows what happens. There are no spaces in that text string at all, the cursor should be at the end of the string, it's miles off. It gradually seems to accumulate space as typing proceeds. Screenshot_20200102_105251 It makes it impossible to edit typing as backspace deletes letters which are nowhere near the actual cursor position. Anything that can't be written out without error first time is impossible to complete.

I've checked all other applications just to make sure it's not my keyboard driver or anything, but this problem is only on Qgis and only after update to 3.10.


QGIS version 3.10.1-A Coruña QGIS code branch Release QGIS code branch.3
Compiled against Qt 5.13.2 Running against Qt 5.14.0
Compiled against GDAL/OGR 3.0.2 Running against GDAL/OGR 3.0.2
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.30.1 Running against SQLite 3.30.1
PostgreSQL Client Version 12.1 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.3
Compiled against PROJ 6.2.1 Running against PROJ Rel. 6.2.1, November 1st, 2019
OS Version Manjaro Linux
Active python plugins clipper; refFunctions; quick_map_services; TomBio; MetaSearch; db_manager; processing
Saijin-Naib commented 4 years ago

Can't confirm here with Win10.

Could your Qt framework version mismatch (compiled against vs running against) be a possible cause?

QGIS version 3.10.1-A Coruña QGIS code revision ef24c526da
Compiled against Qt 5.11.2 Running against Qt 5.11.2
Compiled against GDAL/OGR 3.0.2 Running against GDAL/OGR 3.0.2
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.29.0 Running against SQLite 3.29.0
PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0
QWT Version 6.1.3 QScintilla2 Version 2.10.8
Compiled against PROJ 6.2.1 Running against PROJ Rel. 6.2.1, November 1st, 2019
OS Version Windows 10 (10.0)
Active python plugins CalculateGeometry; MemoryLayerSaver; networks; openlayers_plugin; PluginLoadTimes; realcentroid; refFunctions; snail; SpreadsheetLayers; db_manager; processing
Isaacson33 commented 4 years ago

Yeah, I did update Qt framework at the same time as Qgis, so a distinct possibility. Difficult to confirm though. I tried downgrading to Qt 5.13, but there were shared library issues and now Qgis won't load at all. I've tried resolving the library issues with symlinks, but it's just a long chain of them. I can continue to test, but if anyone knows a better workaround, I'd appreciate it.

Isaacson33 commented 4 years ago

OK, I've tried but it's just impossible to roll my QT framework back without messing up a while host of other applications on my system. I don't think it's a reasonable solution, so if a mismatch is the problem then 3.10 isn't going to work for anyone on the latest version of Qt framework. I'd suggest that's a problem for 3.10, not the users?

Isaacson33 commented 4 years ago

Another thing - don't know if it's relevant - but my last version of Qgis was 3.8.3 (which is compiled against QT 5.11.2), yet my last version of Qt frameworks was 5.13.2. It's never been a problem before, and there's nothing on the QT known issues about it.

gioman commented 4 years ago

@Isaacson33 can't confirm here on Ubuntu 18.04 with QGIS installed from official QGIS repos.

Isaacson33 commented 4 years ago

@Isaacson33 can't confirm here on Ubuntu 18.04 with QGIS installed from official QGIS repos.

Is that because your Qgis is running against the correct version of Qt, or is it, like mine, running against an older version but just not displaying the problems I'm experiencing?

gioman commented 4 years ago

@Isaacson33 it is the former, on Ubuntu here uses QT 5.9.5 but also no issues on Windows with QT 5.11.2. My guess is that is likely a local issue.

Isaacson33 commented 4 years ago

@Isaacson33 it is the former, on Ubuntu here uses QT 5.9.5 but also no issues on Windows with QT 5.11.2. My guess is that is likely a local issue.

By local, do you mean my machine, or my OS? If the latter (and the problem is caused by a mismatch of Qt versions) then surely that's a legitimate Qgis problem. If it doesn't work properly with the latest version of Qt, doesn't that need to be publicised (and corrected too - eventually)?

roya0045 commented 4 years ago

@Isaacson33 He means your machine only, most users don't fiddle with qt usually. And since its relying on something on your system I don't think its a fix that can be done, is someone breaks libraries/dependencies of a program it shouldn't the responsibility of the program devs to make sure nothing can be changed on the host system to keep the program running.

Saijin-Naib commented 4 years ago

I know I've broken my QGIS install locally by force-upgrading my QT and SIP packages beyond the version shipped with QGIS. A rollback didn't fix it without a full uninstall/reinstall of QGIS with manual deletion of the program directory to ensure complete removal of any left-over files.

You might be able to right your install, but I think it'll be a bit of a challenge.

Isaacson33 commented 4 years ago

@Isaacson33 He means your machine only, most users don't fiddle with qt usually. And since its relying on something on your system I don't think its a fix that can be done, is someone breaks libraries/dependencies of a program it shouldn't the responsibility of the program devs to make sure nothing can be changed on the host system to keep the program running.

Understood, but I haven't 'fiddled' with QT, all I've done is updated it to the latest version as recommended by my distribution. That seems like a fairly normal thing to do, no? If this is the cause of my problem, then absolutely everyone on any rolling-release version of Linux will be affected because they all will have upgraded. That seems like quite a large crowd to just dismiss as "well you shouldn't have fiddled with it".

I don't understand how the whole packaging to repositories thing works, but I would have thought as a bare minimum a little warning that one's application relies on an outdated version of some other application might be in order.

You might be able to right your install, but I think it'll be a bit of a challenge.

Yeah, so I'm gathering. The whole thing strikes me as incredibly odd in this day and age. We seem to be seriously saying that some information buried in the 'about' table of a piece of globally marketed software can, quite normally and acceptably, render your installation broken beyond repair, and we're fine with that, no changes need be made to rectify such a situation.

roya0045 commented 4 years ago

@Isaacson33 Up to now I don't recall many issues related to mismatching qt version to be honest. But think of it that way, the program is compiled and tested using specific versions of many packages, some are more 'outdated' than others due to many fact. When a dependency change its behaviour and bindings are subject to change also and that may break qgis. This is why the program is shipped with a specific version that has been properly tested. It is impossible to future-proof QGIS and this is in part why qgis is offered 'as is' due to those facts.

I hope this clear things up as to why this occurs.

Isaacson33 commented 4 years ago

@Isaacson33 Up to now I don't recall many issues related to mismatching qt version to be honest. But think of it that way, the program is compiled and tested using specific versions of many packages, some are more 'outdated' than others due to many fact. When a dependency change its behaviour and bindings are subject to change also and that may break qgis. This is why the program is shipped with a specific version that has been properly tested. It is impossible to future-proof QGIS and this is in part why qgis is offered 'as is' due to those facts.

I hope this clear things up as to why this occurs.

I understand all that, I really do. It would be impossible for Qgis to remain up to date with all the other applications it depends on.

As far as this being a bug report is concerned, however, - if being based on an outdated version of Qt causes this much damage, and if (presuming I'm no exception) many people will be looking to upgrade to the latest version of QT, then despite Qgis being entirely blameless for being based on an older version, it surely seems advisable now to try and update it as a priority?

This is all presuming that a mismatch is indeed the problem - which it might not be - I can't test it because I can't downgrade to 5.13 to check.

Isaacson33 commented 4 years ago

@gioman

The thread's still got the feedback label. Is there something more you're looking for?

roya0045 commented 4 years ago

@Isaacson33 I would assume that he is waiting for you to fix your setup and report if the error was truly caused by a mismatch or if anyone else can replicate this.

gioman commented 4 years ago

@Isaacson33 I would assume that he is waiting for you to fix your setup and report if the error was truly caused by a mismatch or if anyone else can replicate this.

yeah... I would say the same :)

Isaacson33 commented 4 years ago

OK. As I said, I'm on a rolling release, so that's not possible. I just wasn't sure if there was another way, I may be misinterpreting, but the feedback label say "waiting on the submitter for answers", not just waiting for answers in general, that's why I was concerned you might be waiting for something else from me specifically, rather than just anyone in general.

gioman commented 4 years ago

OK. As I said, I'm on a rolling release, so that's not possible.

I'm also not sure if we support such type of distributions... also I can't test as I don't do Arch (well I guess I could give it a try).

Isaacson33 commented 4 years ago

I'm also not sure if we support such type of distributions

Interesting. Where would it list what type of distributions Qgis supports? I rely on Qgis for work so if it's not going to support rolling-release distributions, I'll have to change my OS (plus, I'd feel very silly indeed if I'd missed a clear instruction to that effect).

also I can't test as I don't do Arch (well I guess I could give it a try).

You won't want to go back! Current issue aside, Manjaro's been great. It will be really disappointing to have to leave.

I've had the opportunity to ask someone else, also on Manjaro to test their system, should hopefully here back from them soon. I'm still concerned that I don't even know if it is a Qt issue or not yet, I just don't have the know-how to know where else to look

Isaacson33 commented 4 years ago

Just to update - if anyone is still following this.

The problem is confined to the KDE Plasma desktop environment. It seems that the QgsExpressionBuilderWidget in Qt is presenting text with kerning, but the text caret (for some reason) is expecting text without kerning. Basically, the text cursor in my image in the OP is exactly where the text would end if it had no kerning.

What I'm totally stumped on, if anyone can help, is why the widget would treat input text with kerning in one desktop environment, but not another.

This could very easily be a KDE problem of course, nothing to do with Qgis, but, checking the widget in Qt designer, it looks like kerning is supposed to be on, so in that sense KDE is getting it right (except the cursor) and the other environments are simply dodging the problem by not having kerning at all.

image

gioman commented 4 years ago

The problem is confined to the KDE Plasma desktop environment.

I use KDE plasma on Ubuntu 18.04 and QGIS 3.10.1 and still can't replicate.

Isaacson33 commented 4 years ago

Which version of Plasma are you on. I'm using 5.17.4, and so are both the other people I've spoken to for whom this is happening, but they're both on Manjaro too, so...

Everyone seems to think it's someone else's problem. I don't know what to try next.

gioman commented 4 years ago

apt-cache policy plasma-desktop plasma-desktop: Installed: 4:5.12.9.1-0ubuntu0.1build1~ubuntu18.04~ppa1

Isaacson33 commented 4 years ago

Thanks. So still could be a Plasma issue, just something introduced at 5.17.

Still seems really odd to me though that Plasma should be having trouble rendering the kerning on just one particular qt widget and seemingly having no trouble with any others.

I created an experimental Qt UI with every text input widget it offers. Every single one (that I was able to test) has the text aligned correctly except QgsExpressionBuilderWidget. It being the only one that's wrong suggests some setting unique to it, but every other desktop environment being fine (including previous versions of Plasma) suggests the DE is at fault.

I'm going to continue to try to modify the QgsExpressionBuilderWidget and see if I can get a working version, maybe I've missed something.

Isaacson33 commented 4 years ago

No joy. I've changed every variable in properties one at a time in the QgsExpressionBuilderWidget. Nothing seems to make any difference whatsoever to the input text. Even if I change the widget font, it only changes the font on the window text, not the expression input text, which seems to be set somewhere else.

nyalldawson commented 4 years ago

Something to test would be to make a little standalone python app which shows a Qscintilla widget (that's what the expression builder is based on). If that app also shows the issue it would indicate that the bug is outside qgis. Are you able to test this?

Isaacson33 commented 4 years ago

Something to test would be to make a little standalone python app which shows a Qscintilla widget (that's what the expression builder is based on). If that app also shows the issue it would indicate that the bug is outside qgis. Are you able to test this?

I don't currently know how to build a python app, nor what a Qscintilla is, but I'll do some reading and try to give it a go.

nyalldawson commented 4 years ago

Try this script

import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.Qsci import QsciScintilla

if __name__ == "__main__":
    app = QApplication(sys.argv)
    editor = QsciScintilla()
    editor.show()
    editor.setText('this is a test')
    app.exec_()

copy that to a local text file and save as test.py, then run with python3 test.py

Isaacson33 commented 4 years ago

Thanks. That would have taken me ages to work out. I've carried out the procedure. Below is a screenshot of the window. No kerning issues, don't know what that means. image

Isaacson33 commented 4 years ago

@nyalldawson

Just wanting to follow up on this. I'm not sure what the results from this test mean. You said...

If that app also shows the issue it would indicate that the bug is outside qgis. Are you able to test this?

...as it doesn't show any issue, should I drop my bug report at KDE?

If I understand correctly, what the test has done is rule out the possibility of a problem with Qscintilla widgets in general, and also shown that they work with my version of Qt perfectly well. So, it seems to me that it can either...

  1. A bug/incompatibility in Qgis to do with the way the widget responds to Qt5.14 and the other DEs just get round it by not using that feature (in which case it's going to be a problem as soon as people start to upgrade).

  2. A bug in KDE Plasma where it's not using some feature in Qt5.14 properly, but only a particular feature that the Qgis expression builder uses which is absent from a normal Qscintilla widget (in which case, I'd need to know what exactly that feature is before pursuing the matter at KDE)

Either way I don't know how best to proceed. I'm not a programmer, but if there's anything further I can do to sort this out, please let me know. Is the QgsExpressionBuilderWidget written in some easily accessible block of code you can point me to. I'd be happy to play around with it and test various permutations, if that would help.

zeddock commented 4 years ago

Hi all!

I see the same issue on mine. This machine is on a Stable Manjaro KDE.

I am somewhat new, but I may be able to change things for testing to help find the issue. Please let me know what is needed? Keep in mind I do work on this machine so I don't want to go too far off the path as we test.

Isaacson33 commented 4 years ago

This issue is still saying that more feedback is needed. I'm not sure what more we can provide.

The QgsExpressionBuilderWidget doesn't kern properly on the latest version of KDE Plasma. I'd be happy to play around with the widget itself, but I don't know where it would be in the Qgis source code (not that I'd know what I was looking for, but in the absence of anyone more knowledgeable, I'd give it a go). I could also send it to KDE for them to have a look at.

Anyone know where that bit of code is?

roya0045 commented 4 years ago

The issue seem to be related to manjaro KDE, somewhat similar to https://github.com/qgis/QGIS/issues/33817#issuecomment-575611941 I guess.

@nyalldawson in the test that you provided the text was added by the python command, but could it be possible that text entered by user input is treated distinctly in that distro?

Isaacson33 commented 4 years ago

could it be possible that text entered by user input is treated distinctly in that distro?

I tried entering text too. It showed up without error. It seems confined to the expression builder widget.

MaelREBOUX commented 4 years ago

Hello. I confirm there is something that happens that breaks all SQL Queries.

In my case I'm big user of SQL source for layers (to make controls for examples). When re-opening the SQL window : QGIS does not respect anymore cartdrige returns / line returns. So all the structured query is transformed in an unique line. When you have comments : it brokes the quey and you get an error at re-opening :

Capture d’écran de 2020-02-15 09-35-26

Broken SQL :

Capture d’écran de 2020-02-15 09-47-01

It shoud be like this :

Capture d’écran de 2020-02-15 09-37-42

I met this very very very annoying bug (many time wasted) on :

gioman commented 4 years ago

I met this very very very annoying bug (many time wasted) on :

* Ubuntu 19.10 (disco) + QGIS 3.4.15-Madeira (rev code [e83d02e](https://github.com/qgis/QGIS/commit/e83d02e2747dd3e4e6940d9d720fee80febe78d9))

* Mac OS X Mojave  + QGIS 3.4.14-Madeira (rev code [bug in the url])

@MaelREBOUX

I can't replicate on 3.10.2 on Ubuntu 18.04 and 3.4.15 on macOS Catalina. But I'm not sure if I followed the exact steps that you are following. In my case I opened/saved/reopened a SQL query from a QGIS project.

MaelREBOUX commented 4 years ago

In my case I opened/saved/reopened a SQL query from a QGIS project.

It is the test.

I only use LTR versions. So no QGIS 3.10 for me. I will test the 3.14.15 as soon as possible.

Isaacson33 commented 4 years ago

@MaelREBOUX

I think you're experiencing a slightly different problem so it might be worth opening a new issue.

I use DB Browser for dealing with some of my sqlite databases and it too restructures SQL queries as one long line, so it might be a generic sqlite thing.

Either way, it sounds very different from the kerning problem this issue relates to, so you might get a more focussed response if you made a new issue for it.

Isaacson33 commented 4 years ago

@nyalldawson

I've now got 3.12 in the Manjaro repositories. It's compiled against Qt 5.14 (which I'm running)

QGIS version 3.12.0-București QGIS code branch Release QGIS code branch.3 Compiled against Qt 5.14.1 Running against Qt 5.14.1 Compiled against GDAL/OGR 3.0.4 Running against GDAL/OGR 3.0.4 Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1 Compiled against SQLite 3.31.1 Running against SQLite 3.31.1 PostgreSQL Client Version 12.2 SpatiaLite Version 4.3.0a QWT Version 6.1.4 QScintilla2 Version 2.11.4 Compiled against PROJ 6.3.1 Running against PROJ Rel. 6.3.1, February 10th, 2020 OS Version Manjaro Linux Active python plugins clipper; refFunctions; quick_map_services; TomBio; MetaSearch; db_manager; processing

The problem still hasn't been resolved, so it's not caused by a mismatch in Qt versions. There's something wrong with the QScintilla box on Plasma, but it's not just a problem between KDE Plasma and Qscintilla because the mock Qscintilla box I made worked perfectly.

I think that narrows it down to a problem specifically with the Qgis widget, so unless there's anything more you need, we should remove the feedback label?

MaelREBOUX commented 4 years ago

I upgraded to QGIS 3.10 (new LTR) under Ubuntu and I still meet the problem.

Ubuntu 19.10 (disco) + QGIS 3.4.15-Madeira (rev 0e1f846438)

Isaacson33 commented 4 years ago

@gioman @nyalldawson

Could one of you please remove the 'feedback' label. Unless I've missed something, this issue isn't waiting for any feedback. It's been checked on the latest version and against a consistent QT version, Qscintilla itself has been tested in the relevant Desktop Environment - so it's neither the version, nor Qt, nor the DE's handling of QScintilla that's at fault.

What I need, to progress this issue further, is someone who knows what might be special about Qgis's expression widgets which sets them apart from normal QScintilla widgets. I'm already going to need a considerable amount of good fortune that someone with that level of Qgis knowledge happens to stumble on this thread, having it look like the issue is still awaiting feedback isn't going to help.

To anyone who does know... I realise this issue is going to be of no concern whatever to anyone not using an Arch/Plasma combination, but for those that do it literally renders all expression-creation function unuseable. I'm happy to continue to troubleshoot the problem, and perhaps take it further with KDE, but at the moment, the developers at KDE are just pointing to the fact that Plasma handles QScintilla widgets flawlessly (which it does - see above). As far as they're concerned, there's no issue to solve. I need to know what distinguishes the expression builder widgets from normal QScintilla widgets. If anyone could isolate, or let me know where that code is, I could have a go a troubleshooting it myself.

gioman commented 4 years ago

Could one of you please remove the 'feedback' label. Unless I've missed something, this issue isn't waiting for any feedback.

@Isaacson33 we use the "feedback" label also to remember us/everyone that the issue needs more investigation. The issue is not confirmed on the major platforms (including supported Linux distributions like Ubuntu) so the source if the issue still needs to be pinpointed.

MaelREBOUX commented 4 years ago

Hello.

New test under OS X Mojave with the new LTR 3.10.5 version (build 984615fe1e).

The SQL code is still broken but in a different way : comments are deleted and the query is linearized.

Creation :

Capture d’écran 2020-04-20 à 14 42 38

Then after saving, quit and reopen QGIS :

Capture d’écran 2020-04-20 à 14 43 26

From my point of view : it still not as well as before.

gioman commented 4 years ago

@MaelREBOUX yours seems a different issue. Please file it in a separate ticket.

zeddock commented 4 years ago

I hit this issue again in the last few weeks. Is there any movement at all?

Thanx!

On Mon, Apr 20, 2020 at 8:52 AM Giovanni Manghi notifications@github.com wrote:

@MaelREBOUX https://github.com/MaelREBOUX yours seems a different issue. Please file it in a separate ticket.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS/issues/33581#issuecomment-616532636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKYJWJUUARMTNZTO3JCCSLRNRASNANCNFSM4KCBABPQ .

gioman commented 4 years ago

I hit this issue again in the last few weeks. Is there any movement at all?

@zeddock what OS?

zeddock commented 4 years ago

Manjaro KDE

On Tue, Apr 21, 2020 at 4:20 AM Giovanni Manghi notifications@github.com wrote:

I hit this issue again in the last few weeks. Is there any movement at all?

@zeddock https://github.com/zeddock what OS?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS/issues/33581#issuecomment-617029916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKYJWOSYDYSNQH2SPAVDEDRNVJLLANCNFSM4KCBABPQ .

aldeano commented 4 years ago

I also have this issue. Arch/Plasma

QGIS version 3.12.1-București QGIS code branch Release QGIS code branch.3
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.0.4 Running against GDAL/OGR 3.0.4
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.2 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.1 Running against PROJ Rel. 6.3.1, February 10th, 2020
OS Version Arch Linux

I guess the issue is related to QgsCodeEditor which seems to handle those fields.

Isaacson33 commented 4 years ago

I guess the issue is related to QgsCodeEditor which seems to handle those fields.

I thought so too - given that the same problem exists in Expression, HTML, and SQL Editors, but does not exist in Qscintilla alone. It's only a small file, there's a limited amount of possible issues within that, so although I know almost noting about how all this works (so you'll have to forgive my ignorance) in the absence of any more knowledgeable help, I tried making a few changes to my qgscodeeditor.h file in /usr/include/qgis. I had a look at Qt variable settings online and made a few (barely)educated guesses. Nothing changed. So in a fit of annoyance, I deleted qgscodeeditor.h entirely (well, renamed it qgscodeeditor.h~, I wasn't that cross!). It still made no difference at all! Obviously the file doesn't work the way I thought it might. I presume it somehow sets something at installation, which then can't be changed?

Viskovitz commented 4 years ago

Same issue here on OpenSuse Thumbleweed using KDE Plasma. All the text boxes look like in the picture when I write an expression.

imagen