Results 1 to 2 of 2

Thread: Show a tooltip on a line edit with NoFocus

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2017
    Posts
    51
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Show a tooltip on a line edit with NoFocus

    Some line edits in my UI have a FocusPolicy set to NoFocus by code at various times to prevent data from being entered. When a user clicks on a NoFocus line edit (to try to key in data), I would like to show a QToolTip explaining why the user cannot enter data. I thought about using mousePressEvent, but am unsure if it would work (because of the NoFocus issue) but even if it would work, am unsure how to code linking the line edit to the function that shows the tool tip.

    My attempt to link the line edit to the tooltip function (it does not work):

    Qt Code:
    1. self.ui.xyz.mousePressEvent(QMouseEvent=self.check_reminder_tooltips)
    To copy to clipboard, switch view to plain text mode 

    Is this the way to solve my issue, and if so, what is the correct code? If a tooltip will not work under any circumstance, an alternative would be link to a QMessageBox

  2. #2
    Join Date
    Jan 2017
    Posts
    51
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Show a tooltip on a line edit with NoFocus

    SOLVED: Per the advice of an expert, instead of changing the FocusPolicy of the line edit to NoFocus, I used lineEdit.setReadOnly(True), and it works.

Similar Threads

  1. Replies: 1
    Last Post: 24th September 2015, 22:16
  2. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 20:06
  3. Replies: 3
    Last Post: 26th August 2010, 09:57
  4. How to show my toolTip in QTreeWidget?
    By cspp in forum Qt Programming
    Replies: 2
    Last Post: 14th May 2009, 13:09
  5. Replies: 8
    Last Post: 15th May 2007, 10:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.