QT5.7中使用QNetworkReply怎么获取http返回的cookies数据

QT5.7中使用QNetworkReply怎么获取http返回的cookies数据,第1张

//打开数据
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
dbsetDatabaseName("nmrdb");
if (!dbopen())
{
QMessageBox::critical(0, qApp->tr("Cannot open database"),
qApp->tr("Unable to establish a database connection\n"
"This example needs SQLite support Please read "
"the Qt SQL driver documentation for information how "
"to build it\n\n"
"Click Cancel to exit"), QMessageBox::Cancel);
return false;
}
//建个QListView显示数据库中的表
//显示数据表
void MainWindow::listDb()
{
dbListModel =new QStringListModel();
dbListModel->setStringList(QSqlDatabase::database()tables());
ui->listView->setModel(dbListModel);
ui->listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->listView->setResizeMode(QListView::Adjust);
connect(ui->listView,SIGNAL(clicked(QModelIndex)),this,SLOT(showDb(QModelIndex)));
}
//SLOT:数据显示在QTabelView控件中
void MainWindow::showDb(QModelIndex index)
{
dbName=indexdata()toString();
tableViewModel=new QSqlTableModel(this);
tableViewModel->setTable(dbName);
tableViewModel->select();//
ui->dbTable->setSortingEnabled(true);
ui->dbTable->setModel(tableViewModel);
ui->dbTable->sortByColumn(1,Qt::AscendingOrder);
ui->dbTable->resizeColumnsToContents();
ui->dbTable->setSelectionBehavior(QAbstractItemView::SelectRows);
}

用QFtp应该可以做到吧, 摘自Qt的帮助文档, QFtp::get()时将次二哥参数设置为0,之后收到 readyRead()后可以通过read()或readAll()读取到内存里。
int QFtp::get ( const QString & file, QIODevice dev = 0, TransferType type = Binary )
If dev is 0, then the readyRead() signal is emitted when there is data available to read You can then read the data with the read() or readAll() functions


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/13326142.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-15
下一篇 2023-07-15

发表评论

登录后才能评论

评论列表(0条)

保存