Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.3k Posts
  • (Cross-)Compiler Qt6.8 for Ubuntu and Raspberry Pi

    Solved
    3
    0 Votes
    3 Posts
    814 Views
    M
    Thank you. I installed gcc-11 and g++-11 and it worked.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Qt 6, Qt.Future .then freezess app

    Unsolved qfuture thread
    6
    0 Votes
    6 Posts
    655 Views
    D
    @SGaist I have QApplication - gui one. ah yes the int main() is just a quick hack/example... there full widget app with buttons running :- ) Also I got it to work, I ended up getting nested futures, and the path to fix that is .unwrap()>https://doc.qt.io/qt-6/qfuture.html#unwrap Seems to work! :D Threading and linking to context still seem to be broken tho o.o
  • QT with oculus quest

    Unsolved
    2
    0 Votes
    2 Posts
    206 Views
    SGaistS
    Hi, I don't know whether it's going to be what you need but take a look at this blog article.
  • 0 Votes
    31 Posts
    3k Views
    artwawA
    @mbruel said in QIODevice::waitForReadyRead question. comparison with async method and usage of waitcondition?: OP? Orignal Poster - in this case: You.
  • Touchpoint pressure information not reported on Raspberry Pi5 (aarch64)

    Unsolved
    1
    0 Votes
    1 Posts
    115 Views
    No one has replied
  • 0 Votes
    9 Posts
    2k Views
    T
    Probably a better solution is to select the Qt Image Formats module in MaintenanceTool (the online installer). It isn't installed by default and won't include webp support.
  • Help with QTreeView

    Unsolved
    10
    0 Votes
    10 Posts
    443 Views
    A
    @JonB 3 CompanyModel::rowCount CompanyModel.cpp 61 0x7ff6151b51d8: else if (parent.internalId() >= 0 && parent.internalId() < companies.size()) { return companies.at(parent.internalId()).departments.at(parent.row()).employees.size(); 5 CompanyModel::index CompanyModel.cpp 11 0x7ff6151b4d4a: if (!hasIndex(row, column, parent)) return QModelIndex();
  • Incorrect painting or geometry of custom widget

    Solved
    7
    0 Votes
    7 Posts
    408 Views
    JonBJ
    @Kirill-Gusarev said in Incorrect painting or geometry of custom widget: yes I know about QWidget::geometry() Then why do you define a member variable with the same name as the base class has for a public method? but if I use this method, the error will be different QWidget::geometry() simply returns the current geometry of a widget. It is const, has no side-effects and does not cause errors. I suggested you rename your member variable from geometry to anything else you like, which does not clash with a public symbol from QWidget. And change all your calls to use the new name you pick. If that causes any change of behaviour at all you have a real problem....
  • how to give a gradual color style to a QTableWidget item

    Unsolved
    5
    0 Votes
    5 Posts
    415 Views
    Pl45m4P
    @Blackzero said in how to give a gradual color style to a QTableWidget item: problem is that the color I make does not match the image So your problem is that you dont know how to calculate the correct color for each value and not how to set a color to a QTableWidgetItem as @artwaw is showing?! If you want to map values from 0 to 15.000 (15.001 "steps"), you need to normalize your data first, since RGB takes 1byte (0-255) for each channel. Then, apply your desired colorization. You could, for example, look at OpenCV's colorMap function applyColorMap (here). The general "heat map" (blue to red) color map is called "JET" there. Here is how JET is implemented: (other maps have different LUTs, of course) https://github.com/opencv/opencv_attic/blob/master/opencv/modules/contrib/src/colormap.cpp#L231 If your data is normalized, you can read the matching color value from that LUT. Tip: Before you add that "monster" of a LUT (3x 256 floats) to your setData function, I suggest making a new util class called HeatMap or something like that and continue from there... implement mapping function, get data from map/LUT... etc. If I'm not mistaken I already wrote something like that in another topic of yours. Edit: OR, if you have more things like this in mind, you might consider using OCV directly and adding it to your project. PS: Instead of a static Look-Up-Table you can also interpolate the color steps yourself with a function like this https://stackoverflow.com/a/20793850 This comment is IMO way better than the accepted answer to the topic on StackO, as it's a more general solution and allows setting a 3-step gradient for your mapping (min, mid, max)... in case you don't want "blue to red over green" anymore :)
  • export CMake variable to C++

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    D
    I make code example for both ways. Here
  • QSerialPort::SerialPortError::TimeoutError ? what can I do ?

    Unsolved
    6
    0 Votes
    6 Posts
    393 Views
    K
    I assume, you are use the Linux... https://github.com/qt/qtserialport/blob/dev/src/serialport/qserialport_unix.cpp#L986 look on: if (ret == 0) { setError(QSerialPortErrorInfo(QSerialPort::TimeoutError)); return false; } prevouosly, the qt_safe_poll has been implemented something like that (e.g. up to Qt6, e.g. in Qt 5.15): https://github.com/qt/qtbase/blob/5.15/src/corelib/kernel/qcore_unix.cpp#L150 int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts) { if (!timeout_ts) { // no timeout -> block forever int ret; EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr)); return ret; } timespec start = qt_gettime(); timespec timeout = *timeout_ts; // loop and recalculate the timeout as needed forever { const int ret = qt_ppoll(fds, nfds, &timeout); if (ret != -1 || errno != EINTR) return ret; // recalculate the timeout if (!time_update(&timeout, start, *timeout_ts)) { // timeout during update // or clock reset, fake timeout error return 0; } } } look on: // timeout during update // or clock reset, fake timeout error return 0; so, the ret-code with 0-value was interpreted as a some TimeoutError (only when you ar euse the waitFor metrods, on Linux). But right now, in Qt6, the implementation of qt_safe_poll seems a bit different: https://github.com/qt/qtbase/blob/6.8/src/corelib/kernel/qcore_unix.cpp#L121 look on: int qt_safe_poll(struct pollfd *fds, nfds_t nfds, QDeadlineTimer deadline) { if (deadline.isForever()) { // no timeout -> block forever int ret; QT_EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr)); return ret; } using namespace std::chrono; nanoseconds remaining = deadline.remainingTimeAsDuration(); // loop and recalculate the timeout as needed do { timespec ts = durationToTimespec(remaining); const int ret = qt_ppoll(fds, nfds, &ts); if (ret != -1 || errno != EINTR) return ret; remaining = deadline.remainingTimeAsDuration(); } while (remaining > 0ns); return 0; } so, maybe a cause in that.. maybe in something else. Just don't use the waifForXXX methods... it is a crutch. AFAIK, right not there are no any maintainer for a serialport module... I assume, that the serialport module should be refactored because it's implementation is too old.
  • Debug: Performance issue with QJsonDocument destructor

    Unsolved
    4
    0 Votes
    4 Posts
    240 Views
    JonBJ
    @BaroneAshura Then that is indeed a big difference. I will bow out because I do not know about the details/features of the MSVC debugger, or how Creator communicates with that rather than gdb. I will say that when I used to develop for Windows with MSVC (no Qt) I found no particular slowness issues when debugging. I don't know how easy this is from where you are now, but can you run the debugging session from Visual Studio instead of from Qt Creator to compare?
  • QtQuick.Studio.DesignEffects module in Vscode

    Unsolved
    2
    0 Votes
    2 Posts
    309 Views
    J
    Windows 11
  • Strange header like boxes in front of every table row

    Solved
    4
    0 Votes
    4 Posts
    217 Views
    sebastianzanderS
    @artwaw said in Strange header like boxes in front of every table row: @sebastianzander those are row headers. Empty and visible, since - like you said - not configured. Please try something along this line: ui->tableView->verticalHeader->setVisible(false); Alternatively if you dive into the design view you'll see in the inspector property "Vertical header visible" checked. Thank you very much, Artur. You were right, the thing is that in our company we use a special class that inherits from QTableView and this class uses the vertical header to configure screen and DPI dependent row heights. I guess without those settings it would not even display those "strange boxes". Many windows in our software explicitly set verticalHeader->setVisible(false) or verticalHeader->hide() in their constructors, so it seemed odd to me that other tables do not have these vertical header boxes. I will suggest a change to our special QTableView descendant so that it calls verticalHeader->hide() in its constructor. @Pl45m4, thank you, too. I should have written that I use a descendant of QTableView, because so I (our company to be exact) indeed configure QTableView and QHeaderView specifically in this regard. Once again, many thanks to both of you for your quick replies and help. Kind regards, Sebastian
  • About addText () in QPainterPath

    Locked Unsolved
    2
    0 Votes
    2 Posts
    185 Views
    jsulmJ
    @cszr Please stop double posting! https://forum.qt.io/topic/157896/about-addtext-in-qpainterpath Closing this one...
  • Creating a UDP Communication Project

    Unsolved
    2
    0 Votes
    2 Posts
    122 Views
    Christian EhrlicherC
    Look into ui_Sender.h and you will see that you named your dialog different - fix it.
  • This topic is deleted!

    Solved
    3
    0 Votes
    3 Posts
    25 Views
  • Forcing PyQt6 to update part of a window that is not on screen

    Unsolved
    1
    0 Votes
    1 Posts
    267 Views
    No one has replied
  • Expanding multiple ListViews within QScrollArea.

    Solved
    9
    0 Votes
    9 Posts
    461 Views
    M
    @SGaist said in Expanding multiple ListViews within QScrollArea.: Here you have a variant in python that works quite well: Thank you for this. I'll dig into what you're doing with sizeHints, and see if I can adapt it to my working code above. Would be nice to not be dependent on all list items being the same size.