Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Laying out items/widgets without stretching/spacing

    Solved
    12
    0 Votes
    12 Posts
    852 Views
    JoeCFDJ
    @JonB you can use setAlignment(Qt::AlignLeft or Qt::AlignRight or Qt::AlignCenter or Qt::AlignTop ...) for different layouts. Sometimes this may not work as you need. Spacer can help a bit more when this setting does not work. Try different chatbots(so many nowadays) if the answers are not good enough. I have not use ChatGPT for quite some time. Also do not trust the replies from the chatbots 100%. Never rely on one chatbot like ChatGPT which often replies with junks. I use setAlignment in my apps. But I still tried grok and deepseek for you with "how to align widgets to left only in qhboxlayout in qt" Only deepseek gives this answer. Method 1: Using setAlignment() on the layout
  • Pfx certificate file and Microsoft Store

    Unsolved
    2
    0 Votes
    2 Posts
    77 Views
    I
    If you bundle your applications as a MSIX file, Microsoft will sign them for you after you submit them to the store. If you want to publish a traditional installer, you need to sign it yourself. PFX certificates are no longer issued for code signing by trusted CAs, only cloud signing or HSM is allowed (when you buy a new certificate, you can get a small security token shipped to you that holds the private key for the certificate). I don't know what your idea of "low price" is, but $300-$500 is about what those things cost. There are CAs that subsidize most of the cost for Open Source projects.
  • Problem with location of resources (svg icons) in subdir project with cmake

    Solved
    7
    0 Votes
    7 Posts
    133 Views
    S
    Well, for future reference, I solved the thing by adding the images' folder to the app subdir, not to the gui subdir where these resources are mandatory. <project root> ├── CMakeLists.txt └── src ├── app │ ├── images │ │ ├── document-new.svg │ │ └── document-open.svg │ ├── CMakeLists.txt │ └── main.cpp ├── core │ ├── CMakeLists.txt │ ├── core.cpp │ └── core.h └── gui ├── CMakeLists.txt ├── mainwindow.cpp └── mainwindow.h and editing the corresponding CMakeLists.txt file with the qt_add_resources function! I had tried it before, but without quoting the <RESOURCE NAME> ("app_images" in my case) and that was probably the reason the PREFIX "/" was throwing an error. qt_add_executable(myapp main.cpp) qt_add_resources(myapp "app_images" PREFIX "/" FILES images/document-new.svg images/document-open.svg ) target_link_libraries(mayapp PRIVATE Qt6::Widgets core gui) set_target_properties(myapp PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) This way, there is no need to write a resources (.qrc) file on app subdir
  • Can't seem to get shaders to work.

    Unsolved
    2
    0 Votes
    2 Posts
    95 Views
    J
    Hey! It seems like it is impossible to pass javascript arrays to ShaderEffect shader parameters. I have been looking for a solution for this in pure QML as well. The best workaround is to pass an image and use the channels as info, this is prone to floating point precision issues though. https://bugreports.qt.io/browse/QTBUG-50493
  • Layout of fixed size objects and one object that changes size

    Unsolved qframe qlineedit
    2
    0 Votes
    2 Posts
    117 Views
    SGaistS
    Hi, AFAIK, the only way to do that would be to remove the widget from the layout it's in and you manage yourself its new independent life (e.g. resizing and moving).
  • Problem with transparent background using Inkscape SVG icons in Qt

    Unsolved
    2
    0 Votes
    2 Posts
    185 Views
    jsulmJ
    @buhtz You can see here what is supported by Qt: https://doc.qt.io/qt-6/svgextensions.html
  • class "has not been declared" in moc file though in class include is correct.

    Unsolved
    13
    0 Votes
    13 Posts
    827 Views
    L
    Thanks for your interest. They are there https://forum.qt.io/topic/163508/headers-not-found/4 Unfortunately, after solving these problems the same type of issue reappeared. ChatGPT pretends that this is because file name should be capitalised exactly the same as the class name which I find hard to believe. For now I am trying another way with the old .pro file.
  • Using QtCharts in a Pyside6 Application

    Unsolved
    2
    0 Votes
    2 Posts
    124 Views
    C
    I am seeing the exact same problem. However, I let AI generate some QML Chart code and the application works. It would be nice to have code completion working.
  • Swapping columns on QTreeView causes row highlight to disconnect

    Solved
    3
    0 Votes
    3 Posts
    114 Views
    P
    @Christian-Ehrlicher Thanks for your response. I was worried that might be the case. Changing the model or implementing a proxy model will be a bigger change to the code, but should be doable.
  • QIcon::pixmap() returns image double the size requested

    Unsolved
    7
    0 Votes
    7 Posts
    716 Views
    J
    i've bypassed it using : QSize iconSize(16, 16); QPixmap img = QIcon::fromTheme("folder-alt").pixmap(iconSize).scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); qDebug() << img;
  • partially update default stylesheet

    Unsolved
    26
    0 Votes
    26 Posts
    2k Views
    SGaistS
    @SimonSchroeder Native styles are implemented such that they follow the original platform style and are thus free to ignore modified palette values to stay coherent. Thus, depending on what you want to change, you will need to check what the original style does underneath. I am not claiming that it's simple for everything, far from it. Many times, it's a question of re-implementing drawPrimitive to either call the base class implementation with modified values or having your own implementation based out of the original class.
  • getting the issues with QDialog

    Unsolved
    5
    0 Votes
    5 Posts
    216 Views
    S
    This is my dialog — when it’s created, a faint shadow briefly appears on the left margin for a fraction of a second. It doesn’t happen every time, but it occurs occasionally
  • Weird behavior of QT windows on Linux

    Solved
    13
    0 Votes
    13 Posts
    569 Views
    deisikD
    The solution was to make the main window stay on bottom with the Qt::WindowStaysOnBottomHint flag set (yes, I can live with that) But if you have other ideas, please share
  • Headers not found

    Unsolved
    4
    0 Votes
    4 Posts
    116 Views
    L
    Seems to be solved by set(CMAKE_INCLUDE_CURRENT_DIR ON) but not quite sure (I have other errors). Why the ui compiler would include with < and < instead of " " ?
  • Terminal Output Of Application Outside of Creator

    Solved
    5
    0 Votes
    5 Posts
    182 Views
    D
    @JonB Thank you for your post. It turns out the AllocConsole() was the solution. It was a Windows problem I was unfamiliar with rather than QT. Have a great week!
  • Qt 6.10 and text encodings

    Unsolved
    16
    0 Votes
    16 Posts
    1k Views
    AndyBriceA
    @cristian-adam Thanks.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • Embedding Lightweight Web Tools into Qt Desktop Apps — Best Approaches?

    Unsolved
    3
    0 Votes
    3 Posts
    174 Views
    A
    Please choose webview2, which has higher performance than QWebEngine and is easier to integrate than cef. refer to https://thinkinginqt.com/20250726_qt-web/20250726_qt-web.html
  • Custom QHeaderView doesn't adjust size

    Unsolved
    4
    0 Votes
    4 Posts
    132 Views
    SGaistS
    If you want to sort, why are you setSortIndicatorShown(false); ?
  • fusion style is bad in combobox

    Unsolved
    4
    0 Votes
    4 Posts
    143 Views
    Christian EhrlicherC
    I don't understand your problem - what exactly is wrong here?