Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Send image inside Json through QTcpSocket

    Solved
    28
    0 Votes
    28 Posts
    5k Views
    T
    @KroMignon Hi. I eventually managed to show the image. I was missing: ba = ba.fromBase64(); before pm.loadFromData(...), and now it works. Thanks!
  • 0 Votes
    3 Posts
    279 Views
    A
    I place the cursor at the position emitted by the signal contentsChange "maybe the change is not yet applied when the signal is emitted? " No, because I'm able to fetch the correct format using currentCharFormat(), but it works only when the textCursor() position is right after the position in which the character has been placed. Let's say I made the selection from right to the left, currentCharFormat() picks the format of the previous character.
  • QNetworkAccessManager in loop ?

    Solved
    5
    0 Votes
    5 Posts
    2k Views
    S
    @sonichy its working but is not optimised. You can prevent creating many objects by using QNetworkReply and C++11 lambda as follow: void FormFind::search() { QString sql="select * from user where name like '%" + ui->lineEdit->text() + "%'"; bool b=query.exec(sql); QNetworkAccessManager *manager = new QNetworkAccessManager(this); while(query.next()) { int ids = query.value("id").toInt(); QString name = query.value("name").toString(); QString sex = query.value("sex").toString(); QString urla=query.value("avantar").toString(); itemfind=new ItemFind; itemfind->ui->labelAccount->setText(QString::number(ids)); itemfind->ui->labelName->setText(name); itemfind->ui->labelSex->setText(sex); itemfind->ui->labelDomicile->setText(domicile); QListWidgetItem *LWI = new QListWidgetItem(ui->listWidget); ui->listWidget->addItem(LWI); ui->listWidget->setItemWidget(LWI,itemfind); LWI->setSizeHint(QSize(140,70)); QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(urla))); connect(reply, &QNetworkReply::finished, [=, &reply, &itemfind]() { //handle http redirection (code 302) if you like as described in // https://forum.qt.io/topic/50516/qnetworkreply-readall-gets-empty-data-on-finished/23 if(reply->error() == QNetworkReply::NoError) { QByteArray response = reply->readAll(); itemfind->loadPixmap(response); } else { qDebug() << "reply" << reply->error(); } reply->deleteLater(); } } } void ItemFind::loadPixmap(QByteArray data) { QPixmap pixmap; pixmap.loadFromData(data); ui->labelAvantar->setPixmap(pixmap.scaled(60,60)); }
  • Problems use QFtp in QThread

    Solved
    3
    0 Votes
    3 Posts
    244 Views
    Bruce.ZhangB
    @KroMignon said in Problems use QFtp in QThread: connect(mQFtpPtr, &QFtp::commandFinished, this, &FtpOutput::onFtpCommandFinished); connect(mQFtpPtr, &QFtp::dataTransferProgress, this, &FtpOutput::onDataTransferProgress); connect(mQFtpPtr, &QFtp::stateChanged, this, &FtpOutput::onStatusChange); connect(mQFtpPtr, &QFtp::listInfo, this, &FtpOutput::onListInfo); Thanks a lot, really works.
  • threads and created objects

    Solved
    26
    0 Votes
    26 Posts
    3k Views
    mzimmersM
    @kshegunov well...yes it does. I was missing the " : m_serial(this)" clause. Thanks!
  • problem in run external program with QProcess

    Unsolved
    19
    0 Votes
    19 Posts
    2k Views
    S
    @JonB sorry about that, i only see unknow error -_- thanks about help
  • Centering an uploaded photo after rounding it

    Solved
    13
    0 Votes
    13 Posts
    977 Views
    T
    @SGaist Yes, but I also toyed with the position/alignment settings in the .ui designer and got it to work :)
  • Add QWidget above QToolBar in QMainWindow

    Solved qmainwindow qtoolbar layouts
    5
    0 Votes
    5 Posts
    3k Views
    J
    @Rizwan94 May I ask what was your final implementation? I'm trying to setup a frameless window and add my title/close buttons on top of an existing QMainWindow (from .ui) Thanks in advance
  • Passing QScopedPointer to a member object

    Solved
    5
    0 Votes
    5 Posts
    661 Views
    ODБOïO
    @Christian-Ehrlicher ok good. Thanks
  • Bash: ./filename: cannot execute binary file: Exec fortmat error

    Unsolved imx6
    2
    0 Votes
    2 Posts
    459 Views
    Christian EhrlicherC
    @rtvideo said in Bash: ./filename: cannot execute binary file: Exec fortmat error: Is there anyway to get around this and be able to run the binary on the IMX6? You have to compile it for this architecture. Search for 'cross compile'.
  • Updating widget stylesheet in succession

    Unsolved
    15
    0 Votes
    15 Posts
    1k Views
    Christian EhrlicherC
    It depends on the size but yes. Still don't understand why you can't the state when it changes from active to inactive and back.
  • 0 Votes
    41 Posts
    15k Views
    R
    Upgrading to Qt Version 5.15+ solved the issue.
  • 0 Votes
    1 Posts
    120 Views
    No one has replied
  • 0 Votes
    25 Posts
    4k Views
    jsulmJ
    @MostafaEzzat Yes, plug-ins are somewhat special: they are expected to be in a specific location and are loaded at runtime.
  • QTableView memory usage

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    AndeolA
    @JonB Considering that the spike in memory use happens before any call to data() is done, but just after the first call to rowCount(), I think you're right.
  • Placing breakpoint kills child processes on remote debug

    Unsolved
    7
    0 Votes
    7 Posts
    738 Views
    MuratUrsavasM
    Really confused at this point. If I run the secondary software manually it can dodge SIGTRAP and continues its way normally. But if I start it with its own source code via GDB, it is terminated with SIGTRAP signal exception message.
  • Blinking cursor leaving an artifact in QTextEdit

    Unsolved
    3
    0 Votes
    3 Posts
    495 Views
    M
    Thanks @SGaist I created a bug here: https://bugreports.qt.io/browse/QTBUG-86823 It's been triaged and is a P2
  • Is it safe to use QClipboard in a background thread

    Solved
    13
    0 Votes
    13 Posts
    2k Views
    jeremy_kJ
    @SimonSchroeder said in Is it safe to use QClipboard in a background thread: @kshegunov said in Is it safe to use QClipboard in a background thread: This approach would make sure that access to the clipboard is synchronized. How? To be more specific: This synchronizes access to the clipboard for this single program, but not between programs. If all access to the clipboard is sent to the event queue of a single thread it is synchronized. The event queue will only handle one event after the other. Then it does not matter if QClipboard is thread-safe if only a single thread accesses it. Sending an application's clipboard access to a non-gui thread event loop doesn't alter the access for any Qt or 3rd party components, or the QPA plugin.
  • Accessing headers/cookies in WebSockets handshake request

    Solved websocketserver cookies headers
    5
    0 Votes
    5 Posts
    2k Views
    C
    @Pablo-J-Rogina Accidentally found needed code in QT sources. It returns all the cookies one by one. QVariant hdr = rq.header(QNetworkRequest::CookieHeader); QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie> >(hdr); QList<QNetworkCookie>::ConstIterator it = cookies.begin(), end = cookies.end(); for ( ; it != end; ++it) { qDebug() << it->name(); }
  • I want to catch a paste action from a widget

    Unsolved
    2
    0 Votes
    2 Posts
    234 Views
    jsulmJ
    @jane477 I guess you mean drop event? https://doc.qt.io/qt-5/qwidget.html#dropEvent