Red de conocimiento informático - Problemas con los teléfonos móviles - Qt qwebview usa setHtml(); luego se muestra el código html entrante, pero ¿por qué no se muestra? ¿Cómo solucionarlo?

Qt qwebview usa setHtml(); luego se muestra el código html entrante, pero ¿por qué no se muestra? ¿Cómo solucionarlo?

Según la descripción en la documentación, se requiere el segundo parámetro de setHtml para mostrar la imagen.

void q webview::set html(const QString & html, const QUrl & ampbaseUrl = QUrl())

Objetos externos a los que se hace referencia en el documento HTML (como hojas de estilo o imágenes ) posicionado en relación con baseUrl.

//Ejemplo

# incluir & ltQt core/q file & gt;

# incluir & ltQt core/QUrl & gt; p># incluir & ltQt GUI/q aplicación & gt;

# incluir & ltQt GUI/QMainWindow & gt;

# incluir & ltQt WebKit/QWebView & gt;

int main(int argc, char*argv[])

{

aplicación QApplication(argc, argv);

ventana QMainWindow;

Vista web QWebView(& ventana);

QFile source(":/Google . com . html ");

source open(QIODevice:: ReadOnly) ;

webview . set html(QString::from utf8(source . read all(). constData()), QUrl(" ");

setcentralwidget(& amp ; webview

window.show()

Devolver aplicación .

}

Referencias:

/questions/5126294/q webview-no-carga-cualquier-recurso-externo-si-carga-un-archivo-html-desde-qre sou