Skip to content
  • 0 Votes
    4 Posts
    150 Views
    SebastianMS
    Still, I can't find way to modify TextEditor margins. Core::IEditor *currentEditor = Core::EditorManager::currentEditor(); TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(currentEditor); TextEditor::TextEditorWidget * editorWidget = textEditor->editorWidget(); //how to do it? Tried casting edditorWidget to class CustomTextEditorWidget : public TextEditor::TextEditorWidget with custom virtual int extraAreaWidth(int *markWidthPtr = nullptr) const override. qobject_cast fails, after static_cast there's exception. Accessor approach class TextEditorWidgetAccessor : public TextEditor::TextEditorWidget { public: static void setMargins(TextEditor::TextEditorWidget *widget, int left, int top, int right, int bottom) { // Cast to accessor to get access to protected method TextEditorWidgetAccessor *accessor = static_cast<TextEditorWidgetAccessor*>(widget); accessor->setViewportMargins(left, top, right, bottom); } }; .... TextEditorWidgetAccessor::setMargins(editorWidget, 300, 0, 0, 0); doesn't change viewportMargins - before and after setting they return the same original value.
  • QProgressBar has rendering errors or does not render at all

    Unsolved General and Desktop c++ qt6
    12
    0 Votes
    12 Posts
    441 Views
    SGaistS
    @YuXin said in QProgressBar has rendering errors or does not render at all: @SGaist The fact that the same issue occurred during the testing of version 6.9.0 clearly indicates that upgrading the version is useless. I also tested the currently latest version, 6.10, and the result is that the same problem persists. No, it only indicates that there's an issue with the version you tested against. Since it still happens with 6.10, then there's indeed something to investigate. Try the suggestion of @hskoglund and if does not improve the situation, then check the bug report system and if you don't find anything there, please open a new ticket providing your minimal example with the adjustments people suggested on this thread.
  • XCode26 new Standard C++ Library breaks Qt 6

    Solved General and Desktop macos c++
    2
    0 Votes
    2 Posts
    260 Views
    artwawA
    Solution: some paths in Qt needed updating in build configuration - from macOS15.5.sdk to macOS26.sdk.
  • 0 Votes
    1 Posts
    978 Views
    No one has replied
  • 0 Votes
    3 Posts
    718 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
    1k Views
    A
    @Asperamanca I tried to change the whole text to lowercase and that worked!
  • 0 Votes
    10 Posts
    2k 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
    278 Views
    No one has replied
  • 0 Votes
    4 Posts
    635 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
    400 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
    3k 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
    1k 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
    795 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
    635 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
    3k 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
    1k 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
    2k 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
    2k 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 socket c++ mfc
    5
    0 Votes
    5 Posts
    903 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.