Focus on QLabel twitches text

  • Whenever there's focus on a QLabel, the text inside twitches a little to the bottom. Take a look at this picture:
    Here every digit is a separate QLabel.
    Notice that the first digit on the left is twitched a little to the bottom because it has focus. Also when I move focus to another digit, then the 1st digit is still twitched, and the newly focused digit gets twitched as well.

    Why is this happening? Can I disable this?


  • Moderators

    Operating system?
    Qt version?
    Using stylesheets or anything?
    Any interaction with the widget's QStyle?

  • Operating system: Ubuntu 14.04
    Qt 5.5.1
    Was using the following stylesheet:

                 "outline: 0;"
                 "background-color: #" BACKGROUND  "; "
                 "color: #"            FOREGROUND  "; "
             "} "

    But seems that the issue happens with and without it.

    Nothing with the widget's QStyle

  • Moderators

    Did you build Qt yourself?
    have you changed anything regarding HARFBUZZ?

  • @raven-worx I did not build Qt myself. I downloaded QtCreator and Qt libraries.
    I don't know what HARFBUZZ is so I guess I didn't change it.

    I don't think this has something to do with the compilation...

    I think it's either Ubuntu's default, or something in my code.
    I can try to change the QLabel to something else (say QTextEdit) and see what happens.

  • Does it still twitch if you don't use the stylesheet?

  • @elveatles Yes. As I said: seems that the issue happens with and without it.

  • Moderators

    @AlaaM said:

    I don't know what HARFBUZZ is so I guess I didn't change it.

    HARFBUZZ is used for text rendering in Qt.
    But i do not know if on Ubuntu (or in general in Linux) the system lib is used or the built-in version of Qt is used by default.

    Maybe someone else can confirm/disprove this?

    But updating the harfbuzz lib on your system is worth a shot i guess.

  • I can't believe I didn't think of this before. Here's the solution:

                                         "padding: 0px"

    (or any other number for padding)

    This disables the twitching.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.