Discord widget using Qt
-
It's a JavaScript based widget so you need a browser widget. On desktop it usually means QtWebEngine (QtWebView uses QtWebEngine on platforms without system provided webview) so no, static build is not an option as web engine does not build statically (nothing to do with Qt).
-
This is working:
#include <QWebEngineView> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWebEngineView view; view.setHtml(R"(<iframe src="https://discord.com/widget?id=723331111111505017&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>)"); view.resize(350, 500); view.show(); return app.exec(); }
When i load it into QMainWindow its not being shown:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); QWidget* widget = new QWidget(ui->centralwidget); widget->setObjectName("test"); widget->setGeometry(10, 10, 350, 500); widget->setStyleSheet("#test { background-color: black; }"); QWebEngineView view; view.setHtml(R"(<iframe src="https://discord.com/widget?id=723331111111505017&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>)"); view.setGeometry(10, 10, 350, 350); view.resize(350, 500); view.show(); QGridLayout* lay = new QGridLayout(); widget->setLayout(lay); lay->addWidget(&view); widget->show(); view.show(); }
-
SGaist said in Discord widget using Qt:
It's a JavaScript based widget so you need a browser widget. On desktop it usually means QtWebEngine (QtWebView uses QtWebEngine on platforms without system provided webview) so no, static build is not an option as web engine does not build statically (nothing to do with Qt).
@SGaist I'm building my qt app with the static source, so it's not possible to use the
webenginewidgets
module?