PDA

View Full Version : Qt5 developed app doesn't display correctly using Cinnamon desktop in VirtualBox



te777
1st July 2015, 18:32
I have an app I've developed in Qt 5.3.1 that doesn't display data in output text boxes when using the Linux Cinnamon desktop in VirtualBox with 3D acceleration enabled in the display settings for the virtual machine.

It does this when using the Cinnamon desktop in any Linux Distro (I've tried Cinnamon with Linux Mint, Ubuntu and Debian). The regular Unity desktop in Ubuntu and the Xfce desktops in both Linux Mint and Debian have no problem. Just Cinnamon.

I don't know if this is a Cinnamon, VirtualBox or Qt problem. Months ago I registered a bug with the Cinnamon folks but I never saw a fix, or that the problem was replicated anywhere. If I disable 3D acceleration for any of the Cinnamon virtual machines in VirtualBox the problem doesn't happen.

I'm posting here because maybe some Qt developers have seen similar problems with Cinnamon in either VirtualBox, or a native Linux machine.

Any comments or replies would be welcome. Thanks in advance for any.

wysota
1st July 2015, 22:28
What kind of app are we talking about?

te777
1st July 2015, 23:59
It's called Lottery Analyzer Expert QL: it can be downloaded at http://tcesoftware.webs.com., follow the link to Linux Downloads.

It's free. My main versions are Windows, but I have both a 32 bit and 64 bit version for Linux developed in Qt 5.3.1. I hope the link I posted is OK. It's a free application, though not open source (because of the nature of the subject).

It does various analyses on the Powerball and Mega Millions lottery games. I developed the programs out of curiosity of how to do it, and offering them for free for all the very useful free software I've used over the years. Again, I hope posting the link is OK. I just want someone to try my program and see if they can replicate the problem in any environment.

Just double click on either Lottery_32 (32 bit) or Lottery_64 (64 bit) in the folder created by downloading and unzipping the tar.gz. Then choose one of the analyze buttons or "drawn" buttons after entering the number of draws to sort. If it runs correctly data will fill the text boxes for the game chosen to sort the totals of. The problem will show if the text boxes are empty except for the last row.

te777
2nd July 2015, 07:07
The VirtualBox issue post is here:

https://forums.virtualbox.org/viewtopic.php?f=3&t=68650

The Cinnamon issue post is here:

https://github.com/linuxmint/Cinnamon/issues/4389

In case anyone wants to add any replies in replicating the problem in Cinnamon either in VirtualBox or a native Linux machine.

wysota
2nd July 2015, 08:07
I was rather asking whether it is a widget based app, Qt Quick or Graphics View :)

te777
2nd July 2015, 09:01
Widget based I guess. I just created text boxes and my app outputs to them.

wysota
2nd July 2015, 09:07
Is the text missing only in some of the widgets? Do these include input widgets? Have you tried setting a different font (size/family)?

te777
2nd July 2015, 10:23
The data doesn't output to the text box widgets. It's just using the system font now I think. I'll try playing with that and see if that makes a difference. I'll report back. Thanks for helping.

Added after 58 minutes:

Changing fonts doesn't seem to help. The text boxes use San Serif Medium 9. They're QTextEdit text boxes that I use for output. Maybe that's problem. I have one set of text boxes (4 rows of 17) used for Powerball and another set (4 rows of 20) used for Mega Millions. The data only displays on the last row for each. The other text boxes are left blank when they should have data in them.

wysota
2nd July 2015, 10:34
What if you place text on QLabel? What about QLineEdit widgets? What about menus?

te777
2nd July 2015, 15:46
I'm in the process of changing all the QTextEdit boxes to QLineEdit boxes. I'll let you know how it goes.

wysota
2nd July 2015, 16:17
Change just one or run one of numerous Qt examples that already contain those widgets.

te777
2nd July 2015, 19:03
I changed all the QTextEdit widgets to QLinEdit widgets. No help. The code that gets run does a sort procedure first in the class I'm using (one class for Powerball and one for Mega Millions). Then an output procedure gets called that passes the references to the widgets to that output procedure from mainwindow.cpp. I tried putting qApp->ProcessEvents() in different places in the button click procedures that call the sort and output sort in the class I'm using, but with no help so far. It's as if data isn't getting flushed to the widgets properly with 3D acceleration enabled.

