OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

When selecting text in Console Ouptut using QTextBroser, the text disappears

  • Thread starter Thread starter user3719581
  • Start date Start date
U

user3719581

Guest
I use QTextBrowser in a PyQt6-Widget in order to display read-only console output. Problem is: the displayed text disappears after I select it with the mouse in order to copy it. How can I deactivate this from happening?

Code:
self.output = QTextBrowser(readOnly=True)
self.output.setStyleSheet("background-color: black;color:white")
self.OutputSb = self.output.verticalScrollBar()
self.OutputSb.setValue(self.TestOutputSb.maximum())




def message(self, s):
   self.output.insertPlainText(s)

   self.TestOutputSb.setValue(self.TestOutputSb.maximum())

It should show the read-only text and I should be able to select, copy and paste it without altering it.
<p>I use QTextBrowser in a PyQt6-Widget in order to display read-only console output. Problem is: the displayed text disappears after I select it with the mouse in order to copy it. How can I deactivate this from happening?</p>
<pre class="lang-py prettyprint-override"><code>self.output = QTextBrowser(readOnly=True)
self.output.setStyleSheet("background-color: black;color:white")
self.OutputSb = self.output.verticalScrollBar()
self.OutputSb.setValue(self.TestOutputSb.maximum())




def message(self, s):
self.output.insertPlainText(s)

self.TestOutputSb.setValue(self.TestOutputSb.maximum())
</code></pre>
<p>It should show the read-only text and I should be able to select, copy and paste it without altering it.</p>
 

Latest posts

M
Replies
0
Views
1
MOHAMED AMIIN ABDI AADAN
M
Top