Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • 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
    173 Views
    No one has replied
  • How to use QCoreApplication to set root permission to my app

    14
    0 Votes
    14 Posts
    9k 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
    375 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
    473 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
    180 Views
    No one has replied
  • Update axes in chart

    Solved
    2
    0 Votes
    2 Posts
    274 Views
    I
    @IknowQT said in Update axes in chart: [image: 228d5afb-594e-452b-b3b7-bba38e6bc2b2.png] [image: acf25438-d88f-4850-8bfa-281167d275cf.png] There are 2 examples provided by qt The first picture is a chart using QTableModel. The second picture is an example of zooming in, zooming out, and moving the chart using mouse events. In the second example, the ranges of the x and y axes are automatically updated when the mouse is moved. However, in the first example, the axis range is fixed. What I want ideally is to put the functionality of the second example into the first. If there is data in the table, the axes should also be updated automatically. How can I access it? It was resolved by calling the createDefaultAxes() function.
  • I don't understand the error content.

    Solved
    2
    0 Votes
    2 Posts
    175 Views
    Christian EhrlicherC
    include QScrollBar header.
  • 0 Votes
    6 Posts
    1k Views
    Vivek_AV
    @Christian-Ehrlicher @JonB Solved . By creating a seperate worker.cpp file and connected RTLSClient signal to worker slot, now data is inserting to mongodb very fast without freezing GUI. Thanks ..
  • dataChanged signal not reaching TableView unless I add 1 line of unrelated javascript

    Unsolved
    11
    0 Votes
    11 Posts
    802 Views
    ocgltdO
    I got it working - but can't explain why. I confirmed the dataChanged signal is being emitted and received in my class above. However, the table just does not redraw (getColor function is never called). However, if I add the ONE line of code below (in getColor), then the table redraws as expected!! (Putting this line into 'getColor' results in the signal causing the table to refresh, which causes 'getColor' to execute). Why? function getColor(row) { console.log("In getColor"); var i = companyTableISM.selectedIndexes; // <--- WHY DO I NEED THIS LINE if (companyTableISM.isSelected(companySFPM.index(row, 0)))
  • QT 3D scene export to file

    Unsolved
    1
    0 Votes
    1 Posts
    123 Views
    No one has replied
  • MIJ MYled widget libPlugin not install properly

    Unsolved
    4
    0 Votes
    4 Posts
    265 Views
    gfxxG
    @ChrisW67 you are in right ...i would use that library on qtdesigner as custom widget .... and would see every tips on designer about qled..... so i compile the libs and copy .so file on right istallation path of qt. At that time i can see .so file loaded on qt.creator plugin. But not possible to see that qled widget. Problem was on qled.h ..... but not know right macro to add for reach my goal.
  • Qt BLE not getting notifications / not emitting signal

    Unsolved
    1
    0 Votes
    1 Posts
    139 Views
    No one has replied
  • GUI frozen when runnable is finish

    Unsolved
    2
    0 Votes
    2 Posts
    233 Views
    C
    Signals sent cross-thread are queued, not instant/synchronous, and visual updates are also dependent on the Qt event loop being reached. If you block the event loop in your GUI thread then at least the visual updates will not happen. You would need to show how the plumbing of your program is set up† for us to help identify where the blockage is. † significant code snippets or, better yet, a complete, self-contained example that demonstrates the problem.
  • I cannot add plain "dialog"

    Unsolved
    4
    0 Votes
    4 Posts
    346 Views
    C
    That looks like Qt Creator (not sure which version). I assume you want to add a Qt dialog to your Qt C++ program. Am I following wrong procedure ? Yes This is what adding a dialog looks like in Qt Creator 5.0.1 or 6.02 [image: 72fcdf7a-1550-4d19-9f2a-f6f6b6a598a6.png] and then [image: d7f4ffb8-7920-4551-8ffa-4ec9370cea21.png] So where did you get your instructions?
  • NOT NULL constraint with existing "defaultValue"

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    JonBJ
    @StarterKit That result is what I exected it to say. Did you try out: Use QSqlField::setRequiredStatus(QSqlField::RequiredStatus required) to set it to QSqlField::Optional 0 The fields doesn't have to be specified when inserting records. Does that then generate the necessary INSERT statement? ?
  • Can't cross compile QtQuickControls 2

    Unsolved
    2
    0 Votes
    2 Posts
    190 Views
    F
    I had to copy the content of the mkspecs folder from qtbase/qtdeclarative/mkspecs/modules to /qtbase/mkspecs/modules ... I have no glue what went wrong here, but it works now.
  • isWritable() for NFS directory

    Unsolved
    4
    0 Votes
    4 Posts
    407 Views
    Kent-DorfmanK
    your problem is the uid mapping and/or mount options. that's why you can create files and edit files you create but otherwise cannot manage the directory. read the RFCs on NFS to determine the behaviour.
  • Connect QButton :: pressed and send qobject::name + bool value (because toggle)

    Solved
    4
    0 Votes
    4 Posts
    320 Views
    Christian EhrlicherC
    @gfxx said in Connect QButton :: pressed and send qobject::name + bool value (because toggle): Is the right way? When using a dynamic cast (or object cast) the return value can be a nullptr - you should check for this.
  • [SOLVED] start compiled QT Wayland compositor from tty.

    Unsolved wayland compositor qtwayland
    3
    0 Votes
    3 Posts
    710 Views
    SGaistS
    Hi and welcome to devnet, Glad you found a solution ! Can you share it so that other people encountering the same issue can benefit ?