Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • QTableWidget memory management

    Unsolved
    3
    0 Votes
    3 Posts
    317 Views
    F
    I wanted more proof, so I went digging. Header Items are deleted when the QTableModel is deleted. Here's a pictorial stack trace for posterity. [image: 7cfe509a-a60c-4007-ad7c-e528b4cac1d8.png] [image: 9778f7cc-254c-4c7f-815a-64bc2fa99ac8.png] [image: 7d4dd692-7d27-4cce-b6db-6e6bd4f6e931.png] [image: 9740807c-ab55-45e3-aadd-59e2ecd29b53.png]
  • Is it possible QMetaObject::invokeMethod with non-copyable argument?

    Solved
    5
    0 Votes
    5 Posts
    555 Views
    T
    @Chris-Kawa Thank you for the explanation and the solution. But I would argue that using unique_ptr is making it harder to keep track of ownership. The one holding the unique_ptr holds the data, it's simple as that.
  • How to drop an image onto google lens?

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    SGaistS
    Great ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)
  • Qt Service does not enter the event loop issue

    Solved
    17
    0 Votes
    17 Posts
    1k Views
    Cobra91151C
    @JonB @ChrisW67 Ok. I have properly debug the app and found out that QProcess, QStandardPaths::writableLocation and qgetenv are not working when app is a service. It seems that service functionality is limited. So, I decided to set my app to run at OS startup instead of a service. Now, it works well. The issue is resolved. Thanks.
  • Modify nested QJsonValue

    8
    0 Votes
    8 Posts
    13k Views
    H
    Here is an improved implementation: https://github.com/heksbeks/qjsonpath
  • Returning QReadLocker by value from a function?

    Unsolved qreadlocker
    2
    0 Votes
    2 Posts
    297 Views
    Kent-DorfmanK
    @CJha @CJha said in Returning QReadLocker by value from a function?: Are there any downsides to providing QReadLocker object as a return value from a function? Yes. It won't work. semaphores are special kinds of objects. By design, they should never be copied. Take simple counting semaphore. the count indicates whether a resource can acquire it. They are usually nothing more than an integer that is guaranteed atomic access. when you copy the integer the references are still to the old object, not the new one. On a larger note, I think your whole model is kind of flawed. Don't "wrap" semaphores. Therein lies the introduction of race conditions. Use a reference to the sole instance of a semaphore anywhere it is needed.
  • QObject and parent - two questions

    Unsolved
    5
    0 Votes
    5 Posts
    644 Views
    jeremy_kJ
    @TomNow99 said in QObject and parent - two questions: @Christian-Ehrlicher Thank you for answer. 1b) not pointer: And here I don't know. Have I set parent like this: object.setParent(someObject); ? A QObject instance deletes its children on destruction. If the stack allocated child isn't reparented or deallocated prior to that point, the program will likely crash. #include <QCoreApplication> #include <QObject> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QObject *heap = new QObject; QObject stack; stack.setParent(heap); printf("about to crash?\n"); delete heap; printf("are we still here?\n"); return 0; }
  • Get QLineSeries to also show the data points?

    Unsolved
    2
    0 Votes
    2 Posts
    225 Views
    JonBJ
    @Perdrix How to get each data point to be marked with e.g. a blob? I would guess https://doc.qt.io/qt-6/qxyseries.html#setPointConfiguration ? What's that blue blob at the top. The "legend" or whatever they call it for the blue line, which you have left empty/unnamed, see https://doc.qt.io/qt-6/qabstractseries.html#name-prop?
  • Exception calling QChart::removeAllSeries

    Solved
    3
    0 Votes
    3 Posts
    399 Views
    PerdrixP
    @JonB Yes that was part of it plus RemoveAll also deleted the line series, so now I have: if (nullptr != scoreSeries) scoreChart.removeSeries(scoreSeries); else scoreSeries = new QLineSeries(this); scoreSeries->append(x, fScore); scoreChart.addSeries(scoreSeries); scoreChart.createDefaultAxes();
  • Rid QtWidget signals inside QObject

    Unsolved
    2
    0 Votes
    2 Posts
    217 Views
    J.HilkJ
    @Omicron91 said in Rid QtWidget signals inside QObject: I have a tab based software, for each tab I wrote a class to separate the code and control each module. I used findChild method to get access to the widgets inside of the related tab. [image: 49986e85-c5d4-4f19-ab53-18ef49ee9fad.png] why bother with encapsulation at all when you do this ? My problem is trying to delete the instance of a specific tab and disconnect all signals of the widgets inside of a QObject on the destruct method instead of selecting a widget one by one and disconnecting their signals. when done properly, connects will "disconnect" as soon as one of the object instances gets destroyed, there should be no need for manual disconnect calls.
  • 0 Votes
    10 Posts
    2k Views
    C
    Hi, See if this provides some explanation (read the comments as well): StackOverflow: Qt6 QLabel / QPixmap excessive memory usage
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    39 Views
  • Cannot link my project against DLLs

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    V
    @JKSH Hi, Thank you for your help, too! I rebuilt the application in Release mode and copied the .exe to a new, clean directory location. D:\Qt\Deployments\SimpleQML Then, I added the ENV to the QT framework MinGW executables, so that I will be able to invoke the windeployqt.exe tool. $env:PATH += ";D:\Qt\QtFramework\5.9.7\mingw53_32\bin" And deployed via: PS D:\Qt\Deployments\SimpleQML> windeployqt.exe .\SimpleQML.exe D:\Qt\Deployments\SimpleQML\SimpleQML.exe 32 bit, release executable [QML] Adding Qt5Svg Qt5Widgets for qsvgicon.dll Direct dependencies: Qt5Core Qt5Gui Qt5Network Qt5Qml Qt5Quick All dependencies : Qt5Core Qt5Gui Qt5Network Qt5Qml Qt5Quick To be deployed : Qt5Core Qt5Gui Qt5Network Qt5Qml Qt5Quick Qt5Svg Qt5Widgets Updating Qt5Core.dll. Updating Qt5Gui.dll. Updating Qt5Network.dll. Updating Qt5Qml.dll. Updating Qt5Quick.dll. Updating Qt5Svg.dll. Updating Qt5Widgets.dll. Updating libGLESV2.dll. Updating libEGL.dll. Updating D3Dcompiler_47.dll. Updating opengl32sw.dll. Updating libgcc_s_sjlj-1.dll. Updating libstdc++-6.dll. Updating libwinpthread-1.dll. Patching Qt5Core.dll... Creating directory D:/Qt/Deployments/SimpleQML/bearer. Updating qgenericbearer.dll. Creating directory D:/Qt/Deployments/SimpleQML/iconengines. Updating qsvgicon.dll. Creating directory D:/Qt/Deployments/SimpleQML/imageformats. Updating qgif.dll. Updating qicns.dll. Updating qico.dll. Updating qjpeg.dll. Updating qsvg.dll. Updating qtga.dll. Updating qtiff.dll. Updating qwbmp.dll. Updating qwebp.dll. Creating directory D:/Qt/Deployments/SimpleQML/platforminputcontexts. Updating qtvirtualkeyboardplugin.dll. Creating directory D:/Qt/Deployments/SimpleQML/platforms. Updating qwindows.dll. Creating directory D:/Qt/Deployments/SimpleQML/qmltooling. Updating qmldbg_debugger.dll. Updating qmldbg_inspector.dll. Updating qmldbg_local.dll. Updating qmldbg_messages.dll. Updating qmldbg_native.dll. Updating qmldbg_nativedebugger.dll. Updating qmldbg_profiler.dll. Updating qmldbg_quickprofiler.dll. Updating qmldbg_server.dll. Updating qmldbg_tcp.dll. Creating D:\Qt\Deployments\SimpleQML\translations... Creating qt_ar.qm... Creating qt_bg.qm... Creating qt_ca.qm... Creating qt_cs.qm... Creating qt_da.qm... Creating qt_de.qm... Creating qt_en.qm... Creating qt_es.qm... Creating qt_fi.qm... Creating qt_fr.qm... Creating qt_gd.qm... Creating qt_he.qm... Creating qt_hu.qm... Creating qt_it.qm... Creating qt_ja.qm... Creating qt_ko.qm... Creating qt_lv.qm... Creating qt_pl.qm... Creating qt_ru.qm... Creating qt_sk.qm... Creating qt_uk.qm... PS D:\Qt\Deployments\SimpleQML> The result directory content is: Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 6/19/2023 12:52 PM bearer d----- 6/19/2023 12:52 PM iconengines d----- 6/19/2023 12:52 PM imageformats d----- 6/19/2023 12:52 PM platforminputcontexts d----- 6/19/2023 12:52 PM platforms d----- 6/19/2023 12:52 PM qmltooling d----- 6/19/2023 12:52 PM translations -a---- 3/11/2014 12:54 PM 3466856 D3Dcompiler_47.dll -a---- 10/16/2018 1:34 PM 22016 libEGL.dll -a---- 5/11/2015 2:38 PM 471519 libgcc_s_sjlj-1.dll -a---- 10/16/2018 1:34 PM 2807296 libGLESV2.dll -a---- 5/11/2015 2:38 PM 939212 libstdc++-6.dll -a---- 5/11/2015 1:26 PM 52036 libwinpthread-1.dll -a---- 6/14/2016 4:08 PM 15995904 opengl32sw.dll -a---- 6/19/2023 12:52 PM 6111744 Qt5Core.dll -a---- 10/16/2018 1:39 PM 6224896 Qt5Gui.dll -a---- 10/16/2018 1:37 PM 1798656 Qt5Network.dll -a---- 10/16/2018 2:05 PM 4088320 Qt5Qml.dll -a---- 10/16/2018 2:10 PM 4152320 Qt5Quick.dll -a---- 10/16/2018 1:51 PM 359936 Qt5Svg.dll -a---- 10/16/2018 1:42 PM 6361600 Qt5Widgets.dll -a---- 6/19/2023 12:49 PM 462336 SimpleQML.exe But again, when trying to start the SimpleQML.exe, I still get the familiar errors: [image: fccb79c9-5d30-4b37-9842-5616b33e1af0.PNG] [image: 1fd366ec-516d-4ec1-8279-c0b68111086f.PNG] [image: 5c47a59f-3537-45a4-b225-4db02cda2d75.PNG] [image: 4ad28014-0ff2-4793-b76e-a175ea12858a.PNG]
  • Calling c++ object functions through QWebChannel

    Solved
    6
    0 Votes
    6 Posts
    671 Views
    M
    @JonB I made a stupid mistake
  • User of Qt app needs Mouse cursor size help

    Unsolved
    13
    0 Votes
    13 Posts
    3k Views
    jsulmJ
    @Dinosaur1946 said in User of Qt app needs Mouse cursor size help: Obviously nobody here either recognises it as a Qt or problem This is user forum mainly driven by volunteers. If you think this is a Qt bug then you should report it here: https://bugreports.qt.io/secure/Dashboard.jspa
  • Draw text and numbers in dot matrix format

    Solved
    6
    0 Votes
    6 Posts
    929 Views
    G
    @mpergand @Pl45m4 Works, thanks. But I still had to do a trick, when the start and end point is the same, sum 0.1 to the end point. . I'll try the framework and font suggestions in the project review phase, which I definitely need to do. (The qt4 port must work fine first, probably in the qt5/6 port).
  • Is there a way of using QPF2 font format on Desktop application?

    Unsolved
    4
    0 Votes
    4 Posts
    502 Views
    SGaistS
    Since it's explicitly stated as a Qt for Embedded Linux feature, my educated guess is that the support for it will only be built if you do such a Qt build.
  • 0 Votes
    2 Posts
    205 Views
    G
    @giusdbg Found. I have a number of object derivations from the QFrame object, to prevent connects on child objects from failing, I have to use the setParent( parent ) function. Apparently I was using it in a gray and unexpected area in the construction of qt objects and events. By moving the setParent to the end of each final derived object and also placing the call to show(), it works much better. (waiting to be able to fix the connect and use the qt in a more orthodox way).
  • What palette role/attribute sets the line color of QFrame "setLineWidth" ?

    Unsolved
    3
    0 Votes
    3 Posts
    554 Views
    E
    @Abderrahmene_Rayene said in What palette role/attribute sets the line color of QFrame "setLineWidth" ?: palette.setBrush(QPalette::Active, QPalette::Light, brush1); Yes, thank you. So the answer to my question is alette.setBrush(QPalette::Active, QPalette::Light, brush1); palette.setBrush(QPalette::Active, QPalette::Dark, brush1);
  • How to Run Python Shell ( or any other shell ) with QProcess

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    posktomtenP
    Works for me. #include <QCoreApplication> #include <QProcess> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString prg = "C:/Users/posktomten/AppData/Local/Programs/Python/Python310/python.exe"; QStringList ARG; ARG << "-c" << "print(int(2)+int(2))"; QProcess *process = new QProcess(nullptr); process->setProcessChannelMode(QProcess::MergedChannels); process->start(prg, ARG); QObject::connect(process, &QProcess::readyReadStandardOutput, [process]() { QString result(process->readAllStandardOutput()); QTextStream(stdout) << result; }); return a.exec(); } Clean up #include <QCoreApplication> #include <QProcess> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString prg = "C:/Users/posktomten/AppData/Local/Programs/Python/Python310/python.exe"; QStringList ARG; ARG << "-c" << "print(int(2)+int(2))" << "exit()"; QProcess *process = new QProcess(nullptr); process->setProcessChannelMode(QProcess::MergedChannels); process->start(prg, ARG); QObject::connect(process, &QProcess::readyReadStandardOutput, [process]() { QString result(process->readAllStandardOutput()); QTextStream(stdout) << result; QObject::connect(process, &QProcess::finished, [process]() { delete process; }); }); return a.exec(); } Or run a script // ARG << "-c" << "print(int(2)+int(2))" << "exit()"; ARG << "test.py";