Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.3k Posts
  • 1 Votes
    1 Posts
    577 Views
    No one has replied
  • Implementing Individual Y-Axis Zoom on Multi-Axis QChart - Need Help with Axis Position

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    JonBJ
    @akikaede It may mean that. The first thing to do is to try to understand how it achieves the drawing of these items. From that code you might be able to see how you could achieve your goal. It might require using internal calls which are not exposed, or you might see a way to get at what you need without them. We are not saying this is either desirable or easy, but it may be the only way. If you are lucky someone will tell you how you can do what you want, but if you are not getting a further response that may indicate nobody knows or it cannot be done, and you are on your own. I will mention that by common consent Qt Charts is perhaps not the nicest piece of code. There are other third-party chart drawing offerings for Qt (e.g. I believe Qwt). They might allow what you seek, or they might be worse.
  • Need to understand setUpdatesEnabled behaviour while updating UI elements

    Solved
    4
    0 Votes
    4 Posts
    566 Views
    jsulmJ
    @starkm42 If you want to do something periodically then use QTimer.
  • screenshot

    Locked Unsolved
    4
    0 Votes
    4 Posts
    493 Views
    jeremy_kJ
    This is a duplicate of https://forum.qt.io/topic/151920/screenshot/2?_=1699508498491 Please stick to a single thread.
  • Gstreamer with Qtwidgets

    Unsolved
    5
    0 Votes
    5 Posts
    810 Views
    N
    void GstPlayer::setVideoOutput(QWidget *widget) { _hwndVideo = widget->winId(); } gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(customData.pipeline), _player->hwndVideo());
  • Question Regarding QVector Behavior

    Unsolved
    5
    0 Votes
    5 Posts
    388 Views
    Christian EhrlicherC
    Simply iterate over the vector and add the ones which could not be copied to another vector which you can process later on.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • QMetaType alias in Qt6

    Unsolved metatype qt5 qt6
    8
    0 Votes
    8 Posts
    2k Views
    T
    @crueegg Hi, unfortunately, we had to cope with the same issue. The only way to circumvent it was to create a singleton class that handles a mapping between the id of the QMetaType and the custom alias. See https://gitlab.inria.fr/dtk/dtk-core/-/issues/30 for more details. Thib.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Qt Ethernet communication

    Unsolved
    21
    0 Votes
    21 Posts
    11k Views
    C
    Read the "good reply" by Hugh-P, or adapt from the earlier reply by kuzulis
  • How to program a floating (touch) spinbox with qwidget

    Unsolved
    3
    0 Votes
    3 Posts
    284 Views
    R
    @SGaist Thank you for your reply! The wheel control (if it is the top right widget, what i will check later on) looks promising. To switch to qml is sadly not an option for me. Thank you once again for sharing that site.
  • Can't set a button to a certain position by only using code

    Solved
    3
    0 Votes
    3 Posts
    376 Views
    C
    @thatbeatrice QLayoutItem::setAlignment() tells the layout item (widget or QLayoutItem subclass) where to put itself inside the space given to it by its parent layout. The middle layout is given the entire client area of the widget containing this code to manage. You are not putting your top or bottom layout items into a layout, so their position is entirely up to you to manage (and you are not). These are two different options #include <QApplication> #include <QWidget> #include <QLabel> #include <QVBoxLayout> #include <QGridLayout> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget w; QLabel *top = new QLabel("Top Left", &w); QLabel *mid = new QLabel("Middle right", &w); QLabel *bot = new QLabel("Bottom right", &w); #if 1 // Option 1 QVBoxLayout *layout = new QVBoxLayout(&w); top->setAlignment(Qt::AlignLeft | Qt::AlignTop); mid->setAlignment(Qt::AlignCenter); bot->setAlignment(Qt::AlignLeft | Qt::AlignBottom); layout->addWidget(top); layout->addWidget(mid); layout->addWidget(bot); #else // Option 2 QGridLayout *layout = new QGridLayout(&w); layout->addWidget(top, 0, 0, Qt::AlignLeft | Qt::AlignTop); layout->addWidget(mid, 1, 1, Qt::AlignCenter); layout->addWidget(bot, 2, 0, Qt::AlignLeft | Qt::AlignBottom); #endif w.resize(800, 600); w.show(); return app.exec(); } Whether you want to use the code that Designer and uic produce, it can be very informative to see how it constructs things.
  • Incorrect include path in build.ninja

    Unsolved
    2
    0 Votes
    2 Posts
    586 Views
    P
    I think it was a combination of the Qt install in my user account and the Qt installation by Ubuntu. Fixed by specifying the Qt install location as the CMAKE_PREFIX_PATH
  • How to draw pixmap with same anti alias quality as QPushButton::icon?

    Solved
    19
    0 Votes
    19 Posts
    4k Views
    M
    @patrickkidd what exactly have you found?
  • touch does not work sometimes while mouse press works fine.

    Unsolved
    7
    0 Votes
    7 Posts
    530 Views
    JoeCFDJ
    @SGaist It is a general practice to use touch screen in this field. Not yet. I will take a look at it. Thank you for your advice.
  • QTextEdit does not apply css to html table

    Unsolved
    2
    0 Votes
    2 Posts
    549 Views
    jeremy_kJ
    @apalomer said in QTextEdit does not apply css to html table: ![alt text](image url)I am using QTextEdit to display some markdown content. I am using QT version 5 and cannot move to 6 to use QTextEdit.setMarkdown. QTextEdit.setMarkdown was introduced in Qt 5.14. If you're using something older and have the option to upgrade, the 5.15 series is worth a look. Maybe it will help, or maybe it will introduce a new problem. As you can appreciate, I can add a CSS style to the document (h1 and h2) in the QTextEdit. However, the table part of the CSS is not being applied (there is no border). According to Qt documentation the table properties that I am using are supported. Any idea on what can I do to apply the table style? QTextDocument's html and css capability is pretty limited, and frequently involves a conversion from the input to what is actually used by the widget. Look at the html being generated from the markdown, and at the html that QTextEdit.toHtml() returns. There may be a more specific css rule that is automatically applied.
  • QSharedPointer shared across QThread

    Solved
    3
    0 Votes
    3 Posts
    579 Views
    P
    @Christian-Ehrlicher I see, so I figure I have two options here: stop using the QThread, but that is not my favored option because I would like the device scanning to happen reliably even when the GUI thread was frozen (that was the reason why I did this move in the first place). I could also create the QThread later move the Device to the "main" thread before it is passed to DeviceHandler::detected. Trying this out it seems to work, and it matches "moving the ownership" of the Device instance to the rest of the app. Marking this as solved, thank you for your help!
  • MQTT TLS find cipher and protocol used

    Solved
    2
    0 Votes
    2 Posts
    204 Views
    G
    OK it wasn't too difficult in the end, you can use the transport() function from QMqttClient and cast it to a QSslSocket pointer as long as the transport type is SecureSocket. QIODevice* d = m_client->transport(); if (d) { QSslSocket* s = dynamic_cast<QSslSocket*>(d); if (s) { qDebug() << "Protocol:" << s->protocol(); qDebug() << "Session Cipher:" << s->sessionCipher(); qDebug() << "Session Protocol:" << s->sessionProtocol(); } }
  • QGuiApplication::installTranslator has no effect

    Solved
    3
    0 Votes
    3 Posts
    280 Views
    C
    @jsulm Thank you, I didn't have that in mind at all. I extracted it into a function that I was calling from main, but I have just seen that the documentation says that it doesnt take ownership of it, so it indeed goes out of scope. Moving it back into the main function fixes it!
  • run Qt example demo'ToDoList'+add ExclusiveGroup component failedfail

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