Skip to content
Qt 6.11 is out! See what's new in the release blog
  • Good practices for memory gestion

    Unsolved General and Desktop c++
    2
    0 Votes
    2 Posts
    164 Views
    SGaistS
    Hi, Without having dived in your source code, I think one key difference to take into account: Python is garbage collected while C++ is not. Also, deleting an object in C++ does not mean that the memory is immediately released to the OS. It may happen at different times depending on your application memory usage pattern, OS etc.
  • 0 Votes
    2 Posts
    174 Views
    T
    Because I found the solution in the meantime I reply to my own post. The following code sets the selection as expected: void TElementBorderName::setBorder(const QString& border) { mBorder = border; const QModelIndexList matches = mModel->match(mModel->index(0, 0), Qt::DisplayRole, border, 1, Qt::MatchExactly | Qt::MatchRecursive); if (!matches.isEmpty()) { const QModelIndex modelIdx = matches.first(); // Temporarily set the root to the parent to allow row-based selection mCombo->setRootModelIndex(modelIdx.parent()); mCombo->setCurrentIndex(modelIdx.row()); // Restore the original root to show the full tree mCombo->setRootModelIndex(QModelIndex()); } } A.T.
  • 0 Votes
    7 Posts
    2k Views
    SebastianMS
    Above change was accepted and merged. In upcoming release it should be available.
  • QProgressBar has rendering errors or does not render at all

    Unsolved General and Desktop c++ qt6
    19
    0 Votes
    19 Posts
    5k Views
    Christian EhrlicherC
    As I said - the effect draws outside it's client area.
  • XCode26 new Standard C++ Library breaks Qt 6

    Solved General and Desktop macos c++
    2
    0 Votes
    2 Posts
    1k Views
    artwawA
    Solution: some paths in Qt needed updating in build configuration - from macOS15.5.sdk to macOS26.sdk.
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    E
    https://bugreports.qt.io/browse/QTBUG-135011 for anyone else encountering this, I have opened a bug with the upstream https://bugreports.qt.io/browse/QTBUG-135011
  • Getting C++ struct in QML as type

    Solved General and Desktop qml c++ struct
    8
    1 Votes
    8 Posts
    2k Views
    A
    @Asperamanca I tried to change the whole text to lowercase and that worked!
  • 0 Votes
    10 Posts
    3k Views
    F
    It's not worked also with any popup Widgets, Dialogs, Menus, Popups, etc. Also issue persist in the latest 6.8.3 and 6.9.0 and caused by this changes - https://codereview.qt-project.org/c/qt/qtbase/+/568225 (https://bugreports.qt.io/browse/QTBUG-135253) A created a separate issue, with steps how to reproduce it with the latest Qt version - https://bugreports.qt.io/browse/QTBUG-135253
  • Qt6.8.2 iOS: Keyboard invisible in the background

    Unsolved Mobile and Embedded c++ keyboard qt6.8.2 ios
    1
    0 Votes
    1 Posts
    412 Views
    No one has replied
  • 0 Votes
    4 Posts
    1k Views
    JonBJ
    @Poggar As the above two posts have said. Fastest way to convert Vector to QJsonArray? gives code and confirms there is no faster way than some sort of iteration over the C++ array adding elements to the JSON array, you can use std::copy() to save you writing a for loop yourself if you wish.
  • .jpeg / .jpg not displaying in CLion

    Unsolved General and Desktop c++ clion-ide
    2
    0 Votes
    2 Posts
    637 Views
    SGaistS
    Hi and welcome to devnet, I haven't used CLion yet but I found this tutorial from their documentation. Did you follow it ?
  • 0 Votes
    11 Posts
    4k Views
    D
    @JonB said in Connection signals for dynamically created widgets: Bit it does not! QGraphicsItems do not inherit QObject, only QGraphicsObjects do. You're right! I got confused when going up the inheritance tree in the documentation, I clicked on "inherited by QGraphicsObject" at some point thinking it was "inherits" instead. I didn't specify in a written manner that my StateWidget was a QGraphicsEllipseItem as I had added the declaration of the class in the first message. I changed the class to inherit QObject as well though and it worked! class StateWidget : public QObject, public QGraphicsEllipseItem { ... } The order of inheritance is important too. The "Test n" below comes from the AutomatLab::StateParams function so the signal is properly forwarded to the main UI instance! [image: 973931d7-e484-4597-8d82-5c6be4cefda8.png] Thank you for your help!
  • 0 Votes
    6 Posts
    2k Views
    I
    @Khamza It is quite hard to tell. The piece of code you pasted has several issues unfortunately, and it would very hard to say what the exact cause it without the whole thing to reproduce. I'll say that the most pressing problem in the code is that you are using values that are in document coordinates (which is what the rectangle that QAbstractTextDocumentLayout::blockBoundingRect returns is in) to calculate parameters for a QPainter which works in viewport coordinates. These are not the same, especially when there are scroll bars shown, and in my experience the main cause of issues around scrolling. That said, it wouldn't explain the text itself just disappearing when scrolling back up; I'd expect it to just be garbled. First try to comment out your paintEvent to see if text is drawn correctly at the expected positions when scrolling back and forth - perhaps something in the formats isn't right. Otherwise, please post a complete yet minimal project that reproduces the problems you see.
  • 0 Votes
    4 Posts
    1k Views
    JonBJ
    @Khamza You are not supposed to just call paintEvent() from somewhere else, it's designed to be called during actual painting. If you override a base paintEvent() you can (and should) indeed call the base implementation from there.
  • 0 Votes
    3 Posts
    970 Views
    M
    @Bonnie Thank you for pointing me in the right direction. I turns out the issue wasn't height, or min-height, but rather an inherited padding, that just happened to make it look like it was expanding to the full height of the QHBoxLayout.
  • QT 6.8.0: Comparison of QDateTime is wrong

    Solved General and Desktop qt 6.8.0 c++ qdatetime
    19
    0 Votes
    19 Posts
    4k Views
    Christian EhrlicherC
    @TheoSys said in QT 6.8.0: Comparison of QDateTime is wrong: Then it's my fault No problem. Datetime with databases is not that easy as it seems so there might still be problems in the drivers even though I spent a lot of time with this 🙂
  • 0 Votes
    8 Posts
    2k Views
    JonBJ
    @SergeyK12 Are you aware that in a QStandardItemModel you can create a parent-child hierarchy? E.g. start from https://doc.qt.io/qt-6/qstandarditemmodel.html#details and QStandardItemModel::insertRow(int row, const QModelIndex &parent = QModelIndex()) etc. So why don't you store your model like that if it's hierarchical? Unless you mean you start with a QStandardItemModel which is flat and multi-column like the first one, for whatever reason, and want to display that in the second way. For that yes a proxy like yours would be good.
  • 0 Votes
    4 Posts
    3k Views
    aha_1980A
    The second failure ninja: build stopped: subcommand failed. is a direct successor of the first error. Fix the first error, and the second will disappear. the file does exist and is in the include directory Can you tell us the path to this directory? According to the compiler command line, your compiler searches in the following directories: -I/Users/jamesmartin/sourceCode/C++/qt/QTCurvesCPP2/build/Desktop_arm_darwin_generic_mach_o_64bit-Debug/QTCurvesCPP2_autogen/include -isystem /Applications/qt/6.7.2/macos/lib/QtCore.framework/Headers -iframework /Applications/qt/6.7.2/macos/lib -isystem /Applications/qt/6.7.2/macos/mkspecs/macx-clang -isystem /Applications/qt/6.7.2/macos/include -isystem /Applications/qt/6.7.2/macos/lib/QtWidgets.framework/Headers -isystem /Applications/qt/6.7.2/macos/lib/QtGui.framework/Headers which seems a bit strange to me as it does not have any source directory in the list. Can you show your CMakeLists.txt?