Qt and multiscreen - qt

I have an example application that came with Qt (dialogs/standarddialogs) and modified it so that it displays dialog on every screen:
for(int i=0;i<app.desktop()->screenCount();i++)
{
Dialog* dialog = new Dialog(app.desktop()->screen(i));
dialog->show();
}
return app.exec();
When testing on Xnest on application default screen (the one from which the application has been started) everything works ok. However, on the other screen the icons in message boxes are not displayed correctly.
The problem can be reproduced on both solaris and linux. However, when I try Xephyr instead of Xnest the problem disappears (on linux). On the other hand this is not a problem with Xnest itself as on Exceed the problem can also be reproduced (but the icons are not displayed at all).
Has anybody seen this kind of problem? Do you think it might be a problem with Qt or configuration of X server? Or maybe I need to compile Qt with some special options?

It seems to be a bug in Qt X11 graphics system. If I set QT_GRAPHICSSYSTEM to raster the icons are displayed properly.

Related

Incorrect Ikonli icons displayed

I am having problems using the Ikonli icon packs. I am creating FontIcon objects and then using those to set the graphics on buttons. Icons taken from the FontAwesome5 pack work great. Icons taken from the Material2 pack seem to shift somehow - for example, I try to get mdal-6_ft_apart but what actually gets displayed is mdal-loyalty. And no matter which Icon I load from MaterialDesign2, all I see is an empty box.
I'm running this through Eclipse, and everything looks fine when stepping through with the debugger. This is the value of the button graphic:
ObjectProperty [bean: mdal-6_ft_apart:15:0xffffffff, name: iconCode, value: MDAL_6_FT_APART]
and yet, on the screen, it's something completely different.
This is a Maven project using OpenJDK 16 and JavaFX 16. I've tried loading just a single icon pack instead of all 3, but no difference. Also, there are never any errors retrieving the icons. The ServiceProviders are all found, and the icons are available.
I made a small Hello World program and everything runs fine, so it's definitely an issue with my program and not the library. But I have no idea what the problem is, and I've been staring at this for almost 2 hours. Has anyone come across this before? I'd appreciate any help, because I'm out of ideas.
Answering this myself in case it saves someone else some time. I was installing the Ikonli library in order to replace the FontAwesomeFX library that is no longer available. I had gotten partway through replacing the icons when I ran the app in order to check the progress, and that's when I saw the errors.
The problem turned out to be an interference between the two libraries - FontAwesomeFX was throwing of Ikonli. The icon shift didn't actually occur until the code displayed a FontAwesomeFX icon, which made it seem a little random depending on the order I would open the dialogs when testing. I'm assuming an issue with the Service Handlers, though I'm not positive because I stopped troubleshooting once I realized the problem and just finished the replacement.
Once I stopped displaying FontAwesomeFX icons and the dependency was removed, Ikonli worked fine.

Issue with Rstudio version (Version 1.3.1073) "Giant goldenrod" when moving R studio window to new monitor doesn't display correctly

