Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QGuiApplication::focusWindow() always return null in wayland platform

    Unsolved
    4
    1 Votes
    4 Posts
    995 Views
    M
    @Ggwp1234 I think you should show a window in the first place, or maybe you mean to use applicationStateChanged signal ?
  • File names should be lowercase?

    Unsolved
    4
    0 Votes
    4 Posts
    337 Views
    SGaistS
    @AndrzejB the installer does nothing in that regard. They are generated if memory serves well.
  • Newbie questions: installation, setup, licences etc.

    Unsolved
    5
    0 Votes
    5 Posts
    303 Views
    C
    @cdvo I found my way. I removed all designer*.qm files under the translation folder but left the en one. Thanks
  • String and implicit sharing

    Unsolved
    2
    0 Votes
    2 Posts
    190 Views
    Christian EhrlicherC
    As long as you don't access the object via a non-const function there is only one QString instance with '"some Text"'.
  • QT Creator gtest error

    Unsolved
    3
    0 Votes
    3 Posts
    251 Views
    R
    @jsulm No it does not build.
  • How to fix application crash under Win11

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    JonBJ
    @Oeschi said in How to fix application crash under Win11: ExceptionCode: 0xe0464645 Searching for this seems to generate hits all to do with NVidia gfx card? In dwm.exe.
  • How do i Change my role to get the community edition of Qt?

    Unsolved
    2
    0 Votes
    2 Posts
    302 Views
    jsulmJ
    @Amos-graham No need to change anything in your account. Simply select the OSS version when installing Qt.
  • QtSerialPort and FTDI Driver Issues

    Unsolved
    4
    0 Votes
    4 Posts
    809 Views
    Christian EhrlicherC
    @samfallday said in QtSerialPort and FTDI Driver Issues: I assume these other 3rd party programs are built on the Windows API and that is what makes the difference. Qt is using the same windows api as other tools - they don't add some magic new functions to Qt. You have to find out what they're doing different to Qt.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • snap7 and Qt Creator

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    M
    @markolino_it please how can i do step 1 (compile the library with file.bat)
  • macOS universal binary: repeated Documents access requests

    Unsolved
    4
    0 Votes
    4 Posts
    936 Views
    D
    @jgibson If it keeps asking for permissions there might be a problem with code signing of your app. I would try codesign -s - --deep <MyApp>.app and see if it fixes the problems on your machine. If you move it to another machine you will have to do it there again because it will have an ad-hoc signature which is not transferable.
  • This topic is deleted!

    Solved
    2
    0 Votes
    2 Posts
    26 Views
  • Compilation issues when using #include<filesystem>

    Solved
    13
    0 Votes
    13 Posts
    4k Views
    JonBJ
    @rowan-Samy Seriously? Install Qt 6.2.3. Install (may come with the Qt version) and use (select as kit) MinGW 9.0.0. See whether your problem has gone away. If not then it appears you have a different problem from @pingal so there's no point asking him what he did.
  • 0 Votes
    2 Posts
    366 Views
    M
    @gaojinhsu said in Unity player embedded into Qt application, the video game dosen't response to keyboard and mouse wheel events any more.: The game itself can response to keyboad, mouse wheel, mouse move and mouse click events, but when I embed unity player into Qt application, the game dosen't response to keyboad and mouse wheel events any more. how to fix it ? typedef struct MyData { HINSTANCE hInstance; HINSTANCE hPrevInstance; LPWSTR lpCmdLine; int nShowCmd; } MYDATA, * PMYDATA; DWORD WINAPI MyThreadFunction(LPVOID lpParam); int main(int argc, char *argv[]) { QApplication a(argc, argv); HINSTANCE hInstance = GetModuleHandle(NULL); LPWSTR lpCmdLine = GetCommandLineW(); QWidget w; w.show(); QString cmd = " -screen-fullscreen 0 -popupwindow -screen-width 1920 -screen-height 1280 -popupwindow -parentHWND " + QString::number(w.winId()) + " delayed "; qDebug() << "lpCmdLine " << cmd; wchar_t ss[1024]; cmd.toWCharArray(ss); PMYDATA pData = (PMYDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MYDATA)); pData->hInstance = hInstance; pData->hPrevInstance = NULL; pData->lpCmdLine = ss; pData->nShowCmd = 10; DWORD dwThreadId; CreateThread( NULL, // default security attributes 0, // use default stack size MyThreadFunction, // thread function name pData, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier //UnityMain(hInstance, NULL, ss, 10); return a.exec(); } DWORD WINAPI MyThreadFunction(LPVOID lpParam) { PMYDATA pData = (PMYDATA)lpParam; UnityMain(pData->hInstance, pData->hPrevInstance, pData->lpCmdLine, pData->nShowCmd); return 0; } This can be a bit tricky, as you're dealing with integration between two different frameworks. Here are a few steps you can consider to troubleshoot and fix the issue: Check Unity Input Settings: Make sure that the Unity game's input settings are properly configured to respond to keyboard and mouse events. Check the Input Manager in Unity to ensure that the desired keys and mouse buttons are correctly set up. Focus Issues: Sometimes, focus issues can prevent keyboard and mouse events from reaching the Unity game. Ensure that the embedded Unity player has the correct focus when running within the Qt application. You might need to handle focus changes and forwarding events appropriately between Qt and Unity. Event Handling: Unity and Qt have different event handling systems. Make sure that Unity is receiving and processing the events correctly. You might need to capture the Qt events and translate them into Unity events. Cross-thread Communication: It seems you're using a separate thread for Unity (MyThreadFunction) and the main thread for Qt. Ensure that you're correctly synchronizing and communicating between these threads, as UI events might need proper synchronization. Qt Event Filters: You can use Qt's event filtering mechanism to intercept and forward events to the embedded Unity player. This involves subclassing QObject and implementing eventFilter() to capture and forward events. Unity Build Settings: Double-check the build settings of your Unity project. Make sure that the input modules are correctly configured to handle the input events you expect. Debugging: Use debugging tools in both Unity and Qt to diagnose the issue. Log messages, breakpoints, and debugging tools can help you identify where the events are getting lost. Unity Player Logs: Check the Unity player logs for any error messages or warnings related to input events. This might give you insights into what's going wrong.
  • how to reconnect udp socket from 1 ip address to another address

    Solved
    3
    0 Votes
    3 Posts
    403 Views
    V
    @Pl45m4 thank you
  • Detect application running or not. How?

    Unsolved
    4
    0 Votes
    4 Posts
    558 Views
    B
    @J-Hilk Thx. Will try it out today or tomorrow.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • detect debug/release in .pro file: message is only correct 2 out of the 3 messages?

    Unsolved
    3
    0 Votes
    3 Posts
    269 Views
    C
    @kkoehne Thank you. It tells me qmake runs 3 times to generate the configuration for different situations (debug,release and debug and release), and therefore it gives me three times the messages. I didn't expect qmake to run 3 times.
  • Can't set up CMake. Getting errors.

    Solved cmake error c++ qt designer vscode
    12
    0 Votes
    12 Posts
    6k Views
    J
    @jsulm I used to believe that the only way to create a C++ GUI was through Qt Design Studio, as I had never created anything in C++ other than console programs. I've created a GUI in Python in the past with it. However, I stumbled upon examples in Qt Creator that use .ui files. I'm familiar with this approach, having worked with UI and widgets before. I believe I'll continue using widgets since they don't show any errors when the program is executed. I will close this conversation as I no longer require assistance with qml. If I encounter any further issues, I'll post on a forum if I'm unable to resolve them myself. Thank you to everyone who tried to help me.
  • Restored cursor stays as ForbiddenCursor one after drag and drop

    Unsolved
    2
    0 Votes
    2 Posts
    233 Views
    M
    @MrAWD One more test that still didn't work. Once I get a signal that thread has finished, in the slot code I have added join() call to make sure thread has really finished, so the cursor is not prematurely changed, but that didn't help and I still ended up with ForbidenCursor. class MyClass(): threadDone = Signal() def __init__(self): self.threadDone.connect(self.onThreadDone) def initialize(self): QApplication.setOverrideCursor(Qt.WaitCursor) self.thread = threading.Thread(target=self.startThread) self.thread.setDaemon(True) self.thread.start() def startThread(self): sleep(3) # this is instead of the initialization wait self.threadDone.emit() def onThreadDone(self): self.thread.join() QApplication.restoreOverrideCursor() The only way I was able to get correct cursor was if I have a join() call right after the thread start() (see below). Once thread is joined this way, cursor is restored back to the Arrow one. The problem with this implementation is that it looks identical to the one without the thread to start with. User has to wait couple of seconds for the initialization to complete and it is pretty annoying. def initialize(self): QApplication.setOverrideCursor(Qt.WaitCursor) self.thread = threading.Thread(target=self.startThread) self.thread.setDaemon(True) self.thread.start() self.thread.join() QApplication.restoreOverrideCursor()