I have a QToolTip on a QLineEdit that is set in the init. Within the text of tool tip are several variables.
The issue: It seems like the variables are not updated automatically when they are changed by the program.
For example, I hover the mouse over the line edit, and the tooltip and variable values are displayed. I the change something in the program that changes the variables, but when I go back and hover over the line edit again, the old variable values (instead of the new variable values) are displayed.
I can fix the issue by moving the setting of the tooltip from the init to a function and calling it (essentially running .setToolTip) each time ANYTHING is changed in the program. But this seems a little weird.
Here is the code to set the tooltip and variables (this is the code in the init):
self.ui.YourSSAmount.setToolTip(
'<span>Click Reports/Social Security to see your<br>SS income at each start age'
'<br><br>Your inf adj FRA amt at age {}: ${:,.0f}'
'<br>Age adjustment: {:.0f}%'
'<br>SS Income at age {}: ${:,.0f}</span>'.format(
self.generator.YouSSStartAge, self.generator.your_new_FRA_amt,
self.generator.SS66.get(self.generator.YouSSStartAge, 1.32) * 100, self.generator.YouSSStartAge,
self.generator.YourSSAmount))
self.ui.YourSSAmount.setToolTip(
'<span>Click Reports/Social Security to see your<br>SS income at each start age'
'<br><br>Your inf adj FRA amt at age {}: ${:,.0f}'
'<br>Age adjustment: {:.0f}%'
'<br>SS Income at age {}: ${:,.0f}</span>'.format(
self.generator.YouSSStartAge, self.generator.your_new_FRA_amt,
self.generator.SS66.get(self.generator.YouSSStartAge, 1.32) * 100, self.generator.YouSSStartAge,
self.generator.YourSSAmount))
To copy to clipboard, switch view to plain text mode
Do variables not update automatically in a QToolTip (variables update automatically when contained in a QMessageBox, for example)???
Bookmarks