小编RuQ*_*uQu的帖子

如何在QWebview中显示本地HTML?

我怀疑这是如此基本,没有人费心去记录它.

我想从我的程序中编写一个HTML文件,然后将该文件加载到QWebview对象中.

当我打开QtCreator时,我可以导航到右侧URL块中的文件,它显示在QtCreator中.当我编译并运行程序时,窗口是白色和空白的.

我也不希望目录硬编码,我希望它使用当前目录.

所以我想有两个问题:

  1. 我怎么写??? 在下面获取名为"reportView"的QWebview对象来显示我的本地文件?

ui->reportView->load(QUrl("???"));
Run Code Online (Sandbox Code Playgroud)
  1. 为什么QWebview对象保持空白?我怀疑连接到Google文档时出现问题,因为我收到此错误:

QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
Run Code Online (Sandbox Code Playgroud)

谢谢.

qt qwebview

10
推荐指数
2
解决办法
2万
查看次数

为什么mktime()改变了我的tm结构的年份?

我读了两个字符串,包括年份,朱利安日(年),小时,分钟和观察.

我使用sscanf将相关变量拉出来:

sscanf(tide_str1.c_str(), "%d %d %d %d %Lf", &y1, &j1, &h1, &m1, &obs1);
sscanf(tide_str2.c_str(), "%d %d %d %d %Lf", &y2, &j2, &h2, &m2, &obs2);
Run Code Online (Sandbox Code Playgroud)

对于此特定数据集,值为2011 083 23 22 1.1

然后我创建并填充一个tm结构,运行mktime,在两天之间的cout调用,它从083变为364.

int y1=2011, j1=83, h1=23, m1=22;
struct tm time_struct = {0, 0, 0, 0, 0, 0, 0, 0, 0}, *time_ptr = &time_struct;
time_t tv_min;
time_struct.tm_year = y1 - 1900;
time_struct.tm_yday = j1;
cout << time_struct.tm_yday << endl;
time_struct.tm_hour = h1;
time_struct.tm_min = m1;
time_struct.tm_isdst = -1;
cout << time_struct.tm_yday << endl; …
Run Code Online (Sandbox Code Playgroud)

c++ mktime

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

mktime ×1

qt ×1

qwebview ×1