Maybe try a stylesheet instead.

from PySide2 import QtWidgets

channelbox = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout(channelbox)
layout.setSpacing(0)
for row in range(15):
    layout.addWidget(QtWidgets.QLineEdit())

channelbox.setStyleSheet("""\
QLineEdit {
    border: 0px;
    border-left: 13px solid red;
    padding-left: 3px;
}
""")
channelbox.show()
# border: (Somehow) required for border-left to work# border-left: Red
colouring# padding-left: Spacing between color and value

[image: image.png]

Bear in mind pixel values need to be multiplied by your display DPI
scaling. E.g. a width of 5 px would get half as wide on a Retina display
with a scaling of 2x. You can get scaling from Qt. Also might be able to
vanquish the spacing between line edits with some more CSS. For the colour
you could use CSS names like red, hex like #FF0000 or rgb(127, 0, 255).

On Wed, 22 Jan 2020 at 21:07, yann19 <yangki...@gmail.com> wrote:

> Hi Marcus, sorry for the late reply.
>
> Say I am not going for the technicality/ code changed that is happening
> behind the scene. But rather trying to create a QLineEdit that is the same
> as the one you see in Maya.
>
> I tried the following:
> my_icon="full_keyed.png" #this is the red color label that we see in maya
> self.ui.transX_lineedit.addAction(my_icon,QLineEdit.LeadingPosition)
>
> As a start, this replication design is somewhat close to the ones we see
> in Maya, however, (see attached), I am having some issues such as:
> * note the 'small' spacing between the left-outermost edge of the
> QLineEdit and the red icon
> * Icon size is wrong - the image is saved with a 10x16 pixel size, I am
> expecting it to be a rectangular than squarish..
>
> [image: lineedit_test.jpg]
>
>
> Any insights?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/eefc3480-e450-47cd-a61f-2d345be1be2d%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/eefc3480-e450-47cd-a61f-2d345be1be2d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBCSuR%3D3npj%3D34-ypanTacS1YU21nMjyb-XZcNJBOy0-Q%40mail.gmail.com.

Reply via email to