Bug report #7340
GRASS Shell cursor misbehaving
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||linux, OSX||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16322|
In the GRASS Shell the cursor misbehaves badly. Typing a single character causes it to be half-obscured by the solid black cursor. With longer commands, the cursor continues to "lag" the typing, with the last two or more characters typed being invisible. Moving the cursor with the arrow keys results in the character the cursor is on showing correctly, but preceding characters being outright hidden.
I would say the behaviour renders the GRASS Shell in QGIS more or less unusable.
I am running Kubuntu 12.10, with QGIS installed from the ubuntugis PPA.
QGIS About page:
QGIS code revision
Compiled against Qt
Running against Qt
Compiled against GDAL/OGR
Running against GDAL/OGR
PostgreSQL Client Version
#5 Updated by Radim Blazek over 6 years ago
I cannot reproduce it on Debian with Qt 4.6.3.
The GRASS shell is using copy of http://qtermwidget.sourceforge.net project which is abandoned. QTermWidget was based on Konsole: https://projects.kde.org/projects/kde/applications/konsole. The right solution would probably be to update GRASS shell to use Konsole project but that is most probably a lot of work and it could introduce more problems than this issue.
Try to find if it is only refresh problem, i.e. if some characters are not displayed correctly try to resize the window, minimize and restore etc.
#6 Updated by Radim Blazek over 6 years ago
The problem seems to be described here https://bugs.kde.org/show_bug.cgi?id=215937. It seems to be due to wrong font metrics or something like that. I am able to reproduce it changing
font.setPointSize( 10 );
font.setPointSize( 20 );
in src/plugins/grass/qtermwidget/qtermwidget.cpp. The font size in shell is not changed but cursor is shifted. The shift is fixed and does not depend on the length of the string typed.
#9 Updated by Radim Blazek over 6 years ago
- QTermWidget tries to set via TerminalDisplay::setVTFont font with family "Monospace"
- setVTFont() calls QWidget::setFont() but it fails, the font is forced from somewhere else
- if default font used for the widget is not monospace, width calculations do not work (even it seems that non monospace should also be supported, see _fixedFont flag) and result is cursor shift
- the problem seems to appear especially on GNOME
- default GNOME 3 font-name is "Cantarell 11" and that is applied also to GRASS shell
- if I change the font in gconf: org > gnome > desktop > interface > font-name to "Courier", the shift disappeares
I'll try to find why it is not possible to set the font on the widget.
#12 Updated by Radim Blazek over 6 years ago
QWidget::setFont() does not guarantee to really change the font, I added
setStyleSheet( "font-size: 10pt; font-family: Monospace;" )
on the TerminalDisplay but it has some side effects like setting background to black so that some more changes were necessary.
I have tested on Gnome where cursor was shifted before and it works.
I have also set black on white scheme.