Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved QTooltip on readOnly widget

    General and Desktop
    2
    6
    148
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bday1223 last edited by

      Hello,

      I'm trying to add tooltips to a set of QLineEdit widgets that have been set to readOnly. These widgets are used for display purposes only, and only show a short cryptic mnemonic of an event. I'd like to add tooltips to these to show a more useful description of the abbreviated mnemonics, but it looks like the tooltips only show up if the QLineEdit widgets are not set as readOnly. (I'm using Qt 5.5).

      I'm also hoping to be able to set these exclusively from Qt Designer.

      Any help would be greatly appreciated. Thanks!

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by mrjj

        Hi
        I just tried in Qt 5.13.1 on windows 10
        with readonly QLineEdit and it still shows the tooltip
        even when read only.

        alt text

        Also setting enabled to false, it still shows
        alt text

        So might be a bug in Qt 5.5 or it was simply changed later on.

        Is there a reason you use 5.5 ?

        B 1 Reply Last reply Reply Quote 2
        • B
          bday1223 @mrjj last edited by

          @mrjj Yeah, I've got a suite of legacy applications, some of which use the old QWebkit, so I've been hesitant to upgrade/port to a newer version. This is for a bunch of Windows desktop applications built with mingw. Thanks.

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @bday1223 last edited by

            @bday1223
            Ok so the "revived" version
            https://forum.qt.io/topic/76739/webkit-status-2017
            is not an option I guess.
            That said the old webkit is a safety concern if the app is not purely internal.

            I dont have 5.5 to test with but i wonder if you can install an event filter and
            check for the QEvent::ToolTip and show it manually
            like seen in
            https://doc.qt.io/qt-5/qtwidgets-widgets-tooltips-example.html

            B 1 Reply Last reply Reply Quote 0
            • B
              bday1223 @mrjj last edited by

              @mrjj OK, never mind... I don't know what I've done, but it seems as though the tooltips are working, without any apparent mods to the code.

              Thanks for your time, though!

              1 Reply Last reply Reply Quote 1
              • mrjj
                mrjj Lifetime Qt Champion last edited by mrjj

                Hi
                Yeah it does seem so.
                I installed 5.5 and to my surprise the same sample did still show tooltip :)

                Please mark as solved then :)

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post