0

i have a QlineEditText which is given Qlayout by me i want to update it but it says:

QLayout: Attempting to add QLayout "" to QLineEdit "lineEdit_2", which already has a layout

MTL.Convert(self.lineEdit_2,'$' + str(self.lineEdit.text()) + '$')

class MathTextLabel(QtWidgets.QWidget):
    #def __init__(self, mathText, parent=None, **kwargs):
    def Convert(txt, mathText):
        super(QtWidgets.QWidget, txt)

        l=QVBoxLayout(txt)

        l.setContentsMargins(0,0,0,0)

        r,g,b,a=txt.palette().base().color().getRgbF()

        txt._figure=Figure()

        txt._canvas=FigureCanvas(txt._figure)

        l.addWidget(txt._canvas)

        txt._figure.clear()

        text=txt._figure.suptitle(
            mathText,
            x=0.0,
            y=1.0,
            horizontalalignment='left',
            verticalalignment='top',
            size=QtGui.QFont().pointSize()*2
        )

this works 1st time converting my Latex to equation in a layout inplace of my 2nd QlineEditText but when i press the button again after changing the latex Eq in the 1st Textbox it says:

QLayout: Attempting to add QLayout "" to QLineEdit "lineEdit_2", which already has a layout

James Z
  • 12,209
  • 10
  • 24
  • 44
shafay
  • 41
  • 4

0 Answers0