17. FAQ and known problems

17.1. Known client problems relating directly to CamCOPS

17.2. Known client problems relating to third-party software

17.2.1. Qt: QLabel height

It seems likely that the Qt function QLabel::heightForWidth() sometimes gets heights wrong for some stylesheets, leading to excessive vertical height. See labelwordwrapwide.cpp (and to see the problem: try the demo QuMcqGrid). I think I’ve largely compensated for this, though.

17.2.2. Spinboxes are relatively poor for entering numbers

The spinbox numerical entry fields are weak in terms of NULL values. This is an intrinsic weakness in Qt’s QSpinBox and QDoubleSpinBox that works like this:

  • if you send a null value to a QSpinBox, it’ll typically show its minimum value; for example, for the range 5–10, if you send it 0, it’ll show 5.

  • If you then delete the “5” and retype “5”, it doesn’t generate any “changed” signals, either via its string or its integer signals. Therefore, this change isn’t detected by the QuSpinBoxInteger or QuSpinBoxDouble framework. You have to delete it, replace it with something else, and re-enter it, for the change to be noticed and the yellow NULL indicator to disappear.

There’s no clear way round this, except that QuLineEditInteger and QuLineEditDouble do a better job.

17.2.3. QuPickerInline is visually a bit suboptimal

The width requirements of QuPickerInline are a bit much, but then it’s also a bit duff visually compared to QuPickerPopup.

17.2.4. Qt: ScrollMessageBox scrolling under Android

Under Android, ScrollMessageBox scrolls with multi-finger gestures but not with single-finger swipes, even though the single-finger gestures work fine elsewhere. This also varies with device, e.g. Asus Transformer Prime TF201 requires a two-finger swipe in ScrollMessageBox, whereas Samsung Galaxy S5 (?) provides a one-finger swipe. See my thoughts in uifunc::applyScrollGestures(). See also https://forum.qt.io/topic/62385/one-finger-swipe-gestures and https://bugreports.qt.io/browse/QTBUG-40461.

17.2.5. Qt: cursor positioning bug under Android

Sometimes, copy/paste selection cursors appear on screen far removed from the text they relate to. This is a Qt bug; see https://bugreports.qt.io/browse/QTBUG-58503. Related Qt bugs include QTBUG-34867, QTBUG-58700.

Also potentially related to this: when LogBox or LogMessageBox are used with word_wrap = true on Android, the touch-to-scroll goes wrong. These classes use a QPlainTextEdit.

17.2.6. Qt: expand/collapse arrows in tree views are too small on high-DPI screens

The arrow markers for the diagnostic trees don’t scale with DPI. See discussion in diagnosticcodeselector.cpp; the problem is that it’s not obvious how to set them programmatically. In fact, this is very hard indeed; see also my attempts in TreeViewProxyStyle and TreeViewControlDelegate, neither of which can make the changes where they’re needed. Reported as a bug: https://bugreports.qt.io/browse/QTBUG-62323.

17.2.7. Potential Qt performance bug; not recently verified; may have gone

Sometimes there is a delay after clicking on a QuBoolean with an image, like the picture-naming in the ACE-III. The delay occurs whether you click the boolean indicator (with its “you are touching me” shading) or the image. It seems to occur only if the main window is not maximized. The delay is in calling AspectRatioPixmap::mousePressEvent, for example. Using #define DEBUG_CLICK_TIMING shows that the delay is not because the widget’s overridden sizeHint (etc.) code is being called. I’m not sure that this is a problem in my code. Not retested recently; other things have also improved performance (e.g. threaded database writes).

17.2.8. VerticalScrollArea layout

VerticalScrollArea is nearly perfect. I’m unclear if any residual minor error relates to VerticalScrollArea itself, or to misreporting of ideal height by e.g. GridLayoutHfw. (Example: PDSS [with no task strings]?) (Note: it’s sometimes worth trying to un-maximize then maximize the window; the error can sometimes go away.)

Update 2017-07-09: I think this is fixed now.

17.3. Known server problems relating directly to CamCOPS

17.4. Known server problems relating to the surrounding web server framework

17.4.1. “Proxy error” or “Website unavailable” whilst downloading big files through Apache

If you perform a very slow operation, creating a very large file to download, the time it takes CamCOPS to respond might exceed the timeout set by Apache. The Apache logs might show an error like “Internal error: proxy: error reading status line from remote server”.

The first thing to check is the gunicorn configuration: to your camcops serve_gunicorn command, try setting the server’s GUNICORN_TIMEOUT_S parameter to e.g. 300 (an increase from the default of 30 s).

