Geographic Information Systems Asked by SYG on April 4, 2021
I’m facing trouble with display a picture in a ui form based on a field (path).
With the autogenerate form it works but when I try with a personalized form I cannot see the picture.
I tried with a Qlabel and QWebView in Qt Designer and in QGIS layer property I put the field as Attachment but without success.
I know that I can make a little python script to achieve this but I would like to store the ui in a db.
Does anyone have an idea ?
you can use tips tool in qgis and write with html code for insert any file and even open file out of qgis
Answered by GIS_Esri on April 4, 2021
It seems possible by tricking QGIS and Qt Creator.
This is how I proceeded.
In QtCreator, you create a new QTextBrowser widget. As usual, you give it the name of the QGIS source field. You need to right click on the new widget and select "Promote In…" and enable both options "QtWebView/QtWebKit" and "QgsExternalResourceWidget" if they are not.
In QGIS now, you select your custom form. The source field has to be set as a Text source. You have to enable HTML rendering as well.
The data has to be input as HTML inside the field. So you can create for example a field in which you will store the path of your picture and then create a calculation field rendering HTML as follow:
'<img src="' || "Photo" || '">'
That's all what you have to do. That will let you create more beautiful forms than the ones in QGIS. It's even more simple than before.
Answered by M-Rick on April 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP