I have the following code:
QWidget* widget = ...
...
widget->move(x, y);
assert(widget->pos().x() == x);
assert(widget->pos().y() == y);
This assert holds on both Windows and Linux, but fails on embedded linux.
Qt was built from source on all operating systems.
Is there any known work around for this issue?
Related
Can I use cfg to determine the OS Windows version for this block of code? The thing is that shcore lib is not available in windows 7 and below
#[cfg(all(windows, not(feature = "inline")))]
unsafe {
winapi::um::shellscalingapi::SetProcessDpiAwareness(2);
}
Good evening,
I inherited a project made using QT creator (C++ and Qt Quick).
The target is a DaVinci DM8168 board with **Linux kernel 2.6.37 **on it.
In particular I'm using Qt Creator 4.2.0 (4.2.0)
Based on Qt 5.7.1 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)
I can build & run the application for the target and I can see it running.
I need to launch the profiler. But it does not work. When i run the application (on the target) using the parameter:
qmljsdebugger=port:xxxx
then the application does not start anymore!
I tried to add these options to the project's .pro file:
DEFINES '' += QMLJSDEBUGGER
DEFINES '' += QT_DECLARATIVE_DEBUG
PACKAGECONFIG_append = " qml-debug"
I, obviously, build in debug mode.
When I try to run the applicative on the target i get this message:
QML debugging is enabled. Only use this in a safe environment. Process
killed by signal
I repeat: if the option "qmljsdebugger=port:xxxx" is removed then the application starts and works properly.. but of course the profiler wouldn't connect in this case.
As I said, I've inherited the project and I'm complete new to this environment.
Any help or suggestion?
update
these are now the lines I've added to the .pro file
DEFINES '' += QMLJSDEBUGGER
DEFINES '' += QT_QML_DEBUG
CONFIG += qml_debug
I checked the various path for QT and exported PATH and LD_LIBRARY_PATH.
Unfortunately nothing changes:
If I launch my program using:
/opt/MyPrefix/MyProgram -platform eglfs
then it works.
if I use:
/opt/MyPrefix/MyProgram -qmljsdebugger=port:3456 -platform eglfs
then it crashes
QML debugging is enabled. Only use this in a safe environment.
Segmentation fault
the program seems to start in Debug Mode and this is ok. The problem is the profiler :(
ps: As far as I know there are no firewalls running on the target. I'll check better for sure.
update 2
I tryed the same solutions as above but on a simple program as suggested(an "hello world" basically) and it does not crash when the "-qmljsdebugger=port:3456" option is specified... I really don't know what the problem is in my original application.
First there are a few prerequisites to make qml debug run like being sure that Qt was built with the exact same toolchain as the binary. You should take a look at Qt Wiki: https://wiki.qt.io/How_To_Profile_QML_App_on_Embedded_Device
An important note is that how you make qml debugging works has changed between Qt Quick 1 and Qt Quick 2. As you are using Qt 5, I believe you should be using Qt Quick 2. So that means that you should not use QT_DECLARATIVE_DEBUG, but QT_QML_DEBUG.
More details: https://doc.qt.io/qt-5/qtquick-debugging.html#qml-debugging-infrastructure
If you still have issue after using the proper DEFINES and making sure that evry prerequisite was met, then you should try with a basic Qt program that does nothing, but display a simple QML item (like a Rectangle or a Button) ans see if you still have the issue.
I'm trying to use an old binary (HP VEX simulator: http://www.hpl.hp.com/downloads/vex) which uses VCG visualization tool (http://www.rw.cdl.uni-saarland.de/~sander/html/gsvcg1.html).
The binary fails because of a failed function call:
#define VCG_DEFAULT_FONT "-*-courier-*-*-*--14-*-*-*-*-*-*-*"
char Xfontname[512] = VCG_DEFAULT_FONT;
panel_font = XLoadQueryFont(root_display,Xfontname);
I am wondering if installing the font on the machine would solve this issue? If so, how can I install the font so that XLoadQueryFont function would detect it.
I am using an Ubuntu 16.04.4 LTS.
I would appreciate any other proposed solutions.
Thanks!
As we've started to work with iOS7 - and facing some issue during coding - i.e. how we can compare iPhone5 and iPhone 5S - So that we can check either the system is 32bit or 64bit and can use variables accordingly.
If you want to do this via compile time conditionals, there's a new "__arm64__" conditonal defined that is now available for 64-bit compiled code.
Presumably "__arm__" is what gets defined for 32-bit device code.
You'll also likely notice there's a new available architecture in Xcode alongside "armv6, armv7 and armv7s", that being "arm64".
So you could do something like this:
#ifdef __arm64__
NSLog( #"we're running 64-bit");
else
NSLog( #"32-bit iphone code");
#endif
Since I am writing a program that will eventually run on Windows and Linux environment compiled from the same project files, I wanted to test and see how well the Operating System directives are. So, I wrote a sample code. The code seems to run unexpectedly or it just my imagination.
Here is the code:
method MainForm.ControlBtn_Click(sender: System.Object; e: System.EventArgs);
begin
{$IFDEF linux}
MessageBox.Show('This is Linux. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
{$IFDEF WIN32}
MessageBox.Show('This is Win32. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
{$IFDEF CLR}
MessageBox.Show('This is .NET Framework. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
end;
Now, when I run this method on Windows it pops up a message box with 'This is .NET Framework. Horay!!!' I kind of expected that being that it was running on Windows. When I ran it on Linux under Mono, it popped up a message box with the same message, "This is .NET FrameWork. Horay!!!" I was expecting to see Linux message, which is "This is Linux. Horay!!!" If this code is working correctly, then how do you check to see which platform your program is running on in the event you do need to execute different methods only supported by Linux or Mac or windows.
The compiler directives are evaluated at compile time (hence compiler directives). So the resulting .exe will always state the platform it was compiled on, not the one it is running on. Also, the Delphi-Compiler directives are not defined in this way for Prism / Oxygene language.
The way to retrieve the OS you're running on is a bit tricky (there are for example multiple values stating you're on UNIX), but not overly complicated.
The first place to go is System.Environment.OSVersion.Platform.
This enum defines the following values in .NET 2.0: Win32S, Win32Windows, Win32NT, WinCE, Unix, Xbox, MacOSX. MacOS has its own value while Linux and other Unixoid systems share the Unix value.
Mono also defines other values too (see the Mono FAQ entry on determining the platform).
Edit: One possible way would be:
var os: string := if Environment.OSVersion.Platform = System.PlatformID.Unix then
'Linux/Unix'
else if Environment.OSVersion.Platform = System.PlatformID.MacOSX then
'Mac OS X'
else
'Windows';