This might just change the Apache error to “The timeout specified has expired: proxy: error reading…”, in which case you should also edit the Apache configuration file to add e.g. ProxyTimeout 300.

Then restart CamCOPS and Apache.

17.5. Known server problems relating to other third-party software

17.5.1. Warnings during “camcops merge_db” relating to the “mysqldb” driver and UTF-8

If, during a camcops merge_db command using the mysqldb driver (a database URL like mysql+mysqldb://…), you get errors like this:

2017-08-25 22:27:23.234 cardinal_pythonlib.sqlalchemy.merge_db:INFO: Processing table 'blobs' via ORM class <class 'camcops_server.cc_modules.cc_blob.Blob'>
/home/rudolf/dev/venvs/camcops/lib/python3.5/site-packages/sqlalchemy/engine/default.py:504: Warning: (1300, "Invalid utf8 character string: '89504E'")
    cursor.execute(statement, parameters)
/home/rudolf/dev/venvs/camcops/lib/python3.5/site-packages/sqlalchemy/engine/default.py:504: Warning: (1300, "Invalid utf8 character string: 'FFD8FF'")
    cursor.execute(statement, parameters)

… or like this, with the charset set to ‘utf8mb4’ for the database and SQLAlchemy URL:

2017-08-25 22:38:36.628 cardinal_pythonlib.sqlalchemy.merge_db:INFO: Processing table 'blobs' via ORM class <class 'camcops_server.cc_modules.cc_blob.Blob'>
/home/rudolf/dev/venvs/camcops/lib/python3.5/site-packages/sqlalchemy/engine/default.py:504: Warning: (1300, "Invalid utf8mb4 character string: '89504E'")
    cursor.execute(statement, parameters)
/home/rudolf/dev/venvs/camcops/lib/python3.5/site-packages/sqlalchemy/engine/default.py:504: Warning: (1300, "Invalid utf8mb4 character string: 'FFD8FF'")
    cursor.execute(statement, parameters)

… then this is likely a mysqldb bug. Potentially related problems:

The problem goes away using “pymysql” rather than “mysqldb”, so try this:

DB_URL = mysql+pymysql://username:password@

17.6. Hardware FAQs: Sony Xperia Z2 tablet

17.6.1. The charger doesn’t work

Plug the prongs of the “international” adapter (the one with the USB socket) sideways into the UK plug (i.e. into the neutral and live pins, not the earth). The prongs fit at least three ways, but only that way works.

17.6.2. Where’s the USB port?

If the tablet is facing you in landscape mode (with “Sony” visible at the top left), it’s on top, under a cover (just to the right of the cover labelled “micro SD”). Lever it up with a fingernail.

17.7. Android FAQs

17.7.1. What API levels are offered by different Android versions?

As per https://source.android.com/setup/start/build-numbers and https://en.wikipedia.org/wiki/Android_version_history:



API level

Release date

CamCOPS status


Jelly Bean



Lowest API theoretically supported by Qt 4, though Qt 5.11 doesn’t compile. Too old for CamCOPS (based on 4.4.x failure).


Jelly Bean



Too old for CamCOPS (based on 4.4.x failure).


Jelly Bean



Too old for CamCOPS (based on 4.4.x failure).





Fails as of 2018-07-16 (client v2.2.4).















Supported; tested 2018-07-16 (client v2.2.4).





Untested; should be fine.





Untested; should be fine.





Untested; should be fine.





Untested; should be fine.

17.7.2. I can’t find the beta version of CamCOPS on Google Play

To refresh Settings ‣ Apps ‣ Google Play services ‣ Manage space ‣ Clear all data.

17.7.3. How to remove a Google account from an Android device

Settings ‣ [Accounts] Google ‣ click the account ‣ Menu (⋮) ‣ Remove account

17.7.4. How to upgrade Android

  • On Android 4.4.2: Settings ‣ About tablet ‣ Software update ‣ System.

  • On a Sony Xperia Z2 tablet (model SGP511) that’s not offering an upgrade (e.g. attempting to upgrade from Android 4.4.2 in 2018-07):

    1. Check storage space is OK 1.

    2. If that doesn’t help, run Sony’s “Xperia Companion” software 2 from a Windows/Mac PC (or virtual machine 3), and run a “Software update” from there. It may be easier from a physical machine.







Check that your user is in the vboxusers group to access host USB devices from a VirtualBox guest; see https://unix.stackexchange.com/questions/129305/how-can-i-enable-access-to-usb-devices-within-virtualbox-guests