python - Selection of text in QTextBrowser -


I have QTextBrowser and when I select a part of the text, I need a status Selection and the end of the beginning. I do this with MousePressEvent and mouseReleaseEvent and it works, but the highlight selection (dark blue) is not visible. Why? So I can not see what I have chosen.

I tried with the signal selectionChanged but the problem is that whenever I select I select the text and when I release the mouse and the end of the selection.

Any suggestions?

Thank you!

Edit:

I like this work:

  class MyBrowser (QTextBrowser): def __init __ (self, parent = none , textableAnnotate = none): Super (MyBrowser, self) .__ init __ (parent) self.textableAnnotate = textableAnnotate self.mousepress = 0 Self.mouserelease = 0 def mousePressEvent (self, mouseEvent): self.mousepress = self.cursorForPosition (MouseEvent.pos ()) Status () DEF mouseReleaseEvent (auto, mouseewent): self.mouseRelease = self.cursorForPosition (mouseEvent.pos ()). Status ()   

I need the status of the click here: myself. Mousepress and myself. Moussurellis. But when I select the text in my QTextBrowser, the highlight does not appear. I hope I am more clear ...

edit 2:

or this:

  self.browserInput.selectionChanged.connect ( self.jpg) Def position (self): start = self.browserInput.textCursor (). SelectionStart () end = self.browserInput.textCursor (). SelectionEnd ()  

You have to pass the incident to the normal handler, because you have normal behavior Has changed the following line at the end of the appropriate event handler:

  QTextBrowser.mousePressEvent (auto, mouse Event) QTextBrowser.mouseReleaseEvent (auto, mouseewart)    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -