Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Perf Data Parser failed - Qt Creator

    Solved
    2
    0 Votes
    2 Posts
    762 Views
    S
    @shreya_agrawal The issue was solved. Follow these steps: Add this line in the /etc/sysctl.conf file and then save the file: kernel.perf_event_paranoid = -1 Earlier, the perf_event_paranoid was set to 4, which was the cause of the error. -1: Allow use of (almost) all events by all users 0: Disallow raw and ftrace function tracepoint access 1: Disallow CPU event access 2: Disallow kernel profiling Then, apply the changes by running the following command: sudo sysctl -p
  • Activate QWidget with a modal QDialog

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    M
    @JonB Dear, I've figured out the issue.. It is the parameter parent in the constructor QDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()) matters. I used it as nullptr. After passing the pointer of the main widget to QDialog, it behaviours as the same as my desire. However, it is true that the widget does not receive any events, such as QEvent::WindowActivate :-)
  • `QSortFilterProxyModel` incorrect mapping indexes from source model

    Unsolved
    17
    0 Votes
    17 Posts
    978 Views
    Please_Help_me_DP
    @Christian-Ehrlicher alright I just decided to forbid table view sorting for the python side. It is strange that C++ side works and Python fails. But there are some chances that the reason of that is my personal additions so I will take some time to investigate it.
  • How can I set the id field of an inserted QSqlRecord?

    Unsolved
    10
    1 Votes
    10 Posts
    799 Views
    JonBJ
    @jdent Please append a qDebug() statement to each of your append/insert code fragments showing what you are comparing which you say changes/does not change.
  • Can't build QT6 on Windows using MingWin54

    Unsolved build failed mingw 64 bit qt6.5
    7
    0 Votes
    7 Posts
    1k Views
    Christian EhrlicherC
    @rahmanih said in Can't build QT6 on Windows using MingWin54: Git BASH to run the build command. You must not have any MSYS related stuff in your PATH - otherwise the build tools might pick them up (due to same name) and it will fail. You can see the problem already in your first output if I'm correct: "@C:/temp/qt6_min/qtbase/src/3rdparty/libjpeg/JpegPrivate_syncqt_args" - the forward slashes (but I might be wrong)
  • ID based translation with CMAKE creates superfluous entries in TS file

    Solved
    5
    0 Votes
    5 Posts
    286 Views
    DialecticusD
    I used Qt Maintenance Tool, and after 2 x 6.2 GB downloads (the first one ended abruptly while I wasn't watching), and some non-obvious-to-a-beginner hurdles to switch to new toolset, I fixed my problem. Qt 6.6.3 doesn't have the bug.
  • 0 Votes
    12 Posts
    1k Views
    Christian EhrlicherC
    Please read the docs of submitAll(): "In OnManualSubmit, on success the model will be repopulated. Any views presenting it will lose their selections."
  • Why is my QT Application breaking in disassembly code on debug start?

    Unsolved
    19
    0 Votes
    19 Posts
    2k Views
    J
    @ngocanhnu I don't think that's quite the same problem, but thank you.
  • How do I update a row in the model and commit to database?

    Solved
    3
    0 Votes
    3 Posts
    206 Views
    JonBJ
    @jdent You do not need to drop down to accessing the model directly via QModelIndex and setData(). You can do it via the QSqlRecord. After you went rec.setValue(1, val); you need to call bool QSqlTableModel::setRecord(int row, const QSqlRecord &values) to transfer the altered in-memory rec to the model: QSqlRecord rec = tm.record(0); QModelIndex idx = tm.index(0, 3); qDebug() << rec.value(3).toString(); qDebug() << idx.data().toString(); auto val = rec.value(3).toString(); val += "###"; rec.setValue(3, val); qDebug() << rec.value(3).toString(); qDebug() << idx.data().toString(); tm.setRecord(0, rec); qDebug() << rec.value(3).toString(); qDebug() << idx.data().toString(); This shows the underlying model altered after the tm.setRecord(0, rec); statement. You can then commit() or whatever if you wish. record() generates a copy of what is in a model row. setRecord() is required if you alter that and want to write it back to the model row.
  • Missing CAP_NET_ADMIN permission.. REPOST

    Unsolved
    3
    0 Votes
    3 Posts
    467 Views
    JonBJ
    @gumtown Plenty of questions/solutions to this from Googling. See e.g. https://stackoverflow.com/questions/60989706/qt-bluetooth-stuck-when-connecting-to-classic-bluetooth-device You are trying to run your software as a non-root user. Try sudo setcap 'cap_net_raw,cap_net_admin+eip' yourapplication
  • QGraphicsView repeatedly updated when inserting thousands of QGraphicsItems

    Unsolved
    9
    0 Votes
    9 Posts
    822 Views
    JonBJ
    @wujie If your situation is " the same as yours [OP's]" then you are showing too many points, as several responders said. If you want to "add a batch of many items" you could temporarily detach the changed() slot as the OP wrote, or call blockSignals(). Having said that I'm not sure what the OP's actual issue was. While it is true that changed() would be called many times it is not true that each of these causes any visible update to the view. The view is only visually updated the next time the event loop is entered, at which time it should see so many updates that it does not do each one at a time but rather just decides to redraw the view a single time.
  • QTreeWidgetItem setBackground after stylesheet applied has no effect

    Solved
    5
    0 Votes
    5 Posts
    349 Views
    R
    @JonB Thank you for your reply. I will mark this thread as solved and try it out, thanks. Have a good one :)
  • 0 Votes
    4 Posts
    254 Views
    JonBJ
    @jdent No, there is no findId() or similar method, else you would see it on https://doc.qt.io/qt-6/qsqlrelationaltablemodel-members.html. If you wish to find it efficiently, e.g. if you have a thousand records in memory and don't want to search them sequentially each time, you can add a QSortFilterProxyModel on top of your QSql[Relational]TableModel, or sort the underlying model. Then if you set the sort to be by primary key you know the rows are in ascending primary ley order so you can use a binary search to find a given ID very fast. You do not need to use such an extra QSortFilterProxyModel for your view, you could just add it for the purpose of searching. You might get away without bothering to add one. Without a sort the statement will be SELECT * FROM table, with no ORDER BY clauses. Many/most SQL databases will deliver rows in primary key order when no ORDER BY is specified. If your ID column is the primary key they will appear in ID order (and so can be binary searched). However I would regard this as "fragile" as it relies on underlying SQL database behaviour. You could also impose a QSortFilterProxyModel and use its setFilter("id = ...") to pick out a given ID. However this does its work by issuing a SELECT ... WHERE id = ... against the table, not be searching rows already read in, and I don't think this is what you are looking for.
  • Debug version of libraries

    Unsolved
    2
    0 Votes
    2 Posts
    203 Views
    C
    You should ask whoever supplied the Qt libraries in the Windows cross-compilation environment on Linux that you are using. If you constructed this environment yourself then it is up to you to build Qt with relevant options.
  • Sorting list of structure based on specific ID parameter

    Unsolved
    7
    0 Votes
    7 Posts
    380 Views
    C
    @Christian-Ehrlicher The OP seems to want to add a series of consecutively numbered items to a list (the the number is "id"), remove arbitrary items, and have the items remaining still be consecutively numbered. Iterating over the list is solution to the question posed, but I think this is an XY Problem. This numbering: repeats information that is available simply from the index in the list, negates the typical purpose of an immutable identifier, and enforces a common anti-pattern that monotonically numbered items need to be/stay gap free, in this case causing more busy work.
  • 0 Votes
    2 Posts
    127 Views
    J
    @jdent I am pretty sure this is it!!
  • QSqlQuery does not return a record set?

    Solved qsqlquery results
    7
    0 Votes
    7 Posts
    723 Views
    J
    @Christian-Ehrlicher Thanks!!
  • how to use "cascaded connect "?

    Moved Unsolved
    7
    0 Votes
    7 Posts
    550 Views
    Pl45m4P
    @AnneRanch said in how to use "cascaded connect "?: How do I code the "child class" to use the "parent class " "connect"? After reading this again... is it about INHERITING signals/slots from "parent" or a base class? Your "parent" as you call it, has a signal ping() and is connected to a slot in widget B... and now you want to have the same connection to B in a child QObject of A? That's not possible. Parent/Child are two different QObjects and you have to connect each independently. You can inherit signals from a base class, but class inheritance is not the same thing as a QObject Parent-child relation....
  • QString Turkish Character Problem

    Unsolved
    4
    0 Votes
    4 Posts
    828 Views
    Christian EhrlicherC
    @JonB said in QString Turkish Character Problem: how ridiculously complicated language encoding is in C++! It's more a windows/msvc problem using anything else but utf-8 for the source files and even during runtime.
  • Tab order does not work in Qt

    Moved Unsolved
    2
    0 Votes
    2 Posts
    461 Views
    Christian EhrlicherC
    Please provide a minimal, compilable example of your problem. No designer stuff needed to reproduce this issue.