Issue 1106 (#1107)

* Help browser problem mitigation: on Qt6 (?), QTextBrowser appears to be reloading images relative to the new URL on a URL change. This caused 'missing resource' exceptions. As long as the root cause of this problem is not know, the exceptions are turned into log errors now.

* Fixed issue 1106
This commit is contained in:
Matthias Köfferlein 2022-07-17 19:59:29 +02:00 committed by GitHub
parent 682cc0e491
commit b1661d3c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 12 deletions

View File

@ -1466,9 +1466,6 @@ PartialService::transform_selection (const db::DTrans &move_trans)
// then move all instances.
// TODO: DTrans should have a ctor that takes a vector
db::DTrans move_trans_inst = db::DTrans (db::DVector () + lay::snap_angle (m_current - m_start, move_ac ()));
// sort the selected objects (the instances) by the cell they are in
// The key is a pair: cell_index, cv_index
std::map <std::pair <db::cell_index_type, unsigned int>, std::vector <partial_objects::const_iterator> > insts_by_cell;
@ -1494,7 +1491,7 @@ PartialService::transform_selection (const db::DTrans &move_trans)
if (tv_list && ! tv_list->empty ()) {
db::CplxTrans tt = (*tv_list) [0] * db::CplxTrans (cv->layout ().dbu ()) * cv.context_trans ();
db::ICplxTrans move_trans_dbu (tt.inverted () * db::DCplxTrans (move_trans_inst) * tt);
db::ICplxTrans move_trans_dbu (tt.inverted () * db::DCplxTrans (move_trans) * tt);
std::sort (insts_to_transform.begin (), insts_to_transform.end ());
std::vector <std::pair <db::Instance, db::ICplxTrans> >::const_iterator unique_end = std::unique (insts_to_transform.begin (), insts_to_transform.end ());

View File

@ -674,16 +674,24 @@ BrowserPanel::loadResource (int type, const QUrl &url)
{
if (type == QTextDocument::ImageResource) {
BEGIN_PROTECTED
return QVariant (mp_source->get_image (tl::to_string (url.toString ())));
END_PROTECTED
try {
return QVariant (mp_source->get_image (tl::to_string (url.toString ())));
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
} catch (...) {
}
return QVariant ();
} else if (type == QTextDocument::StyleSheetResource) {
BEGIN_PROTECTED
return QVariant (tl::to_qstring (mp_source->get_css (tl::to_string (url.toString ()))));
END_PROTECTED
try {
return QVariant (tl::to_qstring (mp_source->get_css (tl::to_string (url.toString ()))));
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
} catch (...) {
}
return QVariant ();
} else if (type != QTextDocument::HtmlResource) {
@ -707,7 +715,7 @@ BrowserPanel::loadResource (int type, const QUrl &url)
// (normal) override cursor.
QApplication::setOverrideCursor (QCursor (Qt::ArrowCursor));
BEGIN_PROTECTED
try {
std::string u = tl::to_string (url.toString ());
std::string s;
@ -756,7 +764,10 @@ BrowserPanel::loadResource (int type, const QUrl &url)
// push the outline
set_outline (ol);
END_PROTECTED
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
} catch (...) {
}
QApplication::restoreOverrideCursor ();