Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Convert QWidget back to QLayout

    Solved
    5
    0 Votes
    5 Posts
    725 Views
    M
    @JonB yes, I have tried that previously. But there's some rows that i have to make it custom. But It Solved now with QGroupBox. Thanks for your answers again
  • QHash remove item while iterating?

    Solved
    2
    0 Votes
    2 Posts
    235 Views
    jsulmJ
    @Publicnamer It's all in the documentation: https://doc.qt.io/qt-5/qhash.html#erase
  • Return value of QHeaderView ::logicalIndexAt is not accurate

    Solved
    5
    0 Votes
    5 Posts
    361 Views
    jronaldJ
    I've found the cause of the problem, mouse position when clicking on a menu item is different from the mouse position when popping up the context menu.
  • How to use the new QtCreator for console input/output?

    Solved
    24
    0 Votes
    24 Posts
    23k Views
    jsulmJ
    @Swati777999 https://forum.qt.io/topic/131521/displaying-qstring-variable-in-application-output
  • How to map Qt push button to keyboard key presses.

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    jsulmJ
    @trojan To catch the key press event subclass QWidget and override https://doc.qt.io/qt-5/qwidget.html#keyPressEvent In your keyPressEvent you then can then send the click event to the button: QApplication::sendEvent(button, &event); Or you can simply call the code you're calling when the button is pressed.
  • aarch64 cross compile

    Unsolved
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • No audio and video codecs available

    Solved
    7
    0 Votes
    7 Posts
    692 Views
    raven-worxR
    @lyris yes, no video recording on Windows using QtMultimedia. you might have better chances using vlc-qt But i cant help you what to do exactly, haven't used it yet.
  • QSslSocket how to dump an expired certificate?

    Solved
    14
    0 Votes
    14 Posts
    1k Views
    jeremy_kJ
    There was a discussion that went into details on the qt-interest mailing list. https://lists.qt-project.org/pipermail/interest/2021-October/037642.html in particular.
  • Let's encrypt SslHandshakeFailedError

    Unsolved
    7
    0 Votes
    7 Posts
    860 Views
    mbruelM
    Hi @MartinD Kind of got the same issue on Qt v5.8.0 Linux cause it is built with OpenSSL v1.0. (cf my thread) I guess the only solution is to switch to a more recent version of Qt that uses OpenSSL 1.1. If you can't, just could add an exception in your code to allow QSslError::CertificateExpired... cf here the handshake works at the end, there is just an error that is raised.
  • how to get wmic info win11

    Solved
    11
    0 Votes
    11 Posts
    2k Views
    faduF
    @Cobra91151 thank you
  • QString in a struct

    Solved
    2
    0 Votes
    2 Posts
    392 Views
    M
    try delete[] f; warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete f; // error
  • QMenu stylesheet

    Unsolved
    14
    0 Votes
    14 Posts
    5k Views
    JonBJ
    @SourceCreator I don't know what it looks like for you. From the docs example put in the QMenu::item { /* sets background of menu item. set this to something non-transparent if you want menu color and menu item color to be different */ background-color: transparent; } Does that make it look like it's supposed to?
  • How to check if the parent widget of a certain type?

    Unsolved
    7
    0 Votes
    7 Posts
    2k Views
    Pablo J. RoginaP
    But the solution proposed by @eyllanesc is much better - less error prone and compiler will be able to check it more. As some other replies have mentioned, the casting although technically feasible (you have some code snippets already) might not be a good design approach. Let's say in a month you want the same custom behavior when the container widget is MyUncleContainer, not only MyParentContainer...
  • QTableView and double buffering?

    Unsolved
    7
    0 Votes
    7 Posts
    556 Views
    D
    it's possible further updates are triggered, though it's certainly not supposed to do that. i'll investigate that. yes there are item delegates involved. not sure what you're asking with "what is your model doing". it's an SQLite table. i'm not able to simply replace what i'm doing with a QStandardItemModel, that would take weeks of work. thanks for the ideas. but doesn't it seem strange that simply BROWSING THE MENU BAR would cause paint events instead of blit-from-double-buffer? also: only when the table has focus. if another view has focus, no paint events are triggered, even when the menus overlap the same areas.
  • Getting maximum size a widget can be in a layout

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    Q
    @ChrisW67 said in Getting maximum size a widget can be in a layout: Out of interest, why do you want to know this? I have a QTextEdit inside of custom scroll area, which is inside a container widget, where that container widget should resize to fit the content of the QTextEdit. If it can't, then the text in the QTextEdit will wrap. The issue is that the QTextEdit has a fixed width equal to the container to ensure that the text in it wraps if it would overflow the container width. This causes newly input text to initially be shown on a new line, then when the QTextEdit adjusts its size hint and that size is reflected in the container, the QTextEdit may be resized again which causes the text input on the new line to be moved back to the original line it was input on. This happens quickly, but it's still visible when typing quickly. My thoughts were that I could have a hidden 'buffer' QTextEdit that has the same styling as the displayed QTextEdit, so when text is input the buffer QTextEdit intercepts and inserts that text into itself so that it can determine what the unbounded document size is. Based on the container's max size in the layout, if the container can resize to fit the text, then the displayed QTextEdit will be resized to that size and the buffer QTextEdit will insert its text into it. Otherwise, the buffer QTextEdit will adjust its own size to the container's max size, which will update the text document size, then this new size will be applied to the displayed QTextEdit before the text is finally inserted. In short, the displayed QTextEdit is only ever updated after the buffer QTextEdit has a chance to determine what size it would be, which will hopefully fix the visual 'jumping' that resizing the container and displayed QTextEdit causes without a buffer QTextEdit. It may also be possible to just use a QTextDocument and style the blocks in it instead of using an entire QTextEdit. After thinking it over, I might not need to know the max size if I set the size hint of the container and try to resize it. After it's resized, I can use that size instead of needing to know the max size it can be in the layout.
  • how to create a 2D speedometer. (is there any qt example) ??

    Unsolved qpainter qt5 2d graphics qt4
    2
    0 Votes
    2 Posts
    817 Views
    Christian EhrlicherC
    Simply two QPainter::drawArc() calls with a different color.
  • App runs and compiles but no fonts

    Unsolved
    2
    0 Votes
    2 Posts
    164 Views
    JoeCFDJ
    type command fc-list to see what you installed.
  • The best way to organize multiple unit tests

    Unsolved
    2
    0 Votes
    2 Posts
    232 Views
    Christian EhrlicherC
    Buidl your stuff in e.g. jenkins, run ctest and display the results with an appropriate jenkins plugin
  • How to make QTableWidgets full of gridlines

    Solved
    18
    0 Votes
    18 Posts
    4k Views
    jronaldJ
    @jsulm said in How to make QTableWidgets full of gridlines: @jronald said in How to make QTableWidgets full of gridlines: Also supports by the company, patches might be there Don't know what you mean. What company? Qt What patches? patches to fix the lines in QTableWidget / QTableView What support? paid support All Qt patches are merged into mainline and released. The only difference is that open source users do not get Qt binaries for point releses (5.15.x). But open source users can download the source code and build by themselfs... Support from QtCompany requires a commercial license, yes - but this has NOTHING to do with Qt itself... If you are comfortable with the default table styles as in the screenshots below, you are right [image: 5014a295-8387-463c-99b8-6df0bf75ab69.png]
  • Calling a shell file from .pro file

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    raven-worxR
    @Augustas https://doc.qt.io/qt-5/qmake-function-reference.html#shell-path-path