2

I'm trying to open files dynamically through actions. A simple example would be:

Action name: OpenLink

from PyQt4.QtCore import QUrl; 
from PyQt4.QtWebKit import QWebView;  

myWV = QWebView (None);
myWV.load(QUrl('[% "myColumn" %]')); myWV.show()

However this example is working with a fixed column name (myColumn). What I want to do is execute the action using whatever column in the object attributes I have selected.

Let's say I have three columns:

  • mycolumn
  • myColumn2
  • myLink

when I right-click myLink, I would like to use the value from it in the above action. Is that possible?

Image: enter image description here

1
  • 1
    Why use a QWebView - what if a file is not viewable in a browser. I just use [%myLink%] and define the action type as Open.
    – Jakob
    Commented May 1, 2019 at 7:15

1 Answer 1

1

You can use @current_field:

from PyQt4.QtCore import QUrl; 
from PyQt4.QtWebKit import QWebView;  

myWV = QWebView (None);
myWV.load(QUrl('[% @current_field %]')); myWV.show()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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