Can or can't i use PySide.QtGui.QWidget.addAction
to place a icon in front of the lineEdit even if this method can take onle one argument in Pyside1?
I want to implement a login UI in my python
scripts for 3ds Max, just like How to place an icon onto a QLineEdit?
, but i have to use PySide1 because 3ds Max only supports PySide1 before version-2018.
I check Pyside1 and Pyside2 API and i find that:
In PySide1, the method
PySide.QtGui.QWidget.addAction(action)
can only take 1 arg. this is pyside1 apiBut in Pyside2, the same method takes one more arg, like:
PySide2.QtWidgets.QLineEdit.addAction(icon, position)
, which is what i want because i need to place an icon in fornt of theQLineEdit
.this is pyside2 api
this is my partly code, self.usernameStr
in my class
, no error.
# pyside1, which is wrong to take 2 args
# it's in my class
self.usernameStr = QtGui.QLineEdit()
self.usernameStr.addAction("ic_user.svg", QLineEdit().LeadingPosition)
which is wrong, TypeError: addAction() takes exactly one argument (2 given)
But in pyside2, addAction
can take the constant LeadingPosition
, perfectly like the answer. stackoverflow: how-to-place-an-icon-onto-a-qlineedit
So can or can't i implement this function? Thanks very much for your answer :)