Note that there are some explanatory texts on larger screens.

plurals
  1. POcursor gone in PyQT
    text
    copied!<p>I have a window containing multiple <code>QRowWidget</code>s, which are custom widgets defined by me. These <code>QRowWidget</code>s contain <code>QLineEdit</code>s and other standard widgets. To show or hide certain parts of a <code>QRowWidget</code>, I overdefined the <code>focusInEvent()</code> methodes of all the widgets within it. It works perfectly, when I click on the <code>QRowWidget</code>, the hidden elements appear.</p> <p>The weird thing is that the blinking cursor line hovewer doesn't appear in the <code>QLineEdit</code>s within the custom widgets. I can select them both by a mouse click or with Tab, and a glow effect indicates that the <code>QLineEdit</code> is selected in it, I can select a text in it, or start typing at any location wherever I clicked, but the cursor never appears and it's quite annoying.</p> <p>My 1st thought was that it is a bug on Mac, but I have the same experience on SuSe Linux. </p> <p>I'm using python 2.7 and PyQt4.</p> <p>This is in the <code>__init__()</code> of the <code>QRowWidget</code>:</p> <pre><code> for i in self.findChildren(QWidget): i.focusInEvent = self.focusInEvent </code></pre> <p>And then this is the own <code>focusInEvent()</code>:</p> <pre><code>def focusInEvent(self, event): if self.pself.focusedLine: self.pself.focusedLine.setStyleSheet("color: #666;") self.pself.focusedLine.desc.hide() self.pself.focusedLine.closebutton.hide() self.setStyleSheet("color: #000;") self.desc.show() self.closebutton.show() self.pself.focusedLine = self </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload