- Status Closed
- Percent Complete
- Task Type Bug Report
- Category QCAD (main)
-
Assigned To
andrew - Operating System All
- Severity Low
- Priority Very Low
- Reported Version 3.2.2
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
Opened by kazmer - 22.08.2013
Last edited by andrew - 27.08.2013
FS#902 - Reduced font selection not working as expected
QCAD GPL Git reba26f7a, completely new configuration (seemingly important); also happens with the binary QCAD 3.2.2 download.
I wanted to use the Standard CAD font and the Standard CAD font only. To achieve that, in Application Preferences→Draw→Text, I ticked “Use reduced selection of fonts” and hit “Uncheck all”.
My expectation is that in this case the Text tool lists only the Standard font.
What actually happens is that the “Standard” font stays disabled, is deselected, and the Text tool lists every font I have installed on my system (system-wide fonts only, TTF and whatever else), and none of the CAD fonts bundled with QCAD in fonts/ (not even Standard).
There seems to be some inconsistency in the handling of “Standard” – it is apparently meant to be selected no matter what, and its checkbox disabled so the end user isn’t even able to de-select it. What actually happens is that the Text preferences “Check all”/”Uncheck all” buttons do affect its selected state.
At this time, the saved configuration (in ~/.config/QCAD3) contains the following entries:
[Text] ReducedFontList=@Invalid() UseReducedFontList=true
Note that at this point the Text preferences screen indicates that the Standard entry is disabled and not selected, see fontsel-1.png
So I did the following as an experiment:
--- a/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js
+++ b/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js
@@ -58,7 +58,7 @@ TextPreferences.initPreferences = function(pageWidget, calledByPrefDialog, docum
// always check 'standard':
if (item.text().toLowerCase()==="standard") {
item.setCheckState(Qt.Checked);
- flags = new Qt.ItemFlags(item.flags() & ~Qt.ItemIsEnabled);
+ // flags = new Qt.ItemFlags(item.flags() & ~Qt.ItemIsEnabled);
}
if (list.contains(item.text())) {
item.setCheckState(Qt.Checked);
At this point, the Text preferences screen has the “Standard” font enabled and still not selected, see fontsel-2.png
The saved configuration file still contains an invalid entry for the font list:
[Text] ReducedFontList=@Invalid() UseReducedFontList=true
(This is probably is as intended, since the list is not supposed to be empty, but it really is now.)
Now let’s select “Standard” in the Text preferences screen, Apply, and undo the above change to TextPreferences.js.
At this point, the configuration file contains what seems correct:
[Text] ReducedFontList=@Variant(\0\0\0\t\0\0\0\x1\0\0\0\n\0\0\0\x10\0S\0t\0\x61\0n\0\x64\0\x61\0r\0\x64) UseReducedFontList=true
The font list on the Text preferences screen has changed as seen on fontsel-3.png.
Note that now the “Standard” font is again disabled, but now it is selected.
At this point, the Text tool behaves as expected: there is only one entry, the “Standard” CAD font.
Summary: I see two related issues:
- If I tick “Use reduced selection of fonts” for the first time, “Standard” starts as being unselected, and it can not as such be selected by ticking its checkbox, because it is disabled
- “Check all” does select it, but then “Uncheck all” also unselects it, whereas it should be immutable to these operations (and be selected in the first place).
What *can* be done is “Check all”, then manually unselect every other font one by one, but this is probably not how it was intended to work.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
This seems to be a relatively clean way of making it work as expected:
diff --git a/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js b/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js index 8f183f5..287f33d 100644 --- a/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js +++ b/scripts/Edit/AppPreferences/TextPreferences/TextPreferences.js @@ -42,6 +42,16 @@ TextPreferences.initPreferences = function(pageWidget, calledByPrefDialog, docum var cadList = RFontList.getNames(); lReducedList.addItems(cadList); + // select Standard font and mark it immutable + for (var row = 0; row<lReducedList.count; row++) { + var item = lReducedList.item(row); + if (item.text().toLowerCase()==="standard") { + item.setCheckState(Qt.Checked); + item.setFlags(item.flags & ~(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)); + break; + } + } + // add system fonts to list: var fontDb = new RFontDatabase(); var families = fontDb.families(); @@ -55,10 +65,8 @@ TextPreferences.initPreferences = function(pageWidget, calledByPrefDialog, docum for (var row = 0; row<lReducedList.count; row++) { var item = lReducedList.item(row); var flags = new Qt.ItemFlags(item.flags() | Qt.ItemIsUserCheckable); - // always check 'standard': if (item.text().toLowerCase()==="standard") { - item.setCheckState(Qt.Checked); - flags = new Qt.ItemFlags(item.flags() & ~Qt.ItemIsEnabled); + continue; } if (list.contains(item.text())) { item.setCheckState(Qt.Checked); @@ -78,6 +86,9 @@ TextPreferences.initPreferences = function(pageWidget, calledByPrefDialog, docum bUncheckAll.clicked.connect(function() { for (var row = 0; row<lReducedList.count; row++) { var item = lReducedList.item(row); + if (item.text().toLowerCase()==="standard") { + continue; + } item.setCheckState(Qt.Unchecked); } });Thanks for the fix.
I ended up using this slightly modified fix:
TextPreferences.initPreferences = function(pageWidget, calledByPrefDialog, document) { var cbUseReducedList = pageWidget.findChild("UseReducedFontList"); var lReducedList = pageWidget.findChild("ReducedFontList"); var bCheckAll = pageWidget.findChild("CheckAll"); var bUncheckAll = pageWidget.findChild("UncheckAll"); lReducedList.enabled = cbUseReducedList.checked; // add CAD fonts to list: var cadList = RFontList.getNames(); lReducedList.addItems(cadList); // add system fonts to list: var fontDb = new RFontDatabase(); var families = fontDb.families(); lReducedList.addItems(families); var list = RSettings.getValue("Text/ReducedFontList", []); if (isNull(list)) { list = []; } for (var row = 0; row<lReducedList.count; row++) { var item = lReducedList.item(row); var flags = new Qt.ItemFlags(item.flags() | Qt.ItemIsUserCheckable); // always check 'standard' and make it immutable: if (item.text().toLowerCase()==="standard") { item.setCheckState(Qt.Checked); flags = new Qt.ItemFlags(item.flags() & ~(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)); } else if (list.contains(item.text())) { item.setCheckState(Qt.Checked); } else { item.setCheckState(Qt.Unchecked); } item.setFlags(flags); } bCheckAll.clicked.connect(function() { for (var row = 0; row<lReducedList.count; row++) { var item = lReducedList.item(row); item.setCheckState(Qt.Checked); } }); bUncheckAll.clicked.connect(function() { for (var row = 0; row<lReducedList.count; row++) { var item = lReducedList.item(row); if (item.text().toLowerCase()==="standard") { continue; } item.setCheckState(Qt.Unchecked); } }); lReducedList.setProperty("Loaded", true); };