This is a basic question that I hope has a simple solution. When I move my Rstudio window to an external monitor display - it no longer rescales properly and instead is rendered completely useless - showing me only the lower portion of the window (see screenshot) and doesn't allow me to resize the window or adjust it in anyway to access the taskbar along the top. Has anyone else experienced this or have options for how this could be fixed?
I frequently need to shift my Rstudio window to different monitors, and I was doing this with no issue prior to installing the latest Rstudio version - so I am wondering if there must just be some setting that got reset when I updated the software, but I can't seem to figure it out. I have tried fixing scaling options in Windows by using the properties options on the Rstudio icon on my desktop - and then clicking on compatibility and High DPI settings, but messing around with that so far hasn't seemed to work. However I haven't tried all possible combinations as i thought I would check here first to see if someone could fast track this process for me. As you can see in the image - this display is impossible to work with. When I move it back - it works as it should. I am using Windows 10, and I update my software regularly. TY!
Update
Ok, I was able to reproduce on a Lenovo with an external Dell monitor and address the problem by applying a fix proposed in another Stack Overflow thread. See below:
Research:
https://support.microsoft.com/en-us/topic/windows-scaling-issues-for-high-dpi-devices-508483cd-7c59-0d08-12b0-960b99aa347d
Resolution:
There is a solution, it comes from the option "Compatibility" of the execute file.
Close all current RStudio windows.
Right-click on the shortcut of RStudio (or the original .exe file) and choose Properties
In the RStudio Properties pop-up windows, choose the tab Compatibility
Select High DPI settings
Tick on option Override hide DPI scaling... and then choose System from the drop-down list.
Apply > OK.
(Re)open Rstudio to see the change
On my test system, this addressed the problem observed where the menu text became super large.
Stackoverflow original reference:
RStudio HiDPI support
This appears to be an issue with the version of QT used by RStudio. RStudio is built on top of the QT engine.
QT tracking Issue:
https://bugreports.qt.io/browse/QTBUG-48242
the issue is marked as fixed in QT version 5.9.0 and above.
Recommendation:
Download RStudio preview and try that:
https://www.rstudio.com/products/rstudio/download/preview/
Why? The preview version of RStudio appears to use QtWebEngine/5.12.8, which implies the issue is addressed. If that does not resolve the issue you could file a bug with RStudio, or install and recompile RStudio from the source with an updated version of QT. You can check your QT version via the help, about box.
Hoping the above points you in the right direction. Stays safe and well.

Keep QDialog on top of everything, even fullscreen applications?

On a project I work on, using Python3 + PySide, I try to print a popup-message as some sort of notification.
This popup needs to be on top of everything, this includes fullscreen applications like games or browsers. And that's the point that does not work. It works fine for all windows on my Desktop, normal windows, maximized, but as soon as there is a fullscreen application or a borderless window ("pseudo fullscreen") the popup is created, but "behind" the fullscreen app.
I already use self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) but this flag does get ignored by other fullscreen apps.
How do I fix this? Also without giving focus to the popup.
It is just there to present information, and it is not good when your window looses focus while playing a game.
My code can be found here: https://github.com/GosuSan/PyECM
additional Info:
- my project aims to be cross-platform, so I need a platform-independend solution
- I am running linux, without having a windows machine atm,
so I can't test stuff there.
If you need any more info, let me know!
Edit:
It seems that PySide.QtGui.QSystemTrayIcon.showMessage does what I want, it works on fullscreen as well as on borderless-windows. So I will try to either find out how those messages are displayed on top, or just use them, not sure for now.

Qt camera image stays black after adding a QOpenGLWidget

Reproducing the issue
Go to the Welcome page in the Qt Creator and select the 'Camera Example'. Verify that your camera is working properly first by compiling it. Then add a QOpenGLWidget in the designer to the camera.ui form. Run again, now the webcam should stay black.
Specs:
Windows 8.1
Qt 5.5
This is how it looks like for me:
http://i.stack.imgur.com/oE2Pe.png
A little more backstory
I'm working on a project that requires a video feed to work with OpenGL. I was using a QAbstractVideoSurface to get the image data for individual frames. I ran into this issue by just trying to add a QOpenGLWidget into the mix to see what happens. I haven't looked further into it yet other than searching for other reports of this. I couldn't find anything specific though.

in Qt, How do I make a window be the current window?

My QT app has multiple windows and sometimes, even though the windows are already open but burried under other windows, the user will select an option to open one from the mainwindow menubar in which case I want to simply bring it up and make it the current one. Now using QWidget->raise makes this window go on top of all other windows but it doesnt select it and that is what I need to do. I tried QWidget->setFocus but that doesnt do anything. In the mean time I am using a combination of QWidget->close followed by QWidget->show but I would like to know if there is a command to use with ->raise.
I tried:
pMission->raise();
pMission->setFocus(Qt::ActiveWindowFocusReason);
but it didnt work so i used:
pMission->close();
pMission->show();
Have you ever tried QWidget::activateWindow?
From help file, this function is going to
Sets the top-level widget containing this widget to be the active window.
An active window is a visible top-level window that has the keyboard input focus.
On MacOS Lion with Qt 4.8.0, raise() was the only one that worked for me. activateWindow() and setFocus() did not.
(I don't have enough karma to make this a comment on Mason's answer)

Resources