Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • 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
    750 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
    355 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
    526 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
    144 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
    499 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
    534 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
    178 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
    341 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
    181 Views
    SGaistS
    Hi, You have to set your container widget in the appropriate layout.
  • Issue facing during compilation of static environment

    Unsolved
    3
    0 Votes
    3 Posts
    251 Views
    jsulmJ
    @programmer_123 said in Issue facing during compilation of static environment: After adding -no -opengl (or) -no -egl flag in the configuration Did you do that from a clean state (without previous configure/build artefacts)?
  • Will Qt expand on the HTML4 subset that is supported for rich text?

    Unsolved
    2
    0 Votes
    2 Posts
    168 Views
    Christian EhrlicherC
    @ChiefyChief said in Will Qt expand on the HTML4 subset that is supported for rich text?: Does anyone know why Qt limits to only a subset of Html4 within rich text components? Does anyone know if Qt will be upgrading / expanding to Html5 within rich text components? You should ask the mailing list. This is a user-driven forum.
  • macOS 14 Sonoma save file dialog not showing, not even in Qt Creator

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    M
    @Mark-Malson ...and it works today, dialogs within my app, Qt Creator, everything. I'm starting to think that macOS 14 is the culprit. I've had other problems, such as the System Settings app just not showing at all.
  • QMainWindow does not receive mouse events in Linux/Wayland env

    Solved
    5
    0 Votes
    5 Posts
    606 Views
    A
    @Asperamanca Solved by passing command line argument "-platform xcb"
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • 0 Votes
    6 Posts
    684 Views
    J.HilkJ
    this connect(zero, &QPushButton::clicked, this, []() { toZero(); }) should fail to compile, is toZero a free floating function ?
  • How to automatically reconnect to QtOpcUa server after disconnection

    Unsolved
    1
    0 Votes
    1 Posts
    188 Views
    No one has replied