Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • How to use curl cmd in c++/qt

    Unsolved
    16
    0 Votes
    16 Posts
    3k Views
    jeremy_kJ
    Rather than continuing to ask for and provide step by step corrections, I suggest using a dummy program in place of curl to show what arguments curl is receiving. #include <cstdio> int main(int argc, char **argv) { for (int i = 0; i < argc; i++) printf("arg %d is '%s'\n", i, argv[i]); }
  • Why it fails to decrypt with OpenSSL

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    lincolnL
    @ChrisW67 Thanks for your answer, by the way I mention that I was testing the QAESEncryption class, and it also gave me a good result. thanks again for your comment
  • macos: [CATransaction synchronize] called within transaction

    Unsolved
    13
    0 Votes
    13 Posts
    4k Views
    S
    @SGaist add tifflib-4.5.1,then problem occurred. why?
  • How to open MainWindow always on top

    Unsolved
    4
    0 Votes
    4 Posts
    554 Views
    CKurduC
    @JacobNovitsky Maybe a silly question but Did you use setWindowFlags(Qt::WindowStaysOnTopHint) ? #include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow mainWindow; mainWindow.setWindowTitle("Example Top App"); mainWindow.setWindowFlags(Qt::WindowStaysOnTopHint); mainWindow.show(); return app.exec(); } If you are on Linux OS, document also says "Informs the window system that the window should stay on top of all other windows. Note that on some window managers on X11 you also have to pass Qt::X11BypassWindowManagerHint for this flag to work correctly."
  • How to call Registeration-Free COM dll?

    Solved
    36
    0 Votes
    36 Posts
    7k Views
    hskoglundH
    Hi, the XML/manifest for the .exe, you forgot the "X" - suffix, it is necessary for reg-free COM to work, try change the XML to: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"></assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity name="DataTypesLibrary.X" version="1.0.0.0" type="win32" language="*" processorArchitecture="*"></assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity name="RecipeManagement.X" version="1.0.0.0" type="win32" language="*" processorArchitecture="*"></assemblyIdentity> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> </assembly> You already have a DataTypesLibrary.X.manifest file that works the DataTypesLibrary.dll written in C++ I think you should try the same with your C# RecipeManagement.dll, i.e. create a RecipeManagement.X.manifest file with something like this in it: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity name="RecipeManagement.X" version="1.0.0.0" type="win32" processorArchitecture="msil" /> <file name="RecipeManagement.dll"> <clrClass clsid="{B0AFB6EB-67CB-457E-8709-B6384B02558B}" threadingModel="Both" name="RecipeManagement.SystemSettings" runtimeVersion="v4.0.30319" /> <comClass progid="RecipeManagement.SystemSettings" clsid="{B0AFB6EB-67CB-457E-8709-B6384B02558B}" threadingModel = "Apartment" /> </file> </assembly> I'm just guessing, but try first with a separate RecipeManagement.X.manifest file (not embedded in the .dll) with the above contents. Also I don't know if <clrClass> should be inside or outside the <filename XML line, you could try both. Note that you also need the <typelib tlibid=xxx XML inside the <file.. (see my example above for the DataTypesLibrary.X.manifest) but that you can do a later step. About the empty sxstrace trace.txt log file, yes sometimes it doesn't work and gives an empty log file, try logging in/out or rebooting your PC. When it works it will show traces for other ,exe files like edge,exe as well so you'll have to scroll/search for your file. Note: there's a typing error above, here are the commands again: sxstrace trace -logfile:sxstrace sxstrace parse -logfile:sxstrace -outfile:trace.txt
  • 0 Votes
    3 Posts
    685 Views
    V
    @JoeCFD great!! Will start experimenting
  • How to redirect std::out & std::err to a qDebug() message

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    Paul ColbyP
    Hi @ademmler, Just for inspiration, here's a class I use for capturing std::cout for verifying output in unit tests. You should be able to use it for std::err too, and then either qDebug() the captured text, or invoke your installed message handler directly, as @JonB suggested. Note, though, this would only work for code that uses the std::cout and/or std::cerr C++ output streams, which is close but not quite the same as, for example, plain C code writing to the stdout or stderr file stream pointers, so it depends on how your included libraries, etc are writing their output. /*! * Implements a simple RAII capture of output streams. */ class OutputStreamCapture { public: explicit OutputStreamCapture(std::ostream * const stream) : stream(stream) { originalBuffer = stream->rdbuf(newBuffer.rdbuf()); } std::string data() const { return newBuffer.str(); } ~OutputStreamCapture() { stream->rdbuf(originalBuffer); } private: std::ostringstream newBuffer; std::streambuf * originalBuffer; std::ostream * stream; }; Use it like: const OutputStreamCapture capture(&std::cout); // do stuff that might output to std::cout. qDebug() << capture.data(); Again, this won't capture non-C++ streams, but at least it is portable (on Linux, macOS and Windows at least). Hope that helps. Cheers.
  • How to match each number within alphanumeric string.

    Unsolved
    20
    0 Votes
    20 Posts
    2k Views
    ademmlerA
    @JonB Are you in printing business or have experience? If you like let us have a Skype chat on this - might be easier.
  • QSortFilterProxyModel crash with no reason due to QT internal calls

    Unsolved
    4
    0 Votes
    4 Posts
    653 Views
    SGaistS
    @vijaychsk did you apply my suggestion of going through the model tester ?
  • Problems with providing arguments to QProcess

    Solved desktop qprocess qt4 qstringlist
    10
    0 Votes
    10 Posts
    8k Views
    SGaistS
    Hi, There is a simpler method: setStandardOutputProcess. Use one QProcess for each element of your pipe. That way you recreate your chain in code and no dependency on shell handling.
  • Can't spawn "git": No error at init-repository line 207.

    Unsolved
    9
    0 Votes
    9 Posts
    546 Views
    SGaistS
    Then I fail to see why you are calling again init-repository each time rather than just pull all repos and then switch to the appropriate commit.
  • Disable error for c++17

    Unsolved
    5
    0 Votes
    5 Posts
    570 Views
    SGaistS
    @ellorenz hi, The switch to Qt 6 is currently not done on the user variant of KDE neon and even so, Qt 5 and Qt 6 can be co-installed on the same system.
  • 0 Votes
    4 Posts
    325 Views
    SGaistS
    I was rather thinking of a run time check such as with strace.
  • Module URI different than folder structure in cmake

    Unsolved cmake qml qt6 modules
    1
    0 Votes
    1 Posts
    367 Views
    No one has replied
  • Can QT create a widget and add it to the layout in one line ?

    Unsolved
    2
    0 Votes
    2 Posts
    271 Views
    Pl45m4P
    @John-Van How about layout->addWidget(new Widget()); ? I dont think using two lines makes it any more complicated. And sometimes you dont want to add a widget directy to something
  • options for the QModbusClient socket

    Unsolved
    1
    0 Votes
    1 Posts
    154 Views
    No one has replied
  • Attempted static link of dynamic object '/usr/lib/x86_64-linux-gnu/LibQt5Svg.so'

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    C
    @Matiyash https://doc.qt.io/qt-6/build-sources.html
  • How to recover a binary tree from a traversal?

    Unsolved
    1
    0 Votes
    1 Posts
    192 Views
    No one has replied
  • Display only superscript char mixed with regular char in a QTableWidget

    Unsolved
    7
    0 Votes
    7 Posts
    459 Views
    Axel SpoerlA
    @canellas If the simple POC needs proper formatting, then there's no way around the right tools IMHO. In this case, the delegate the tool of choice. Trying to format cell content, mixed with cell widgets is drilling a wood screw into a screw nut. It will hold somehow, while looking ugly. Sorry for not being able to provide a better advice!
  • Is it ok to draw in a QPixmap from a background thread?

    Unsolved
    5
    0 Votes
    5 Posts
    380 Views
    S
    @Akshaya-Shanker said in Is it ok to draw in a QPixmap from a background thread?: I tried and it seems to work fine . Just because it works fine now on your computer does not mean that it will work fine in the future or on other computers. Please do respect the documentation and save yourself some headaches down the road. I am talking from experience. If the Qt documentation states that you shouldn't do something, you'll get a crash eventually. It's even worse when it is not reproducible and you cannot debug it.