Skip to content
Qt 6.11 is out! See what's new in the release blog
  • DragHandler::onDragChanged not reporting continously

    Solved General and Desktop
    5
    0 Votes
    5 Posts
    314 Views
    K
    Thanks! I see now that handlerPoint has no signals though, how am I supposed to signal when the position has changed? More generally, I'm also looking to register when the user clicks the middle mouse button + drags their mouse. DragHandler only registers events from the left click, is there a way I can generalize all this? Perhaps tracking the mouse position + the clicks separately? (HoverHandler + WheelHandler + Keys.onPressed?)
  • build vlc from source on windows with apt get how it possible?

    Solved 3rd Party Software
    3
    0 Votes
    3 Posts
    2k Views
    S
    I know this is an old thread, but since it still shows up in search results: In case someone has issue with cross-compiling vlc4.0 from linux to windows, You can also checkout a blog on this issue: https://medium.com/@skdevane/building-vlc-4-0-for-windows-inside-wsl2-every-wall-i-hit-and-how-i-got-through-them-72e6e1e2d456
  • Launch telnet from Qt GUI application

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    30 Views
    JonBJ
    @richferrara said in Launch telnet from Qt GUI application: I am trying to find a way to do this with QProcess but nothing seems to work. The suggestions I've found online say to use QProcess to launch cmd.exe with the telnet command and parameters in the argument list, but it doesn't work. I tried using the C++ system command instead of QProcess -- this launches the telnet window Could you show precisely what you have tried (i.e. showing code and full command line) (a) with QProcess and (b) with system command. May be able to help --- this is my area but I only run Qt under Linux so it may be guesswork!
  • Cannot link QtCreator to existing Qt installation.

    Unsolved Qt Creator and other tools
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • 0 Votes
    6 Posts
    51 Views
    S
    @JonB said in TypeError: unbound method QFileDialog.selectedFiles() needs an argument: [Btw your Image files string clearly looks wrong --- count the parentheses --- so that may be interfering with its filter behaviour.] Ah, I somehow missed that before. Yep, adding the extra ) fixed it. @JonB said in TypeError: unbound method QFileDialog.selectedFiles() needs an argument: I just noticed that even if you do want multiple files selected there is actually a static function for that too: This works perfectly and does exactly what I was trying to do, thank you
  • 0 Votes
    8 Posts
    3k Views
    J
    @berliner : It was fixed in https://codereview.qt-project.org/c/qt-creator/qt-creator/+/708134 commit. However, it went to Creator 19.0 so please try this version to verify whether it fixes your issue.
  • 0 Votes
    4 Posts
    109 Views
    T
    But with QtCreator 20.0.0 there is no difference.
  • Relevance of invokeMethod() in multithreaded programs

    Solved General and Desktop
    8
    0 Votes
    8 Posts
    559 Views
    S
    Basically, the other answers already contain all of my thoughts. But, since I've been mentioned I'll still chime in. In a single-threaded context I can just call functions and that's fine. In a multi-threaded context when I want to call functions of an object that lives in a different thread (especially if you want to call GUI functions in Qt) invokeMethod() is the only easy way I know of. Sure, you can properly set up a signal. I personally don't see the point in having a signal (which I then need to connect) if it is called from just a single place in the code. First, I have to come up with an appropriate name for the signal, and second, I'll have a long list of signals in the class declaration that are of no interest to any outsider. The use case of of using this to call functions belonging to a GUI thread is so pervasive that I have a header-only library that (among other things) has a function guiThread(...) (https://github.com/SimonSchroeder/QtThreadHelper) to easily place calls into the GUI thread from other threads. From the recent discussion in this forum I have also learned that invokeMethod() takes a connection type as argument. I guess, then my function guiThreadMaybe() is not necessary, as the default is the AutoConnection which will do already a direct call if it is from the same thread (the 'maybe' part explicitly checks for that). Outside of multi-threading I only see a single use case for invokeMethod(): If I don't want to immediately execute that function, but put it in the event queue to be executed at a later point. I guess this is a valid use case, but not one I encounter often. In many cases, the suggested solution is a single shot timer with a timeout of 0ms. In addition to putting this call into the event loop, it will also only execute once the event loop is otherwise idle. @JonB said in Relevance of invokeMethod() in multithreaded programs: I didn't see why there is a particular mention here of separate threads. It wasn't mentioned in the original post, but later: @Christian-Ehrlicher said in Show a QMessage box from the context of a function defined outside mainwindow.cpp: One problem with a simple callback will arise when you run the solver in a different thread. "invokeMethod() is also my general solution if I'm multithreaded" needs to be read in the context of the original discussion: It was specifically about calling GUI functions. If we combine that with multithreading, invokeMethod() is the (hard-to-find) obvious solution.
  • Boot Partition Path Boot2qt

    Unsolved Mobile and Embedded
    2
    0 Votes
    2 Posts
    75 Views
    SGaistS
    Hi, Since Boot2Qt is a commercial offering, you should contact the Qt Company directly.
  • Creator error but command line works.

    Unsolved Qt Creator and other tools
    2
    0 Votes
    2 Posts
    72 Views
    SGaistS
    Hi and welcome to devnet, Did you already your kit configuration in Qt Creator ?
  • 0 Votes
    7 Posts
    548 Views
    1
    Please use this link to download the DMG: https://github.com/aecreations/PyQtPopupDemo/releases/tag/0.0.3 - fixes a bug where the menu bar extra icon didn't appear in the PyInstaller build.
  • 0 Votes
    15 Posts
    1k Views
    JKSHJ
    @lukester88 said in Show a QMessage box from the context of a function defined outside mainwindow.cpp: A major theme I have in my code is keeping UI code and solver code completely separate, and I would like to continue that trend with this specific task. My question is - how can I make these functions show a message box to the user when the function is executed? For example, when the user presses the button, and the function executes, if it exceeds the maximum number of iterations, the function should finish executing, and then a message box should show up warning the user that the function failed to converge. Furthermore, how can I implement such a thing without using UI code in the file with the solver source code? Make your solver return information about whether it converged on an answer or not: struct SolverResult { double finalValue; bool converged; }; Then, do extra checks when processing the result. If your result-processing code currently looks like this... void MainWindow::onSolverFinished(double finalValue) { this->doSomethingWith(finalValue); } ...now you can do extra checks: void MainWindow::onSolverFinished(const SolverResult &result) { if (result.converged) { // Yay, we found a solution! this->doSomethingWith(result.finalValue); } else { QMessageBox::warning(this, "No solution found", QStringLiteral("Failed to converge on a solution within %1 iterations").arg(m_maxIterations) ); } } Alternatively, you could adopt a convention like "Return NaN if it fails to converge", and show the QMessageBox inside if (qIsNan(finalValue))
  • Build Qt-6.12.0-beta2 from source in Debian 13 problem

    Unsolved Installation and Deployment
    2
    0 Votes
    2 Posts
    56 Views
    SGaistS
    Hi, With which compiler ? Which configure parameters did you use ? What number of cores are you using at the same time ? What are your machine specifications ?
  • A small Qt6 showcase

    Unsolved Showcase
    1
    1 Votes
    1 Posts
    102 Views
    No one has replied
  • 0 Votes
    1 Posts
    101 Views
    No one has replied
  • 0 Votes
    3 Posts
    282 Views
    A
    @cristian-adam Nice, thanks!
  • Fluent-Qt: a modern Fluent-style component library for Qt Widgets

    Unsolved Showcase
    12
    0 Votes
    12 Posts
    4k Views
    C
    @SimonSchroeder It seems like the testing was insufficient. I'll optimize the high-DPI handling and fix it in the next version.
  • Add Qt 6 mobile application to sharing application list. How?

    Unsolved Mobile and Embedded
    2
    0 Votes
    2 Posts
    373 Views
    SGaistS
    Hi, AFAIK, there's no pre-built solution in Qt for that. For iOS, this article explains how to do it but also different use cases around data sharing.
  • How to replace to backspace ?

    Unsolved General and Desktop
    6
    0 Votes
    6 Posts
    691 Views
    S
    It is not so easy to decipher what the actual problem is. However, here is what I observe. We start with the following string: "123\n456\n789" If you just want to delete something from the string, you would replace it with an empty string. So, s.replace("456", ""); would yield "123\n\n789" This means, that this would print an empty line between 123 and 789. However, if you do s.replace("456", "\b"); you'll get "123\n\b\n789" I guess that like most people here I haven't ever used \b myself. Not all implementations that print out strings to the console (or wherever) might have an appropriate implementation of \b. Hence, this might vary. One possible implementation is that \b will indead delete the previous character when printed. In this case \n would be removed. This would result in the same output as "123\n789" However, another implementation might print line by line. So, when \b is encountered a new line has already begun. And on the new line there is nothing to delete. The command line is not a text editor where there is a document behind it and everything is rerendered when you change something. On the same line the implementation is quite simple: go back one character and replace it with blank (but keep the cursor at the same position). However, if the command line has to go back one line, it does not have the information stored where the previous line ended. It is quite impossible (without buffering) to go back to the previous line. After a new line you (most likely) have committed to what is printed on the screen (in most implementations). Note that you'll insert \b into the string. This does not delete the previous character inside the string. The string itself is just bytes and contains what you put in it. If you want to delete the full line containing 456, you should write s.replace("456\n", "");
  • 0 Votes
    7 Posts
    643 Views
    D
    @SGaist Thank you for this suggestion! I've actually evaluated this option, the problem for my case is that the application runs on Linux. Unfortunately, according to the docs, the underlying engine for web view for Linux is Qt's web engine. On Linux, Qt WebView depends on the Qt WebEngine module to render content. Currently or main concerned is the control on QT libraries. Current the app use system provided QT libraries. I am planning to ship a self contained package first. And the main concern around this is the deployment tree size. Removing these resources saved ~80MBs but I am not sure if that would break anything