Results 1 to 4 of 4

Thread: QNAM returns an empty string

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QNAM returns an empty string

    Hi Guys, the QNAM in the code below returns an empty string regardless of what website I request.
    Qt Code:
    1. #include "widget.h"
    2. #include "ui_widget.h"
    3. #include <QDebug>
    4.  
    5. Widget::Widget(QWidget *parent) :
    6. QWidget(parent),
    7. ui(new Ui::Widget)
    8. {
    9. ui->setupUi(this);
    10. nam = new QNetworkAccessManager(this);
    11. }
    12.  
    13. Widget::~Widget()
    14. {
    15. delete ui;
    16. }
    17.  
    18. void Widget::on_swipeBtn_clicked()
    19. {
    20. if(ui->urlLE->text().isEmpty())
    21. {
    22. QMessageBox msgBox;
    23. msgBox.setText("URL field cannot be empty");
    24. msgBox.exec();
    25. }
    26. else
    27. {
    28. connect(nam, &QNetworkAccessManager::finished, this, [this](QNetworkReply *reply){
    29. //ui->htmlTB->setText(reply->readAll());
    30. qDebug() << static_cast<QString>(reply->readAll()) <<endl;
    31. });
    32. nam->get(QNetworkRequest(QUrl(ui->urlLE->text().simplified())));
    33. }
    34. }
    To copy to clipboard, switch view to plain text mode 
    What could be causing this?
    Last edited by ayanda83; 29th November 2017 at 06:37.

Similar Threads

  1. Replies: 13
    Last Post: 27th August 2014, 11:06
  2. QHttp readAll() return empty QbyteArray
    By chamoda in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2013, 06:59
  3. Replies: 1
    Last Post: 2nd January 2013, 09:48
  4. QLineEdit empty string
    By zgulser in forum Newbie
    Replies: 4
    Last Post: 3rd August 2010, 14:18
  5. QSplitter::saveState returns empty string
    By miraks in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2008, 21:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.