2

I want to create an action in QGIS with multiple Expression. But unable to do so. I want to open images from two different directories with one action. Is it possible? How can I do so?

e.g.

Type : open
name : open Photo
D:\image\Path_1\[%"Photo"%].jpg
D:\image\Path_2\[%"Photo"%].jpg

But it's not working. How can I fix it?

  • Does it work when you specify one .jpg only ? – snaileater Apr 3 at 10:47
  • + Where do u want the pictures to be opened ? In QGIS ? In a web Browser ? in the Windows Explorer ? – snaileater Apr 3 at 11:30
  • Yes it work when i specify picture format(e.g .jpg).Because i use just picture name in column. I want to open picture in window explorer. – Ali Abbas Apr 4 at 10:08
0

Still awaiting some clarification but here is a working example i just tried (QGIS 3.4.4) :

Action - type Python

from PyQt5.QtCore import QUrl
from PyQt5.QtWebKitWidgets import QWebView

myWV1 = QWebView(None)
myWV1.load(QUrl('file:///D://tempo//' + [% concat('\'',"FIRST_FIELD",'\'') %] + '-1.png'))
print('après')
myWV1.show()

myWV2 = QWebView(None)
myWV2.load(QUrl('file:///D://tempo//' + [% concat('\'',"SECOND_FIELD",'\'') %] + '-2.png'))
myWV2.show()

Which is opening 2 images (in 'local' files) in two separate (non modal) windows. Some tweaking certainly required if you need another behaviour ...

I played a bit with strings to show you a working syntax (escaping quotes ...)

  • I have one field in which all picture name are stored in Qgis points layer. I want to open picture in window explorer with the help of qgis action and i create a action which is working perfectly but i have issue in that because this action is working when all picture are stored in one folder. I just want to open image in window explorer from two different folder in one action. Please help me out. – Ali Abbas Apr 4 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.