Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Need help to correct the following error :

    Unsolved
    3
    0 Votes
    3 Posts
    298 Views
    J.HilkJ
    @Antoine3616 possibly/typically this is a x86/x64 mismatch issue or, minnow/msvc issue. Usually a problem caused by the person who shipped that program to you or you have somehow an other qt installation in your system path, that is a mismatch and causes the issue. Than its on you :D
  • Deploy UI file on QNX

    Unsolved qt5.13.2 qnx ui file qml convert
    2
    0 Votes
    2 Posts
    595 Views
    jsulmJ
    @surajj4837 said in Deploy UI file on QNX: This step is not happening What does this mean please? Post error message or describe better what happens. Do you have CMake in your QNX SDK?
  • Create a "UI tour" (like in Qt Creator)

    Solved
    5
    1 Votes
    5 Posts
    851 Views
    H
    @kkoehne Thanks
  • QStack<QJsonValue>, peek not found...

    Solved
    5
    0 Votes
    5 Posts
    456 Views
    SPlattenS
    @Christian-Ehrlicher, thank you, just realised the same during debugging.
  • Emitting signal based on index

    Unsolved
    6
    0 Votes
    6 Posts
    732 Views
    J.HilkJ
    @jars121 just in case you're still looking for a solution to your original question, and/or someone else finds his/her way over google to here: #include <array> class SomeClass : public QObject { Q_OBJECT typedef void (SomeClass::*SomeClassFunction)(); std::array<SomeClassFunction,3> arrayOfSignalsPointers{&SomeClass::signal1,&SomeClass::signal2, &SomeClass::signal3}; std::array<SomeClassFunction, 3> arrayOfSlotsPointers{&SomeClass::slot1, &SomeClass::slot2, &SomeClass::slot3}; public: explicit SomeClass(QObject *parent = nullptr) : QObject(parent) { QObject::connect(this, &SomeClass::signal1, this, &SomeClass::slot1); QObject::connect(this, &SomeClass::signal2, this, &SomeClass::slot2); QObject::connect(this, &SomeClass::signal3, this, &SomeClass::slot3); qDebug() << "Emit all signals"; for(auto entry : arrayOfSignalsPointers){ (this->*entry)(); } qDebug() << "Call all slots directly"; for(auto entry : arrayOfSlotsPointers){ (this->*entry)(); } } signals: void signal1(); void signal2(); void signal3(); public slots: void slot1(){qDebug() << Q_FUNC_INFO;} void slot2(){qDebug() << Q_FUNC_INFO;} void slot3(){qDebug() << Q_FUNC_INFO;} };
  • Application crash on emit signal

    Solved
    5
    0 Votes
    5 Posts
    2k Views
    D
    It took me a while to get to the bottom of this because the error I was getting was neither straightforward (nor consistent after I switched to a debug build), but here is, in essence, what happened: I was keeping track of references to the runners with QSharedPointers. I had popped the reference off the list, put it in a QVariant, and passed it along with the runner. Evidently, this didn't prevent the reference count from dropping to zero, and the object was deleted some time shortly after the thread started executing. It was just a dummy object for testing, so it managed to complete execution before the objects' deletion, but wasn't able to live long enough to emit the signal.
  • Insert data into sqlite is very slow by QSqlQuery

    Solved
    6
    0 Votes
    6 Posts
    5k Views
    zhiyiYoZ
    @tham said in Insert data into sqlite is very slow by QSqlQuery: I find the solution, the answer is do not use execBatch, this api is ultra slow for sqlite database, you should start a transaction first and bind your value in for loop + exec qDebug()<<"can start a transaction:"<<QSqlDatabase::database().transaction(); for(int i = 0; i != data_table.id.size(); ++i){ query.bindValue(0, data_table.id[i]); query.bindValue(1, data_table.room[i]); query.bindValue(2, data_table.name[i]); query.exec(); } qDebug()<<"end transaction:"<<QSqlDatabase::database().commit(); With this solution, I am able to insert 663581 data in one second, much faster than execBatch(around 180 data in one second). Both of them have the same pragma setting. PRAGMA synchronous = OFF PRAGMA journal_mode = MEMORY Awesome😆
  • How can I hide my Api key?

    Solved qt creator firebase api qt6
    5
    0 Votes
    5 Posts
    1k Views
    Kent-DorfmanK
    ever hear of macro guarded code inclusion and .gitignore?
  • This topic is deleted!

    Solved
    10
    0 Votes
    10 Posts
    283 Views
  • Qt printing using html and QTextDocument

    Unsolved qtquick qtextdocument qprinter html pdf
    7
    0 Votes
    7 Posts
    2k Views
    K
    syntax from documentation for border <width>px <border-style> <border-color> That's mean it should be px after border.
  • QDir doesn't see some files

    Solved
    3
    0 Votes
    3 Posts
    390 Views
    S
    Hi @mchinand, thanks! It works perfectly.
  • Qt 6.2 pixmap(Qt::ReturnByValueConstant) syntax

    Solved
    5
    0 Votes
    5 Posts
    907 Views
    R
    @JKSH Thanks!
  • QPushButton with icon, dressing size?

    Solved
    10
    0 Votes
    10 Posts
    5k Views
    M
    @SPlatten You're right, I missed setIcon() in QAbstractButton. No need to paint anything, good to know.
  • How can a child form use parent 's form model

    Unsolved
    8
    0 Votes
    8 Posts
    981 Views
    JonBJ
    @Panoss said in How can a child form use parent 's form model: but it crashes on the last line That's what a debugger is for! Run it in debugger, allow to crash, look at stack trace window. If a line "crashes", break it into separate code to test intermediate results. For all I know there may not even be a fieldIndex("name")....
  • 0 Votes
    5 Posts
    1k Views
    K
    Sorry for my English. This problem is caused by qstringlist. In the code, I use qstringlist to store the original data collected by the sensor (the data type is int,I use qstring::number to convert int to qstring ), store it once per second, write the data to the file every ten minutes and empty the qstringlist. When the number of qstringlist elements exceeds 2 million (not fixed, related to the number of threads (running the same code: saving, writing files, emptying) and the number of such qstringlists), the program will crash automatically after running for a period of time (under MinGW compiler, the program will exit directly; under mvsc compiler, the program interface will turn white and get stuck). I guess the reason is that the list will generate memory fragments. With the increase of program running time, such memory fragments will increase (there are many vectors with variable length in my program that will be generated and destroyed every second. Under the interaction of the two, there will be less and less large continuous memory left in the memory). Therefore, after the program runs for a period of time, when executing "for (int j = 0; J < x_dataforsave. Size(); j + +) {data1. Append...}", there is not enough continuous memory left for data1 (qstring stores its data in an array of char type). The program crashes because it can't allocate memory, and sometimes QT doesn't give a warning. To solve this problem, I use qvector < int > to store the data collected by the sensor, and use fromrawbyte to get qbytearray. Because I don't know much about the basic principle of computer, I have been perplexed by this problem for a long time. I hope this answer can be helpful to people with similar confusion. Thank @ JonB for your help. I find It is not convenient to use debugger to locate such problems, because the time of program crash is not fixed, and the program has many threads, so it is difficult to locate them by breaking points; If I don't break the point, the program will exit automatically, and the debugger won't stay at the moment when the program crashes.
  • 0 Votes
    1 Posts
    154 Views
    No one has replied
  • How to use QCoreApplication to set root permission to my app

    14
    0 Votes
    14 Posts
    8k Views
    JonBJ
    @xenovas https://doc.qt.io/qt-5/qcoreapplication.html#setSetuidAllowed says: If allow is false (the default) and Qt detects the application is running with an effective user id different than the real user id, the application will be aborted when a QCoreApplication instance is created. Let's assume setSetuidAllowed(true) does not work. Maybe if your first statement in main() before creating QCoreApplication is to switch over to effective uid == real uid then all works fine, and you only switch back to root effective uid at the instant you need to do a root uid operation. So instead of trying to start the UI setuid. I don't know, only a thought, you would have to try.
  • QAbstractTableModel column hide

    Unsolved
    2
    0 Votes
    2 Posts
    350 Views
    I
    @IknowQT said in QAbstractTableModel column hide: [image: 6adcaf3e-9182-419d-be6e-c1be5abf99ac.png] I am developing a frozen table view. The table view is linked with the chart using QAbstractTableModel. Added frozen tableview to tableview. Because they use the same model, the data appears redundant. Looks like I need to remove the first line or make it visible(false). How can I solve this? ================================================================================ [image: d82896d0-10c4-48bf-bc52-d15001eee81f.png] Tried the other way and the problem I was talking about solved. However, it is updated with the value of the row I clicked.
  • QAudioOutput on two devices(headphones)

    Unsolved
    6
    0 Votes
    6 Posts
    431 Views
    S
    @SGaist Hello. Qt 5.12.1 MinGW 64-bit. At first I didn't use threads. It didn't work correctly. I hear intermittent sound . I decided threads would help. Add each QAudioOutput on separate thread . m_audioOutput.reset(new QAudioOutput(deviceInfo, format)); m_audioOutput->start(m_audioInfo.data()); _outputThread = new QThread(); m_audioOutput->moveToThread(_outputThread); _outputThread->start(); It did not help too. Two QAudioOutput don't work as with threads as without threads. (Two QAudioOutput work, but I hear intermittent sound. Wheh work one QAudioOutput I hear correctly sound )
  • When using setSelectionModel of TableView

    Unsolved
    1
    0 Votes
    1 Posts
    158 Views
    No one has replied