Accessing the text in a TextEdit that is allocated to a QMdiSubWindow
-
Hi, very new to python and PyQT6. So jumping in the deep end I have been working on an MDI text Editor and have met a number of issues but the main one I cannot get past as it appears nobody covers it.

It is how do you access the QTextEdit widget to work on text within the window as a normal text editor is supposed to??
I understand the mdi calls to move through the windows but as you can see on the pic2 the only reference I can get is the memory address as once I setWidget() the QTextEdit abilities are lost to me.!

I hope that makes sense, I can type in text into the window but say I wanted to to highlight text and hit Bold on the toolbar I do not know how to reference that text. Any help would be appreciated, thanks in advance. -
Hi, very new to python and PyQT6. So jumping in the deep end I have been working on an MDI text Editor and have met a number of issues but the main one I cannot get past as it appears nobody covers it.

It is how do you access the QTextEdit widget to work on text within the window as a normal text editor is supposed to??
I understand the mdi calls to move through the windows but as you can see on the pic2 the only reference I can get is the memory address as once I setWidget() the QTextEdit abilities are lost to me.!

I hope that makes sense, I can type in text into the window but say I wanted to to highlight text and hit Bold on the toolbar I do not know how to reference that text. Any help would be appreciated, thanks in advance.@Pixelhead120
Hello and welcome.Next time please copy & paste code as text (use Code toolbar button here
</>), so that responders can access your code.filenew.setWidget(QTextEdit)There are a several ways of accessing this widget after you create it, including:
self.mdi.currentSubwindow().widget()/w.widget()self.textEdit = QTextEdit()beforefilenew.setWidget(self.textEdit)instead offilenew.setWidget(QTextEdit)
You will want to think about where and what
selfto keep variables etc. for MDI subwindows under. It quickly gets messy keeping everything inMainWindow, you may want classes and their own member variables for MDI subwindows.There is absolutely nothing special about a
QTextEdithappening to be on an MDI subwindow. -
@Pixelhead120
Hello and welcome.Next time please copy & paste code as text (use Code toolbar button here
</>), so that responders can access your code.filenew.setWidget(QTextEdit)There are a several ways of accessing this widget after you create it, including:
self.mdi.currentSubwindow().widget()/w.widget()self.textEdit = QTextEdit()beforefilenew.setWidget(self.textEdit)instead offilenew.setWidget(QTextEdit)
You will want to think about where and what
selfto keep variables etc. for MDI subwindows under. It quickly gets messy keeping everything inMainWindow, you may want classes and their own member variables for MDI subwindows.There is absolutely nothing special about a
QTextEdithappening to be on an MDI subwindow.@JonB Thank you for your advice and will have a look at what you've given me.