Skip to content
  • 0 Votes
    1 Posts
    24 Views
    No one has replied
  • 0 Votes
    4 Posts
    63 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.

  • 0 Votes
    2 Posts
    90 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
    2k 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!
    76d99a60-a567-4fff-9e5f-02f7a87ab787-image.png

    Thank you for your help!

  • 0 Votes
    6 Posts
    404 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
    149 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
    170 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.

  • 0 Votes
    19 Posts
    965 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
    465 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
    739 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?

  • 0 Votes
    14 Posts
    698 Views
    JonBJ

    @jeremy_k said in Console App how to populate a 10.000*10.000 Grid efficiently?:

    A easy optimization for setting a quadrant or an entire 2d space as a single color is to remove all subtrees of that tree,

    Absolutely. If that's the sort of thing you want to do. Doesn't seem to relate to toggling the state of 100,000 adjacent bits in 5 million.

    it stores all squares that shall be changed in a vector.
    The squares changed can be anywhere in this big map,
    eventually reaching many millions of squares needed to be changed at onces.

    If that is what you need to do, again I'm not sure I see any use of these quadtrees. But only you need the exact situation.

  • MT4 Manager API on QT

    Unsolved General and Desktop
    5
    0 Votes
    5 Posts
    311 Views
    B

    Hi.

    Thank you for the explanation.

    @Pl45m4 said in MT4 Manager API on QT:

    Since the MT4 API is probably incompatible with QTcpSocket by default and you probably need to use the Manager's connect function to make everything that is going on in the background work properly, I don't see why you need to use the Qt socket classes, assuming this MT4 Manager has its own internal socket stuff?!
    I could be wrong, though.

    Yes this is correct. The only thing is that, when i use the MT4 Manager to connect to the server, it always returns "no connection" error, which means, the MT4 Manager can't establish connection to the server, of which the server is online and i have run the C++ program with the same server credentials.

  • 0 Votes
    16 Posts
    2k Views
    M

    Hi @dheerendra

    I think the issue was in NO_PLUGIN as were suggested by @Anumas here:
    https://forum.qt.io/post/802964

    Seems to be working fine with static library now. I marked that message as a solution.

  • 0 Votes
    3 Posts
    279 Views
    Axel SpoerlA

    …and on a side note: Qt 5.15 isn’t ideal to start developing a new app! Much better to start with 6.5!

  • 0 Votes
    1 Posts
    301 Views
    No one has replied
  • 0 Votes
    13 Posts
    1k Views
    B

    @hskoglund Yes. I also have MinGW installed separately on my computer so I could try quickly making another kit with those and see if it works.

    Edit: Changing the version of MinGW in the kit worked! I tried using regular MinGW 64-bit and that made it work perfectly. Thanks so much

  • 0 Votes
    11 Posts
    688 Views
    jsulmJ

    @Kirill-Gusarev See @SimonSchroeder explanation and also read https://doc.qt.io/qt-6/threads-qobject.html

  • 0 Votes
    2 Posts
    292 Views
    JonBJ

    @Broder
    Show where you have added a path something like /usr/include/x86_64-linux-gnu/qt6 (not just /usr/include) to your include paths for cmake.

  • 0 Votes
    5 Posts
    1k Views
    W

    @Ronel_qtmaster
    oh i understood what i wasn't getting yeah idk why i did that, thanks!
    onto the next mistake....