The button click procedure code is below:


void MainWindow::on_pushButton_clicked()
{

int range = 1;

bool dooutput;

int drawstosort;

bool ok;


Powerball* p = new Powerball();

p->readnums();

if (p->inputfilefound) {

dooutput = p->sort_input_validate( ui->textEdit_5 );

if (dooutput) {

drawstosort = ui->textEdit_5->toPlainText().toInt(&ok,10);

p->sort(drawstosort);

// qApp->processEvents();

p->outputsort (ui->lineEdit , ui->lineEdit_2 , ui->lineEdit_4 , ui->lineEdit_3 ,
ui->lineEdit_8 , ui->lineEdit_6 , ui->lineEdit_5 , ui->lineEdit_7 ,
ui->lineEdit_13 , ui->lineEdit_10 , ui->lineEdit_9 , ui->lineEdit_12 ,
ui->lineEdit_11 , ui->lineEdit_14 , ui->lineEdit_16 , ui->lineEdit_15 ,
ui->lineEdit_17 , ui->lineEdit_29 , ui->lineEdit_21 , ui->lineEdit_20 ,
ui->lineEdit_26 , ui->lineEdit_23 , ui->lineEdit_31 , ui->lineEdit_34 ,
ui->lineEdit_32 , ui->lineEdit_19 , ui->lineEdit_22 , ui->lineEdit_33 ,
ui->lineEdit_18 , ui->lineEdit_24 , ui->lineEdit_29 , ui->lineEdit_27 ,
ui->lineEdit_25 , ui->lineEdit_30 , ui->lineEdit_58 , ui->lineEdit_37 ,
ui->lineEdit_66 , ui->lineEdit_44 , ui->lineEdit_46 , ui->lineEdit_63 ,
ui->lineEdit_47 , ui->lineEdit_32 , ui->lineEdit_39 , ui->lineEdit_41 ,
ui->lineEdit_49 , ui->lineEdit_55 , ui->lineEdit_40 , ui->lineEdit_56 ,
ui->lineEdit_52 , ui->lineEdit_57 , ui->lineEdit_43 , ui->lineEdit_61 ,
ui->lineEdit_54 , ui->lineEdit_68 , ui->lineEdit_50 , ui->lineEdit_35 ,
ui->lineEdit_59 , ui->lineEdit_67 , ui->lineEdit_60 , ui->lineEdit_38 ,
ui->lineEdit_62 , ui->lineEdit_48 , ui->lineEdit_45 , ui->lineEdit_53 ,
ui->lineEdit_36 , ui->lineEdit_51 , ui->lineEdit_64 , ui->lineEdit_65 ,
range
);
}
}

qApp->processEvents();


delete p;
}

Then the class does the sort and output using the widgets passed to the output procedure.

wysota
2nd July 2015, 19:11
Doing random things will not really help. If text is not painted in a widget then processing events will not help in any way. You need to determine whether the problem is with fonts or something else. Check what happens if you try selecting some text. My nose tells me your problem has something to do with fontconfig. It would be wise to try and reproduce the problem in a different environment (e.g. differently configured VM, different distro, etc.).

te777
2nd July 2015, 20:34
When I deploy the app to any Linux VM in VirtualBox with 3D accleration, with the Cinnamon desktop, the problem occurs. I tried compiling on Linux Mint Xfce to see if that makes a difference: it doesn't. Only when deployed to Cinnamon desktops (tried with Cinnamon in Ubuntu, Linux Mint and Debian).

Here's the Cinnamon issue post with them:

https://github.com/linuxmint/Cinnamon/issues/3617

wysota
2nd July 2015, 20:39
What happens if you run your app without Cinnamon, e.g. with bare X?

te777
2nd July 2015, 20:41
The app works fine. In both Linux Mint and Debian Xfce, and in Ubuntu. I guess I could try some other distros too. Care to suggest any. The app used to work fine in Cinnamon until VirtualBox version 4.3.18. I guess I could try an older version of VirtualBox to to see if the problem occurs.

