Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • reading from NetworkReply always give incomplete string of data

    Moved Unsolved
    7
    0 Votes
    7 Posts
    481 Views
    JonBJ
    @Ragbot Yes, assuming what you are getting is just JSON content, see void QNetworkReply::finished(). You can also do a readAll() there to read and save reply in one call. Presumably Ok unless package data is huge. Try just moving your readReady() to that signal?
  • Simple custom QVariant serialization not working

    Solved
    9
    0 Votes
    9 Posts
    952 Views
    P
    @Christian-Ehrlicher @Christian-Ehrlicher Thank you. Such an embarrasingly simple mistake.
  • Child widget gets event for parent widget ?...

    Unsolved
    11
    0 Votes
    11 Posts
    1k Views
    M
    @Oodini Seems you want to reinvent the wheel :) class LoggingDialog: public QDialog { Q_OBJECT public: LoggingDialog() : QDialog(nullptr) { setWindowTitle("Logging"); auto vLayout= new QVBoxLayout(this); vLayout->setSpacing(14); combo=new QComboBox; vLayout->addWidget(combo); auto label=new QLabel("Enter your password"); vLayout->addWidget(label,0,Qt::AlignCenter); edit=new QLineEdit; edit->setTextMargins(2,0,2,0); edit->setEchoMode(QLineEdit::Password); vLayout->addWidget(edit); auto button=new QPushButton("OK"); //button->setEnabled(false); vLayout->addWidget(button,0,Qt::AlignCenter); connect(button, &QPushButton::clicked, this,[this]() { bool ok=false; emit checkPassword(currentName(),edit->text(),ok); if(ok) { accept(); } else { // wrong password QMessageBox msgBox(this); msgBox.setWindowModality(Qt::WindowModal); msgBox.setText("Invalid password !"); msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel); if(msgBox.exec()==QMessageBox::Cancel) reject(); } }); } QString currentName() { return combo->currentText(); } signals: void checkPassword(const QString& name, const QString &pass,bool& ok); private: QComboBox* combo; QLineEdit* edit; }; ... LoggingDialog dialog; QObject::connect(&dialog,&LoggingDialog::checkPassword,[](const QString& name, const QString &pass,bool& ok) { ok=false; // msgbox will show up }); if(dialog.exec()==QDialog::Accepted) { qDebug()<<"Password correct for"<<dialog.currentName(); } else { qDebug()<<"operation cancelled"; } [image: Password.png]
  • Is it possible to use or reuse Windows file handle as QFile

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    A
    Hey Simon, Yes, any simple scenario like CreateFile -> CloseHandle or QFile.open() -> QFile.close() works as expected, and the file is opened, then closed. When I mix them together I never see the close happening irrespective of QFileDevice flags provided and if CloseHandle() or QFile.close() is called. QFile.isOpened() returns false after the fact though.
  • QTextTospeech can't found engines

    Solved qtexttospeech linux qt5.15.2
    12
    0 Votes
    12 Posts
    2k Views
    .
    @jsulm I finally found my mistake, I'm missing the install qtspeech5-flite-plugin Thank you
  • QVulkanInstance: No such file or directory

    Moved Unsolved
    5
    0 Votes
    5 Posts
    495 Views
    S
    @Christian-Ehrlicher thank for notice solved
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • Moving a cell widget in a QTableWidget?

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    Guy GizmoG
    @SGaist said in Moving a cell widget in a QTableWidget?: Well, the stated goal of setCellWidget is to show static content hence moving them around is not really part of the static content concept. That's too bad, and it seems like it's missing an obvious use case. I'm using cell widgets to display data in the table that is better served by a specific widget rather than just text in a cell. But since it's displaying data, it ought to be able to be moved around by dragging and dropping like every other cell, especially when it selects by row. In any case, I did find a solution! It's quite the hack and I really, really wish there was a better way to do it, but it works. After the user drops a row on to my table widget, I create a new column, populate it with integers that correspond to the new row indices after the drop, sort the table widget using that column, and then remove the column. I came upon this solution when I discovered that sorting the table widget would also move the cell widgets. It seems the trick is that it's calling changePersistentIndexList() behind the scenes, but even when subclassing there's no way for me to get access to the underlying model of the table and call that function to reorder things myself. It'd be great if: QTableWidget had built-in support for dragging and dropping rows when it's set to select by row Failing the above, there was a function for moving a cell widget to another cell so that you can implement the drag-and-drop behavior yourself.
  • How to read QWidget style margin?

    Unsolved
    5
    0 Votes
    5 Posts
    510 Views
    K
    @JonB said in How to read QWidget style margin?: try not to need to know such a detail. nice, and how ill find the data i need?
  • I don't understand QRandomGenerator.

    Unsolved
    4
    0 Votes
    4 Posts
    430 Views
    JonBJ
    @tsvigo Not sure quite what you mean or if there is still a question? QRandomGenerator has overloads which return quint32 or quint64 with generate[64]() and bounded(). If necessary pass your desired maximum value to bounded(). The return values of quint32 or quint64 are not "negative", they are unsigned/positive. What you do with that and when "written through the number" is a different matter.
  • multi nested dictionary

    Unsolved
    3
    0 Votes
    3 Posts
    367 Views
    SGaistS
    Hi, Beside the good question of @Pl45m4, it seems you would need a model on top of your nested dictionary and a QTreeView. Depending on what you do with your dictionary, using a QTreeWidget that you populate with your dict content might also be an option.
  • Qt Widget content refreshing issue

    Unsolved
    3
    0 Votes
    3 Posts
    209 Views
    SGaistS
    Hi, Without any code it's almost impossible to guess what might be going wrong. The best thing to do is to reduce your code so that only the faulty widget is present and exhibits this behaviour.
  • 0 Votes
    8 Posts
    969 Views
    Christian EhrlicherC
    @Bob64 said in Very intermittent "QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread": I should try deferring the construction of the QTcpSocket until the thread has started Yes. Or try to reproduce it in a small example. Does not look that hard 🙂
  • App crashing with custom drag and drop for QTabBar (Qt 6.5.2 for MacOS)

    Unsolved
    5
    0 Votes
    5 Posts
    590 Views
    jsulmJ
    @cadol001 You should thank @Abderrahmene_Rayene :-)
  • [SOLVED] QStatusBar - Permanent widget on the left

    14
    0 Votes
    14 Posts
    15k Views
    D
    @Abderrahmene_Rayene Sorry to bring this old topic up as well. But I do believe if you do mainWindow()->statusBar()->addPermanentWidget( new widget,1); it will put the widget on the left side, 0 will be default to the right.
  • QScrollArea hates QTabWidget ?

    Unsolved
    7
    0 Votes
    7 Posts
    502 Views
    S
    [image: 0105f950-f536-4bda-8a7f-6b4eeb4189df.png] Things in the middle getting squished, I have no idea why. The vertical size policy is preferred. The list widget at the top is set to minimumExpanding. The bottom most groupbox has also preferred vertical size policy. But this isn't getting squished. why.....
  • how to exlucde sqldrivers?

    Unsolved
    2
    0 Votes
    2 Posts
    126 Views
    jsulmJ
    @big-dick said in how to exlucde sqldrivers?: the whole project add mysql dependency Your application should work just fine without Qt MySQL plug-in.
  • How can I upload files to an Amazon S3 server with qt or c++ ??

    c++ http qt 5.4.1
    9
    0 Votes
    9 Posts
    8k Views
    SGaistS
    @Abelix hi and welcome to devnet, It was a long time ago but yes. You have to follow the specification and it works.
  • Dropping network connection leads app to freeze if a remote db is open

    Solved
    2
    0 Votes
    2 Posts
    181 Views
    Z
    @Mark81 see sysctl net.ipv4.tcp_keepalive_time, you should reduce it to something reasonable for you (7200 secs is default afair).
  • DBus async response. Correct way.

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