Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #95 - Make Geometry Preview work on Ubuntu 20.04 (workaround) #342

Merged
merged 1 commit into from
May 28, 2021

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented May 25, 2021

Fix #95

It took me 6 hours to find a workaround to make it work... I have an open stack overflow question here: https://stackoverflow.com/questions/67692525/cannot-load-qrc-html-file-in-qwebengineview-on-ubuntu-20-04-only

For now, we'll just read the entire content of the HTML file, then call QWebEngineView::setHtml ...

What's driving me insane is that it works with GeometryEditorView:

m_view->load(getEmbeddedFileUrl("embeddable_geometry_editor.html"));

Edit: Bumped ThreeJS version instead

connect(m_view, &QWebEngineView::loadFinished, this, &PreviewWebView::onLoadFinished);
//connect(m_view, &QWebEngineView::loadProgress, this, &PreviewWebView::onLoadProgress);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These drive the progress bar when loading right? That is useful for feedback when loading large models, can we keep these lines?

m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::SpatialNavigationEnabled, true);

/*
m_view->settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You think these are unneeded?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They weren't enabled before. During testing I enabled them, but it didn't make any difference

// QUrl previewURL("qrc:///library/geometry_preview.html");
m_view->load(previewURL);

// Local FileSystem: This works on Ubuntu 20.04 as well....
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe something is broken loading html from a QRC on Ubuntu 20.04?

@macumber
Copy link
Collaborator

Wow, thanks for digging into this @jmarrec, I will build and test on Ubuntu 20.04 and Windows. It seems like some of the debugging stuff can get reverted but the overall approach seems to be ok (read QRC to string then call setHtml), seems like maybe there is a bug reading html from QRC? It's possible we could make that a platform dependent switch?

@macumber
Copy link
Collaborator

As noted on #233 we should update to the newest ThreeJS at some point. https://www.ladybug.tools/spider-2020/spider-idf-viewer/ should be a good example

@jmarrec jmarrec changed the base branch from develop to v1.2.0-rc2 May 28, 2021 07:03
@jmarrec jmarrec merged commit 903d52d into v1.2.0-rc2 May 28, 2021
@jmarrec jmarrec deleted the 95_Debug_GeometryPreview branch May 28, 2021 07:03
@jmarrec
Copy link
Collaborator Author

jmarrec commented May 31, 2021

On my ubuntu 20.04 I can see the maximize button just fine

image

When maximized too:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geometry Editor not working on Ubuntu
2 participants