wysota
2nd July 2015, 20:43
No, you misunderstood me. Use your virtual machine, just without Cinnamon -- shut down the display manager, login to the console, run X without any desktop environment and start your app with DISPLAY=:0.

te777
2nd July 2015, 20:45
How do you do that?

anda_skoa
2nd July 2015, 21:09
You could try forcing a certain Qt widget style to be used.
The problem sounds like it might be caused by different widget styles being used in different environments, or the same widget style picking up different settings depending on environment.

E.g. a qt specific style (plastique for Qt4, fusion for Qt5), or an explicit foreign style (windows)

Cheers,
_

wysota
3rd July 2015, 07:56
How do you do that?

Ctrl+Alt+F1, login, sudo service sddm stop (or lightdm, depending what your system is using), X &, Ctrl+Alt+F1, DISPLAY=:0 yourapp

te777
3rd July 2015, 11:02
Ctrl+Alt+F1, login, sudo service sddm stop (or lightdm, depending what your system is using), X &, Ctrl+Alt+F1, DISPLAY=:0 yourapp

I had stop mdm service. After entering "X &" then screen is just blank. Then if I choose Ctrl+Alt+F1 it says "Loading extension GLX" and just sits there.

Edit: I then just hit Return and got prompt. Then cd to my app directory, then DISPLAY=:0 ./myapp. It says failed to load magic3 and vboxvideo.

wysota
3rd July 2015, 11:18
Does Alt+F7 show a gray screen with a cursor?

You can also try putting the full path to your application in ~/.xinitrc and restart your desktop session as usual. This should launch your app instead of DE. Just remember to remove the file afterwards (using the console) so that next time you start X your desktop gets loaded.

te777
3rd July 2015, 17:18
Alt+F7 doesn't show anything. I guess it can't load some drivers out of a display manager, particularly vboxvideo, in VirtualBox. But my app works fine in other desktops, but not Cinnamon. I guess that tells me it's either a Cinnamon or VirtualBox problem. Seems like the problem started with VBox 4.3.18. I'm using VBox 5.0.0 RC2 now.

wysota
3rd July 2015, 17:49
Alt+F7 doesn't show anything. I guess it can't load some drivers out of a display manager, particularly vboxvideo, in VirtualBox. But my app works fine in other desktops, but not Cinnamon. I guess that tells me it's either a Cinnamon or VirtualBox problem. Seems like the problem started with VBox 4.3.18. I'm using VBox 5.0.0 RC2 now.

As far as I understand, you have only tested your app with a single Cinnamon installation. I don't think that's enough to assume Cinnamon is to blame. Applications usually don't care about desktop environments they run in.

te777
3rd July 2015, 17:59
I've tried Cinnamon with Ubuntu, Linux Mint and Debian, all with the same problem. The problem doesn't occur in Unity Ubuntu, Linux Mint Xfce or Debian Xfce. And I've tested on other distros as well, including: Fedora 18, openSuse 12.3, and Mageia 2, with no problems. My gut tells me it's a VirtualBox or Cinnamon problem, or possibly even a Qt problem. One of those 3. I've posted bug reports with those 3.

te777
4th July 2015, 01:20
Update: I tried my app with the latest Fedora (Xfce) and Mageia (gnome). The Fedora had no problems, but the Mageia had the problem with gnome desktop. I installed the Xfce desktop on Mageia and the problem didn't happen. Just in case someone is following this thread.

wysota
4th July 2015, 01:57
I still think you are looking in a wrong place. The desktop is not a problem. The configuration is.

te777
4th July 2015, 02:32
What do you mean by configuration? Settings in design mode for the app? Or problems with the libs deployed with the apps? I've tried several desktops in Mageia with the following results:

Desktop Problems

KDE No
Mate No
Openbox No
LXDE No
Xfce No
Gnome Yes
Gnome Classic Yes
Cinnamon Yes

The common factor seems to be VirtualBox. I've heard on the web that VBox doesn't do a good job with OpenGL drivers or display management. But if I can change the design of my app or how it is deployed to alleviate the problem, I haven't given up on that yet. Just at a roadblock here with that. Any suggestions on the configuration issue?

