Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Qt (maybe 5) became sluggish recently. Any ideas why?

    Unsolved
    19
    0 Votes
    19 Posts
    1k Views
    S
    @Valso said in Qt (maybe 5) became sluggish recently. Any ideas why?: Now I installed these two and forced them to use the GTK file dialogs, so no more waiting for an eternity for the dialog to load. Then it sounds like a problem of KDE and not Qt. Yes, KDE is closely related to Qt, but it also extends Qt. Most likely it provides its own "native" file dialog for Qt. There is a difference between plain Qt programs and KDE programs. And you were (almost) right initially that KDE would imply Linux as OS, but Qt actually does not (as mentioned before). (Just for completeness sake: the official KDE programs are also available on Windows. I even have Kate installed.)
  • qAsConst() deprecated

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    C
    @Chris-Kawa Thanks so much Chris. You have saved me from making a systematic errror. Much appreciated.
  • windeployqt via docker issue

    Unsolved
    1
    0 Votes
    1 Posts
    127 Views
    No one has replied
  • 0 Votes
    5 Posts
    1k Views
    KH-219DesignK
    @johnco3 said in porting qmake pro file to mac - library issue: how I should use or handle the environment variables that point to the homebrew directories? I have a sample project (my own "living cheatsheet") that compiles a Qt GUI for mac (and other platforms). You don't have to take my word for it, you can look at the Github "Actions" (continuous integration) to see that the builds are succeeding. My "cheatsheet" project: uses homebrew: https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/tools/ci/provision_mac.sh#L10 makes minor use of macx blocks in pro/pri files For my baseline project, the only macx blocks I seem to need are the following "quality of life improvements": ios|macx { # the lines below suppress warnings generated by Qt's header files: we tell # Clang to treat Qt's (mac) Framework headers as "system headers": QMAKE_CXXFLAGS += -iframework $$[QT_INSTALL_LIBS] QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_LIBS]/QtCore.framework/Headers } and ios|macx { # Disable a couple that are more onerous to comply with on Mac QMAKE_CXXFLAGS += "\ -Wno-error=missing-noreturn \ -Wno-error=sign-conversion \ " } (in the file https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/compiler_flags.pri) However, the baseline project does not link to anything from homebrew. On another project (not public on github), here are some other snippets I have used: macx { # MacOSX homebrew puts the mysql.h header elsewhere: QMAKE_CXXFLAGS += -isystem /usr/local/include/mysql } macx { LIBS += -L/usr/local/lib -lmysqlclient } Once your code compiles, you will very likely find yourself face-to-face with another common MacOS hurdle: the app bundle. Reference: https://developer.apple.com/go/?id=bundle-structure In order to make a bundle that will launch (so you can actually launch your app), the Qt "magic" you will need is macdeployqt: https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/build_app.sh#L91
  • QJniObject::construct -> how to use?

    Unsolved
    2
    0 Votes
    2 Posts
    292 Views
    JonBJ
    @Flaming-Moe QJniObject::construct<jstring>() will be correct for "no arguments to constructor", else you would have to specify them inside the (...). I also get a complaint Might help us if you showed the "complaint" message....
  • How to close SecondaryWindow from non-caller function

    Unsolved
    6
    0 Votes
    6 Posts
    357 Views
    Pl45m4P
    @JonB Then the title of this is weird...
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    20 Views
    No one has replied
  • 0 Votes
    19 Posts
    3k Views
    S
    @Chris-Kawa thank you very much. That definitely helped a lot. :) I have done the manual positioning now, so all delegates line up with the actual widget. :) void ViewLayerItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItem opt = option; initStyleOption(&opt, index); // Überprüfen Sie, ob der aktuelle Index bearbeitet wird if (index == currentlyEditedIndex) { return; } // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten QString lineEditvalue = index.model()->data(index, Qt::EditRole).toString(); bool checkBoxValue = index.model()->data(index, Qt::CheckStateRole).toBool(); // Laden Sie das Icon und skalieren Sie es QPixmap iconPixmap("://resource/quick.png"); // Ersetzen Sie dies durch den Pfad zu Ihrer Icon-Datei QPixmap scaledPixmap = iconPixmap.scaled(32, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation); // Berechnen Sie die Position für das Icon int centerY = option.rect.top() + option.rect.height() / 2; int iconY = centerY - scaledPixmap.height() / 2; QPoint iconPos = QPoint(option.rect.left() + 10, iconY); // Zeichnen Sie das Pixmap mit dem QPainter painter->drawPixmap(iconPos, scaledPixmap); // Berechnen Sie die Position und Größe für das LineEdit QRect lineEditRect = option.rect; lineEditRect.setLeft(iconPos.x() + scaledPixmap.width() + 10); // Adjust as needed lineEditRect.setRight(option.rect.right() - 10); // Adjust as needed // Erstellen Sie ein QStyleOptionFrame für das LineEdit QStyleOptionFrame lineEditOption; lineEditOption.lineWidth = 1; // Setzen Sie die Liniendicke auf 1 lineEditOption.rect = lineEditRect; // Zeichnen Sie das LineEdit QApplication::style()->drawControl(QStyle::CE_ShapedFrame, &lineEditOption, painter); // Zeichnen Sie den Text des LineEdits painter->drawText(lineEditOption.rect.adjusted(2,0,0,0), Qt::AlignLeft | Qt::AlignVCenter, lineEditvalue); // Berechnen Sie die Position und Größe für die CheckBox QRect checkBoxRect = option.rect; checkBoxRect.setLeft(lineEditRect.right() - 22); // Adjust as needed checkBoxRect.setRight(option.rect.right() - 10); // Adjust as needed // Erstellen Sie ein QStyleOptionButton für die CheckBox QStyleOptionButton checkBoxOption; checkBoxOption.state = checkBoxValue ? QStyle::State_On : QStyle::State_Off; checkBoxOption.rect = checkBoxRect; // Zeichnen Sie die CheckBox QApplication::style()->drawControl(QStyle::CE_CheckBox, &checkBoxOption, painter); }
  • How to use openssl libraries in qt cmakelist.txt

    Unsolved
    5
    0 Votes
    5 Posts
    727 Views
    P
    @ChrisW67 Thanks for your answer . I have referred to the document [image: f2f4d3e2-f648-40b7-9c62-489d8e0b47ed.png] https://wiki.qt.io/Compiling_OpenSSL_with_MinGW but while building project in windows environment . I am getting error that some libraries are not found . Which are of openssl . Also another approach which i followed is directly installing openssl using it's installer ,it worked but i want to compile it and make it work .Help me out please.
  • Rationale for QIntValidator behaviour

    Unsolved
    5
    0 Votes
    5 Posts
    345 Views
    S
    It is really annoying (as a user) if you could not type in 999 and then change it to 899 later. If you're in the flow it is not directly obvious why this should fail, even if the upper limit is 900. We have some checks of floating point input fields in our software ported several times from other GUI frameworks that get really annoying at times. So, I am advocating for this kind of editing behavior. Yes, it makes the programmer's job harder, but it is worth it for the end user.
  • qt.multimedia.player: Warning: "Failed to connect: Connection refused"

    Solved
    15
    0 Votes
    15 Posts
    2k Views
    C
    It is possible there is an issue with Qt Creator. I saw the error when running inside Qt Creator, but not when running from the command line.
  • QListView Not Displaying Anything

    Unsolved
    5
    0 Votes
    5 Posts
    517 Views
    C
    @SGaist thanks for the suggestion. There's no real reason why the string list was a pointer - likely just copying what was being done for the model and the delegate. This code is being converted from a 15-year old application written to use MFC, so I have to keep shaking the "MFC-think" out of my head.
  • `QTextDocument` creating a singular table HTML to be printed to a PDF

    Unsolved
    1
    0 Votes
    1 Posts
    141 Views
    No one has replied
  • Trouble building Qt

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    jsulmJ
    @Massi Set QT_DEBUG_PLUGINS env variable before starting your app and check its output to see why XCB plug-in can't be loaded. Is X server running?
  • Restore a NOT VALID Dialog Position Correct

    Unsolved
    8
    0 Votes
    8 Posts
    482 Views
    V
    @SGaist The bug was produced with Qt 6.5.3 and Windows 10 22H2. hmm... I think i will keep this bug until a user complains about it. It is maybe overenginiering to care about that. I think Qt should normaly care about that correct.
  • How to deploy to a Linux server without a Qt install ?

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    M
    I opened a ticket against the LinuxDeploy Qt plugin: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/149
  • CMake error whene configuring Qt5 with VTK

    Unsolved
    2
    0 Votes
    2 Posts
    512 Views
    SGaistS
    Hi, Are you sure you installed all the required Qt development packages from your distribution ?
  • qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

    Unsolved
    2
    0 Votes
    2 Posts
    173 Views
    SGaistS
    Hi, Are you doing that from the command line ? If so, did you run windeployqt before trying to start your application ?
  • autouic: normal header file name startwith ui_* failed

    Unsolved
    2
    0 Votes
    2 Posts
    333 Views
    jsulmJ
    @CraZy uic generates ui_FORMNAME.h for every form you define in designer. You should avoid using ui_ prefixes for your own header files.
  • Using a Q3DScatter with a .ui dialog

    Unsolved
    2
    0 Votes
    2 Posts
    177 Views
    SGaistS
    Hi, You have to set your container widget in the appropriate layout.