Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • How do I find the largest primary key in a model?

    Solved
    8
    0 Votes
    8 Posts
    382 Views
    J
    @jsulm if insertRecord is the way to update a row how do I find the row number of the model? For instance, I just inserted a new record, what is the row number so I can call insertRecord to update the new record?
  • Qt 6 fontChanged signal?

    Solved font change qapplication qt 6
    9
    1 Votes
    9 Posts
    1k Views
    CJhaC
    @JonB Yeah, I could do something similar, iterate over all widgets and pass on the event. Thanks, I will try this method in the final application.
  • VirtualKeyboard in Raspberry Pi Too big

    Unsolved
    2
    0 Votes
    2 Posts
    279 Views
    G
    @gabriele-salvato said in VirtualKeyboard in Raspberry Pi Too big: Hi all, I'm trying to integrate the QVirtualKeyboard in a C++ Program I'm developping for Raspberry Pi. The Qt version that is available in RaspberryOS is the 6.4.2. I've managed to display a Virtual Keyboard when a QLineEdit is on Focus but the Virtual Keyboard does not fit on the screen and some of the keys are not shown (the essential way-out key for example). Any help is welcome. EDIT: After installing qt6-wayland a different message appears: "qt.qpa.wayland: qtvirtualkeyboard currently is not supported at client-side, use QT_IM_MODULE=qtvirtualkeyboard at compositor-side" Now I'm lost. I've never used the "compositor" Again Any help is welcome.
  • Problem with splitters and layouts

    Solved
    6
    0 Votes
    6 Posts
    636 Views
    Pl45m4P
    @james-b-s said in Problem with splitters and layouts: The problem turned out to be the initialization of overallLayout. The parent was not passed in That's what I said here: @Pl45m4 said in Problem with splitters and layouts: Is overallLayout the actual base layout of your dialog? From your description one can assume that you have elements floating around which are not resized with the dialog. -> the layout was not applied to the dialog either with setLayout(overallLayout); or by making the dialog a direct parent of the main layout (i.e. overallLayout).
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • 0 Votes
    4 Posts
    523 Views
    JonBJ
    As @mpergand says for your current situation: within your program make sure you call insertRows(), then any attached views will be notified and refresh accordingly. Depending on your Qt model type that should already be the case (e.g. for the QSql... models). If you claim to be doing that yet not seeing the update, make sure your two views are sharing the same model instance. If you have two separate model instances both open on the same underlying SQL database that is no use: Qt won't recognise that to propagate the signal notification from one instance to another. @jdent said in How do I refresh a model so it takes new rows added after its creation?: @jdent The new locations could be added directly to the Database by means of a client application - how do I refresh the locations displayed? Assuming you mean some other application, no matter what/how, updates the database you are using for your model, be aware that Qt offers no way of detecting this or acting on it. That would require (a) the native database/driver having a way of "notifying" other client applications such as yours that this has happened which most do not provide and (b) Qt having a way of receiving such a "notification" and acting on it/passing it onto you, which it does not. You would have to write your own code outside of Qt to handle this if it were possible (but probably not because of (a)). The only way you would see such a change is (a) if you were in charge of the other application such that it could send a message to your application via a socket or shared memory/semaphore or similar or (b) you will simply see the new data the next time you (happen to) fill the model from the database. To that end if you had to know you would have to set up e.g. a QTimer to keep re-querying the database in case it had changed, which obviously is not very efficient.
  • QListView with specific behavior

    Solved
    4
    0 Votes
    4 Posts
    247 Views
    sitesvS
    @JoeCFD Hi! Should I manually calculate row and col count each form resize event?
  • Stop Qt classes from writing to stderr

    Unsolved
    7
    0 Votes
    7 Posts
    421 Views
    C
    Further to @JonB's option list. The message appears to originate when anything streams a QAbstractSocket::SocketError to QDebug . So, if it is not your code that is triggering this, then JonB's last option it will be.
  • GIF not Displayed in QT 5.15

    Moved Solved
    15
    0 Votes
    15 Posts
    961 Views
    V
    Hi All, Thank you for posting. The issue is resolved. Installed the missing plugin. Regards Vivek
  • what determines the order of the pushbuttons in a dialog?

    Solved dialog pushbutton
    6
    0 Votes
    6 Posts
    990 Views
    Pl45m4P
    @jdent said in what determines the order of the pushbuttons in a dialog?: QDialogButtonBox* buttonBox = new QDialogButtonBox; buttonBox->addButton(submitButton, QDialogButtonBox::AcceptRole); buttonBox->addButton(revertButton, QDialogButtonBox::ResetRole); buttonBox->addButton(closeButton, QDialogButtonBox::RejectRole); The thing is, these roles make life easier, because they automatically accept or reject your dialog when being clicked. But like @JonB said, nobody forces you to use a QDialogButtonBox in your dialog. It's nice to have, but if you don't like the OS default order (on some OS "OK" is left and "Cancel" right and on some it's reversed), you can put them in a regular layout and manually handle the accept() / reject() states.
  • How to make a button the default?

    Solved dialog box pushbutton setfocus
    7
    0 Votes
    7 Posts
    1k Views
    J
    @SGaist I finally solved the issue like this: submitButton->setAutoDefault(false); revertButton->setAutoDefault(false); closeButton->setDefault(true); Thank you all!!
  • AbstractListModel design question

    Unsolved
    2
    1 Votes
    2 Posts
    175 Views
    SGaistS
    Hi, Are you looking for something like the editable tree model example ?
  • QPolygonF intersected wrong outcome

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    kshegunovK
    Probably related to: https://bugreports.qt.io/browse/QTBUG-75146 https://bugreports.qt.io/browse/QTBUG-100302 The conventional wisdom is to not do geometry with Qt. I have had an open patch in gerrit, but it's been pretty much abandonware for the last few years, so if you want to fix this/these I can give you a headstart.
  • How can I programmatically make a dialog as small as possible?

    Solved dialog box layout issues
    6
    0 Votes
    6 Posts
    942 Views
    J
    @mpergand This works!! Thank you!! Also resize(1,1) also works! Great!
  • How to add a graphicsrectitem to a graphicslayout?

    Unsolved qt c++ qgraphicswidget qgraphicslayout
    5
    0 Votes
    5 Posts
    580 Views
    Pl45m4P
    @StudentScripter This example shows how a use case could look like https://doc.qt.io/qt-6/qtwidgets-graphicsview-basicgraphicslayouts-example.html But as you can see, the custom items inherit from QGraphicsLayoutItem and QGraphicsItem. So to properly use a QGraphicsItem in a layout, you have to inherit QGraphicsLayoutItem or use QGraphicsWidget directly... however I don't know how it fits in your existing logic/structure. It might break something... using layouts and "moving free / free resizable by user" is kinda counterproductive.
  • QML round edges in scrollbar

    Solved
    3
    0 Votes
    3 Posts
    251 Views
    N
    @JoeCFD wow thanks. works like a charm. Very easy to implement!! thank you :-) and have a nice day!
  • Qt gRPC - support for nested stream messages

    Unsolved
    6
    0 Votes
    6 Posts
    773 Views
    semlanikS
    @talksik it's an issue, but not the undocumented thing. The method should be called implicitly, but it wasn't.
  • GLIB-2.0 error on yocto build

    Unsolved
    23
    0 Votes
    23 Posts
    4k Views
    S
    @Ronel_qtmaster actually with a sample qt program i'm able to create a recipe flash it using "bitbake core-image-weston" and view it on the display but only for this specific qt program which i have i'm not able to do it. and also, this is a deliverable in my project.
  • Increase QPushButton clickable area vertically on MacOS

    Solved
    3
    1 Votes
    3 Posts
    288 Views
    H
    The lazy solution was to create a global QStyle (e.g. Fusion) and set it in the constructor of the pushbuttons with overridden paint functions.
  • 0 Votes
    9 Posts
    1k Views
    Ronel_qtmasterR
    @Jammin44fm Normally you use process events when you have differents events that can impact or slow down the main thread . In the main file you just want to start your application.Is there even in your main file that can impact the main thread?following your code no.So you can't call QApplication::processEvents() in the main.cpp Now a situation where you can use QApplication::processEvents() for instance, lets say you have an application that capture frames from the camera , display that in the UI and also send them to a server. This in a situation where we have multiple events.Now when handling these events you can use in one of them QApplication::processEvents(), or QThread to avoid that the app freezes