Infinity
4th July 2015, 02:47
For your tests you can also play around with some environment variables:
XDG_CURRENT_DESKTOP: Used by Qt to identify the desktop environment (KDE, gnome, cinnamon, ...).
QT_STYLE_OVERRIDE: Sets the Qt style to be used (breeze, oxygen, gtk, ...) independent from the recognized desktop environment. (See also anda_skoa's last post.)

Are other Qt 5 applications also affected by the bug (kwrite, konsole, systemsettings5, smplayer, ...)? If not, the problem is likely just somewhere in your specific application.
(When testing these applications, check whether the version you are using is already ported to Qt 5!)

te777
4th July 2015, 02:53
A very important fact is that I loaded Linux Mint Cinnamon into VMWare Player with 3D acceleration, and the problem doesn't occur. It only occurs in the desktops (Cinnamon and Gnome) with 3D acceleration in VBox. Those 2 desktops don't have any problems when 3D acceleration is disabled in VBox.

Infinity
4th July 2015, 03:01
Then don't use 3D acceleration with Cinnamon/Gnome in VirtualBox if this setup doesn't work.

Did you test other applications, just to be sure that the problem doesn't come from your own app?

What happens if you set the style to fusion using the mentioned environment variable?

You can try to get a newer version of Cinnamon/Gnome, VirtualBox, or Qt. (Maybe the problem is already fixed.)

te777
4th July 2015, 03:15
I've tested using the latest Cinnamon/Gnome, Vbox, and Qt. I was just trying fix a problem when my app gets downloaded from the web and the user has his/her system in VBox. The easiest thing I guess is to tell users on my download page just to disable 3D acceleration in VBox if they want to get my app to display properly. But that's not a solution, it's a stop-gap measure, a rough workaround. Advising to not use 3D acceleration in VBox isn't a real solution, especially since without 3D in VBox the Linux guest video is slow and lagging. But that's what I'll have to do until a real solution is found.

wysota
4th July 2015, 07:11
What do you mean by configuration?
Each Linux distribution has different maintainers who configure their distros differently. KDE installed on Linux Mint will be configured differently than KDE installed on Fedora or Debian. Freetype (responsible for font rendering) might be configured differently on Ubuntu and on Arch Linux. Fontconfig (responsible for font matching) might be configured differently on different systems. Each desktop environment might provide different overrides to many of the settings which are different too.


The common factor seems to be VirtualBox. I've heard on the web that VBox doesn't do a good job with OpenGL drivers or display management. But if I can change the design of my app or how it is deployed to alleviate the problem, I haven't given up on that yet. Just at a roadblock here with that. Any suggestions on the configuration issue?

I'm wondering whether someone else tested Qt apps on the same combinations as you did and had similar results. I understand that examples that come with Qt experience the same problems as your application, is that correct?

te777
4th July 2015, 08:08
I think the problem with my app is that it passes so many widgets as parameters to the output procedure and then the app asks the OS which asks the video drivers to display them all at one time. I think different desktops get confused with all those widgets to display at one time, i.e., the video driver's response to such a request. I haven't tested the Qt examples yet. I wouldn't think they have a similar design as mine.

wysota
4th July 2015, 09:44
I think the problem with my app is that it passes so many widgets as parameters to the output procedure and then the app asks the OS which asks the video drivers to display them all at one time. I think different desktops get confused with all those widgets to display at one time, i.e., the video driver's response to such a request.
No, that's silly. Desktops don't draw your applications, the apps do it by themselves, the compositor can at most receive a single bitmap with the whole window already rendered to it. And why would it garble text but not anything else?


I haven't tested the Qt examples yet.
That's the first thing you should have done.

te777
4th July 2015, 10:50
Can you suggest any Qt examples to compile and test with Linux distros in VirtualBox? By the way, I loaded Mageia in VMWare Player and it didn't have a problem with my app using Gnome. Nor did Ubuntu with the Gnome flashback desktop in VirtualBox. Cinnamon doesn't have a problem with 3D acceleration in VMWare Player either.

wysota
4th July 2015, 14:07
Can you suggest any Qt examples to compile and test with Linux distros in VirtualBox?
Any that displays text in QTextEdit :)