Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Adding individual bytes to message for serial port

    Solved
    2
    0 Votes
    2 Posts
    275 Views
    jsulmJ
    @agmar said in Adding individual bytes to message for serial port: quint8 message = 0xFF; If you need an array then use one: QByteArray message; message.append(0xFF); ... m_serial->write(message);
  • Link Custom Widget to main application - Auto compile/ Auto lookup

    Unsolved custom widget compile link
    3
    0 Votes
    3 Posts
    666 Views
    M
    @JonB Thank you for the answer this might be helpful i'm gonna try this out
  • Showing 16 bit grayscale image on QImage (Format_Grayscale16)

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    Christian EhrlicherC
    @masa4 said in Showing 16 bit grayscale image on QImage (Format_Grayscale16): Are there any option to show the image as 16 bit? Use a newer Qt version. I mean - what do you expect? Your Qt version does not provide a q6 bit grayscale so you have to work around it by the two options I gave to you.
  • Calling C++ function on QT GUI

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    JonBJ
    @Smedskjaer Hello and welcome. Please understand it takes us time too if we type in everything about Qt which is available in examples online/in the Help! Before you go any further. What do classes A, B & C do, what are they there for? "where class d inherits class a, b and c": although possible, my strong suspicion is that you will not want a class D which inherits from 3 other classes! I would start out writing your first basic Qt program with just one widget/main window, perhaps designed in the Designer. Then I would add just one extra class A. Do things a bit at a time and ask then. how can I code a GUI which passes a user input from a text box to a function of class d, and display an output in the GUI? The basic answer might be // in GUI, like a widget or main window D d; QString text = ui->textbox->text(); QString newtext = d.someMethod(text); ui->label->setText(newtext); but it all depends on what D is/does, what you really want, etc. etc.
  • macOS window list in the dock icon menu.

    Unsolved
    3
    3 Votes
    3 Posts
    494 Views
    ShrademnThillS
    Hi, I also encounter this issue and I solved it by delaying the show: QTimer::singleShot(250, this, [this] { trayIcon.show(); });
  • Problem with app working

    Unsolved
    6
    0 Votes
    6 Posts
    454 Views
    D
    @jsulm How do this ? Actually I run my app in Debian by script prepared by CQtDeployer ... I understand that problem with ACPI BIOS Error Bug when my Debian is starting ,it shouldn't be the cause of the problem ?
  • The Logs are not showing in Application Window.

    Unsolved
    23
    0 Votes
    23 Posts
    3k Views
    JonBJ
    @Aviral-0 said in The Logs are not showing in Application Window.: The Base version code is this which runs and displays last 10 Logs but is not dynamically updating new logs from file: Since you use tail without the -f option. As stated by @jsulm a better way is @Aviral-0 You can open the file, seek to file end and then connect a slot to https://doc.qt.io/qt-6/qfilesystemwatcher.html#fileChanged signal. In the slot you simply read to the end of the file and add the data you read to your log widget. or just a QTimer instead of QFileSystemWatcher. Last time of saying this, up to you which way you go.
  • Connection Signal/Slot not working (with window "separation")

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    Juan de DironneJ
    Thank you very much for your answers and your time spent.
  • Adding QChar into a QString

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    A
    @jsulm That did it, thank you, i am just new to this, is all
  • How to Display recent Logs and can be filter according to the checkboxes?

    Unsolved
    13
    0 Votes
    13 Posts
    2k Views
    Aviral 0A
    @jsulm Hi, Please look at this https://forum.qt.io/post/746818
  • Hi everyone

    Unsolved
    3
    0 Votes
    3 Posts
    303 Views
    W
    @Snow-Valley Hello!
  • .readAll succeed but Segmentation fault on ~QByteArray when function return

    Unsolved
    12
    0 Votes
    12 Posts
    739 Views
    C
    @JonB said in .readAll succeed but Segmentation fault on ~QByteArray when function return: so OP is using a Qt resource file, hence can't ask Pugixml to open that! :) Missed that
  • QUndoCommand Update UI

    Unsolved
    5
    0 Votes
    5 Posts
    507 Views
    G
    @JonB @JonB said in QUndoCommand Update UI: @gsephelec Then I can only guess you are asking to not always do ui->imageEditor->update(); after undoStack->undo();, is that the question? Yes exactly :) @JonB said in QUndoCommand Update UI: @gsephelec So, for example, make your undo() look at what it is undoing and return a result to the caller indicating whether the image editor still needs updating? Or, maybe, have the undo command which affects the image editor emit a signal/set a flag when it does so, so you will know the image needs updating? Yes to both, which is the better practice and what would be the best way to implement it? I did also look at passing an "update ui" function from within the assetEditor class to the QUndoCommand, but I couldn't get this to work properly and I wasn't sure if that was a messy way to get round my issue?
  • How to set icons in QTableWidget based on specific number?

    Solved
    4
    0 Votes
    4 Posts
    712 Views
    SGaistS
    @ApprenticeReno hi, If you want an array, use QVector. As for the error you are getting, please check the stack VS heap allocation C++ concept.
  • How to organize projects for "configuration" ?

    Unsolved
    1
    0 Votes
    1 Posts
    126 Views
    No one has replied
  • Correct syntax for INCLUDEPATH

    Moved Unsolved
    1
    0 Votes
    1 Posts
    161 Views
    No one has replied
  • How to get an ip address and send a frame to this address?

    Unsolved
    11
    0 Votes
    11 Posts
    757 Views
    Kent-DorfmanK
    @Raphawel said in How to get an ip address and send a frame to this address?: Why TCP ? Because TCP allows to connect and exchange data between objects connected on the same network TCP is a stream so understand that you are responsible for assembling a valid message from any number of reads that can return any possible fragment of a message.
  • Change icon when QToolButton is pressed

    Solved qicon qtoolbutton qiconmode
    5
    0 Votes
    5 Posts
    3k Views
    SavizS
    @SimonSchroeder Thank you so much. This was the most honest answer I ever seen in this forum up until now. I appreciate it.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Send a request to an IP address

    Solved
    14
    0 Votes
    14 Posts
    779 Views
    R
    @JonB Ok thanks for your help but I managed to get my relay opened. In the code I modified this part by changing : My .h: #ifndef REQUESTMANAGER_H #define REQUESTMANAGER_H #include <QMainWindow> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkReply> #include <QtNetwork/QAuthenticator> #include <QPushButton> namespace Ui { class RequestManager; } class RequestManager : public QMainWindow { Q_OBJECT public: explicit RequestManager(QWidget *parent = 0); ~RequestManager(); private slots: void on_sendButton_clicked(); void handleResponse(); // changing handleResponse(QNetworkReply *reply); void sendRequest(); private: Ui::RequestManager *ui; QNetworkAccessManager m_manager; QPushButton *m_button; QNetworkReply *m_reply; //add }; #endif // REQUESTMANAGER_H My .cpp : #include "requestmanager.h" #include "ui_requestmanager.h" #include <QCoreApplication> #include <QObject> #include <QTextStream> #include <QByteArray> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkReply> #include <QUrl> #include <QPushButton> RequestManager::RequestManager(QWidget *parent) : QMainWindow(parent), ui(new Ui::RequestManager) { ui->setupUi(this); m_button = new QPushButton("Close Relay", this); //Appuie sur bouton pour envoyer la requête connect(m_button, &QPushButton::clicked, this, &RequestManager::on_sendButton_clicked); } RequestManager::~RequestManager() { delete ui; } void RequestManager::sendRequest() { QNetworkRequest request(QUrl("http://192.168.1.220/hidden.htm?M0:O1=ON")); m_reply = m_manager.get(request); connect(m_reply, &QNetworkReply::finished, this, &RequestManager::handleResponse); } void RequestManager::handleResponse() { QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender()); //add if (reply->error() != QNetworkReply::NoError) { // Handle error } else { // Process response data } reply->deleteLater(); m_reply = nullptr; //add } void RequestManager::on_sendButton_clicked() { sendRequest(); } And thanks to these changes no more errors, there was an error in the slots :)