Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.1k Topics 454.6k Posts
QtWS25 Last Chance
  • Apple open source plugin files for mysql

    Unsolved
    3
    0 Votes
    3 Posts
    140 Views
    D
    @Christian-Ehrlicher I thought that I had them, but I will check again.
  • activeSubWindow is unreliable. Is this a bug?

    Unsolved
    3
    0 Votes
    3 Posts
    144 Views
    N
    @SGaist . Sorry. I am running ubuntu 22.04 wayland and Qt Creator 13.0.2 based on Qt 6.6.3 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), x86_64)
  • How can I ensure that the text in the QTabBar of QDockWidgets is not cut off?

    Unsolved
    13
    0 Votes
    13 Posts
    638 Views
    l3u_L
    I now filed a KDE bug about this compiling everything I could find out: https://bugs.kde.org/show_bug.cgi?id=489516
  • Trying to make a custom QChart with datetime ranges as horizontal rectangles.

    Unsolved
    1
    0 Votes
    1 Posts
    107 Views
    No one has replied
  • Qtmultimedia 6.5 no audio devices (linux, alsa)

    Unsolved
    2
    0 Votes
    2 Posts
    308 Views
    T
    Were you able to find a solution to this? Currently stuck on this. I see my soundcard when doing aplay -l and arecord -l. I am also able to play audio with gst-launch-1.0 playbin. Alsamixer shows me an entire array of controls. However, Qt doesn't seem to recognize this.
  • Console App how to populate a 10.000*10.000 Grid efficiently?

    Unsolved c++ efficiency qt c++
    14
    0 Votes
    14 Posts
    1k Views
    JonBJ
    @jeremy_k said in Console App how to populate a 10.000*10.000 Grid efficiently?: A easy optimization for setting a quadrant or an entire 2d space as a single color is to remove all subtrees of that tree, Absolutely. If that's the sort of thing you want to do. Doesn't seem to relate to toggling the state of 100,000 adjacent bits in 5 million. it stores all squares that shall be changed in a vector. The squares changed can be anywhere in this big map, eventually reaching many millions of squares needed to be changed at onces. If that is what you need to do, again I'm not sure I see any use of these quadtrees. But only you need the exact situation.
  • QJSEngine does not work properly.

    Unsolved
    1
    0 Votes
    1 Posts
    72 Views
    No one has replied
  • Bug or Feature: Dereferencing QList::begin() segfaults on an empty QList using Qt 6

    Solved
    10
    0 Votes
    10 Posts
    398 Views
    Pl45m4P
    @l3u_ Undefined Behavior can also mean that code which "shouldn't work", does 7/10 times what your actual intention was (even though the code is wrong) and crashes 3/10 times. This still doesn't make the code correct, even if some resulting behavior leads to crashing your program while the other "seem" to work.
  • how to access the audio for QtBluetooth

    Unsolved
    1
    0 Votes
    1 Posts
    56 Views
    No one has replied
  • Qt Designer, QTextEdit, remove indentation

    Solved qtextedit indentation
    8
    0 Votes
    8 Posts
    3k Views
    D
    Hello, I reply this old topic but I could not find a solution for a problem. I want to set the padding of the text editor to zero. textEdit->document()->setDocumentMargin(0); as @mpergand said this works. However when I try to design application for different platform a problem occurred. On the mac the text is fit all the width of the texteditor, but in android there is always a small space at the end. Both text editors' width set to 150, on mac 45 of letter i can fit, on the phone 44i can fit and the small space. MAC [image: eda211d0-d08f-4d81-b24d-a28fa8c25b77.png] Android phone A34 [image: de938eab-51c8-47ea-bc4d-364b19e211c3.png] I tried all the below , none of them works part of the code: QTextDocument *doc = textEdit->document(); doc->setDocumentMargin(0); doc->setIndentWidth(0); textEdit->setContentsMargins(0,0,0,0); // textEdit->set QTextCursor cursor(doc); // Select the entire text cursor.select(QTextCursor::Document); // Create a character format and set the font style QTextCharFormat format; // QFont font("Arial", 12, QFont::Bold); // Example: Arial, 12pt, bold format.setFont(timesFont); // Apply the format to the selected text cursor.mergeCharFormat(format); // Set block format to ensure no extra margins QTextBlockFormat blockFormat; blockFormat.setBottomMargin(0); blockFormat.setTopMargin(0); blockFormat.setLeftMargin(0); blockFormat.setRightMargin(0); cursor.setBlockFormat(blockFormat); textEdit->setTextCursor(cursor); Why there is a difference ?
  • In Qt 5.15.1, the environment variable QT_QPA_FB_TSLIB=1 is not working consistently.

    Unsolved
    2
    0 Votes
    2 Posts
    180 Views
    C
    Hello, @Alexey_Golubev ADP Vantage Hcm To fix the touchscreen issue, add these lines to ~/.profile: export QT_QPA_PLATFORM=linuxfb export QT_QPA_FB_TSLIB=1 export QT_QPA_GENERIC_PLUGINS=tslib Then, reload the profile and launch your program: source ~/.profile /home/pi/Qt_Projects/kiab/kiab I hope this information will be helpful for you Best Regards Chris Wright
  • changing the behavior of the alt key of an existing app

    Unsolved
    1
    0 Votes
    1 Posts
    77 Views
    No one has replied
  • QGraphicsScene incorrect "artifacts" on scrolling "bug"?

    Unsolved
    6
    1 Votes
    6 Posts
    334 Views
    JoeCFDJ
    I do see two blue rectangles sometimes with Qt 5.15.3 and Qt 6.7 under Ubuntu 22.04, Xorg (not Wayland), but no overlapped blue rectangles(artifacts in your images). There is only one left after resizing. No single change in your code.
  • Qt 6 with MSVC 2022

    Unsolved
    8
    3 Votes
    8 Posts
    15k Views
    Christian EhrlicherC
    @thomas_arri said in Qt 6 with MSVC 2022: The problem i have is to deal with <QUiLoader>. Header file is not found! Then you should do what the documentation states: Header: #include <QUiLoader> CMake: find_package(Qt6 REQUIRED COMPONENTS UiTools) target_link_libraries(mytarget PRIVATE Qt6::UiTools) qmake: QT += uitools Don't know what this has to do with the topic though.
  • binary and source compatibility breakage in 6.7

    Solved
    3
    0 Votes
    3 Posts
    145 Views
    D
    Thank you for pointing that out. I can accept a merger request in my project now.
  • How to get the systems default sans serif monospace font?

    Solved
    6
    1 Votes
    6 Posts
    2k Views
    RokeJulianLockhartR
    @ChrisW67, that's brilliant. Thank you. I've found some useful corroberating information at https://superuser.com/a/1512700/904401.
  • Do Qt replica slot functions work with references?

    Unsolved
    3
    0 Votes
    3 Posts
    159 Views
    C
    Yes, it's possible, but references in .rep files typically don't persist during transfer. Use return values, state management, or callbacks to ensure the replica site gets the updated value.
  • Basic logging system - problems

    Unsolved
    5
    0 Votes
    5 Posts
    200 Views
    JonBJ
    @franco-amato Just checking you are aware of existing QMessageLogger Class.
  • QNetworkAccessManager check if file exists

    Unsolved
    19
    0 Votes
    19 Posts
    839 Views
    C
    Something along these lines might work (untested): class Uploader : public QObject { Q_OBJECT public: explicit Uploader(QObject *p = nullptr) : QObject(p) , m_nam(new QNetworkAccessManager(this)) { } void upload(const QUrl& target, const QString &file) { m_target = target; m_file = file; QNetworkReply *headReply = m_nam->head(QNetworkRequest(m_target)); connect(headReply, &QNetworkReply::finished, this, &Uploader::receiveHeadReply); // connect error signals etc... } public slots: void receiveHeadReply(QNetworkReply *reply) { qDebug() << Q_FUNC_INFO << reply->error() << reply->request().url() << reply->header(QNetworkRequest::ContentLengthHeader) << reply->header(QNetworkRequest::LastModifiedHeader); bool upload = false; if (reply->error() == QNetworkReply::NoError) { // file exists // prompt for overwrite // if yes then upload = true; } else if (reply->error() == QNetworkReply::ContentNotFoundError) { qDebug() << "Not there so we can upload"; upload = true; } else { // some other error condition we need to handle or ignore } reply->deleteLater(); if (upload) { // open m_file, read data, send data QByteArray data; QNetworkReply *putReply = m_nam->put(QNetworkRequest(m_target), data); connect(putReply, &QNetworkReply::finished, this, &Uploader::receivePutReply); } } void receivePutReply(QNetworkReply *reply) { qDebug() << Q_FUNC_INFO << reply->error() << reply->request().url(); reply->deleteLater(); } private: QNetworkAccessManager *m_nam; QUrl m_target; QString m_file; };
  • How can I extract the underlying value from QVariant?

    Unsolved model view prog
    3
    0 Votes
    3 Posts
    695 Views
    S
    @jdent said in How can I extract the underlying value from QVariant?: Do I need to do a switch with types? is QVariant::metaType the way to find the kind of value inside the QVariant? Can you show an example? This would be one way to go. I have never had a need for this, but I'll give it a try how you could solve this with a switch statement: switch(myVariant.metaType().id()) { case QMetaType::fromType<int>().id(): // handle int break; case QMetaType::fromType<QString>().id(): // handle QString break; default: // maybe a message/log that this case is unhandled break; } (I have never used QMetaType this extensively. I hope that calling id() is the smartest choice to distinguish these cases.) std::variant also has a solution with the overload pattern (using lambdas) using std::visit. It might be possible to use the overload pattern with std::visit on QVariants as well.