UI freezes when use irrlicht in qt - qt

I use irrlicht to render 3d model (.obj format) in qt 5.5 on ubuntu 18.04, everything works fine, except when I show a qdialog(the qdialog will call:
setWindowFlags(Qt::WindowType::Widget |
Qt::WindowType::CustomizeWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
if I didn't call the code above, the ui will not be freezed), my whole app ui will be freezed, the qdialog can not be shown, and got lots of warning:
[warning] QXcbConnection: XCB error: 8 (BadMatch), sequence: 6247, resource id: 69206027, major code: 130 (Unknown), minor code: 3.
I search a lot on google, but didn't find a solution, can anybody give me some help? Thanks very much!

Related

%debug magic command not working in the Q# Jupyter Notebook environment

As per the documentation provided by Microsoft Azure Quantum at this link , I followed the steps given and installed Q# with Jupyter Notebook, using Anaconda.
I then wrote the following Q# program in a Jupyter Notebook (IQ# kernel) using the code taken from here.
(I am currently using Google Chrome)
open Microsoft.Quantum.Diagnostics;
operation MultiQubitDumpMachineDemo() : Unit {
use qubit = Qubit();
H(qubit);
DumpMachine();
Reset(qubit);
}
When I used the magic commands such as %simulate and %trace, the program executed normally. The DumpMachine result clearly shows the qubit in a superposition of |0> and |1> (measurement probability is 50%), and the trace command printed out the quantum circuit.
%simulate Result
%trace Result
However, when I run the %debug command, the interactive HTML display does not work. The debug control button can display the circuit but, the controls for the chart options do not display the amplitudes, probabilities, or real/imaginary co-efficients.
When I opened the console, I observed the following error, every time I clicked the chart options controls:
Couldn't process kernel message TypeError: state.getDenseAmplitudes is not a function
at fitChart (bundle.js?v=20221015232727:292:32)
at Object.updateChart (bundle.js?v=20221015232727:277:9)
at update (bundle.js?v=20221015232727:811:32)
at bundle.js?v=20221015232727:850:17
at Kernel._handle_iopub_message (main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:63064:20)
at Kernel._finish_ws_message (main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:62843:29)
at main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:62834:44
Error Message
Unfortunately, I am not familiar with this type of error or its possible solutions, so I didn't try anything more than updating the 'iqsharp' package.
Can anyone explain why I'm getting this error, and, if possible, provide with me a solution for the same?
Thanks in advance!

QFontMetrics Width using PySide6

I have the following line in my code:
self.textLength = self.fontMetrics().width(self.text())
It works with PyQt5, but I'm trying to move the code to PySide6, and when I do I get the error AttributeError: type object 'PySide6.QtGui.QFontMetrics' has no attribute 'width'
I've tried reading through the QFontMetrics docs, but everything I do seems to give the same error. Any ideas of how I can convert this line to PySide6? Thank you!
QFontMetrics.width() has been considered obsolete since Qt 5.5 and deprecated from Qt 5.11 (but will probably be still supported throughout any future releases of Qt 5), and eventually removed in Qt 6.
As the documentation (which already is in the obsolete members page of Qt5) reports, the results of width() were inconsistent and unreliable in many situations, mostly because it didn't consider the letter bearings.
You should use horizontalAdvance() or boundingRect().width().

GtkAda Simple Window: pixbuf loaders or the mime database could not be found

with Gnat-2020-Community version and Gtkada I try to create a simple gui on Debian 10.2 (x86_64 GNU/Linux).
The project is based on GtkAda's "Simple window" project from the "Create Project from Template" dialog (I assume that the code runs out of the box).
-- Initialize GtkAda.
Gtk.Main.Init;
-- Create a window with a size of 400x400
Gtk_New (Win);
Win.Set_Default_Size (400, 400);
-- Create a box to organize vertically the contents of the window
Gtk_New_Vbox (Box);
Win.Add (Box);
-- Add a label
Gtk_New (Label, "Hello world.");
Box.Add (Label);
-- Stop the Gtk process when closing the window
Win.On_Delete_Event (Delete_Event_Cb'Unrestricted_Access);
-- Show the window and present it
Win.Show_All;
Win.Present;
-- Start the Gtk+ main loop
Gtk.Main.Main;
No changes have been applied except from the adjustment of 'with "gtkada";' to the correct path of the gtkada.gpr file in the project's gpr file.
GtkAda is detected correctly. The project is built successfully both in static and relocatable configuration.
However, the program cannot be run successfully but generates this terminal output when executing Win.Show_All;:
/home/user/workspace_ada/Simple_Window/Simple_Window/obj/main
Fontconfig warning: "/home/user/workspace_ada/gnat-2020/etc/fonts/fonts.conf", line 86: unknown element "blank"
(main:4012): Gtk-WARNING **: 21:38:39.988: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /home/user/workspace_ada/gnat-2020/share/icons/Adwaita/16x16/status/image-missing.png: Format der Bilddatei unbekannt (gdk-pixbuf-error-quark, 3)
raised PROGRAM_ERROR : unhandled signal
[2020-08-20 21:38:40] process exited with status 1, elapsed time: 00.30s
I have installed the following packages as required by Gtkada: libglib*, libgtk*.
Furthermore I have installed libx11* and libncurses*, because I had the feeling as if it would be beneficial.
I have searched both the internet and the Gtkada community at stackoverflow on this topic without success.
Therefore I would like to ask you, the Ada experts and gurus of the Stackoverflow community, on ideas or what I am missing.
Many thanks in advance. Best regards.
Problem: You can't run the program written in GtkAda directly on Linux. You have to always use script gtkada-env.sh or it equivalent before start a program to set proper paths and environment variables for Gtk bundled with GtkAda.
If you want to see how that starting script should looks, here is a small example: https://github.com/thindil/hunter/blob/master/hunter.sh
If you plan to use gtkada-env.sh script, you need to run it only once, because it create a new default shell with proper paths and variables settings

Window contentOrientation M1 error

I have a QML Window which I want to assign contentOrientation property to Qt::LandscapeOrientation resulting in following line of code:
contentOrientation: "Qt::LandscapeOrientation"
Qt Creator shows me the following error in this code:
Invalid value for enum. (M1)
I am aware this is a very dumb error (I expect some downgrades :D), but how do I solve it?
In QML, the enums from the C++ Qt namespace area available in the Qt.X form:
contentOrientation: Qt.LandscapeOrientation
The documentation could be clearer about this, as it still says:
The default value is Qt::PrimaryOrientation.
I imagine that this is because the values are not documented in QML to avoid duplication, and this is the only way that they can be linked to.

Qt: Different tableWidget member names on workstations

I am using Qt on two ubuntu machines and am copying the source code from time to time between them. I found a really annoying problem when doing that and I can't figure out why this happens.I am using a table Widget to display some data and want to stretch the horizontal header to fit the content length. To do that I use the following line:
ui->tableWidget->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
This works just fine.
I have a few of this codelines.
However, when I now copy over my source code to the other PC to work on it, I get the following compile error:
'class QHeaderView' has no member named 'setResizeMode'
Renaming 'setResizeMode' to 'setSectionResizeMode' will work just fine to fix that problem, but if I now copy the source code back to the first PC, it tells me:
'class QHeaderView' has no member named 'setSectionResizeMode'
...and I have to rename it to 'setResizeMode' again, to continue working.
I checked the Qt version on both PCs and they are both "Qt Creator 2.7.0" based on "Qt 5.0.1 (32 bit)".
Also the systems are up to date.
The only difference is, that I am using one of them in english system language, the other one in german...but I don't see how that would affect Qt's member declaration. o.O
Anyone knows what the problem is?
The constant renaming can get annoying over time.
it may be that the QT header versions don't match up
double check the QT_VERSION_STR in QtCore/qglobal.h
for a quick check if you are too lazy add a #pragma message("QT version: " QT_VERSION_STR) to the code to have the compiler output it while compiling

Resources