Fix crash while InsetInfo hovering by replacing the hover message with a tooltip.

Note to all: NEVER send a message inside a draw() method! This triggers a recursive painting of the status bar with Qt4.4 !



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-06-04 07:15:43 +00:00
parent 9d469100d0
commit 4f2a7a953b
2 changed files with 11 additions and 7 deletions

View File

@ -62,16 +62,18 @@ Inset * InsetInfo::editXY(Cursor &, int, int)
void InsetInfo::draw(PainterInfo & pi, int x, int y) const void InsetInfo::draw(PainterInfo & pi, int x, int y) const
{ {
InsetText::draw(pi, x, y); InsetText::draw(pi, x, y);
if (mouse_hover_) {
odocstringstream os;
os << _("Information regarding ")
<<_(nameTranslator().find(type_))
<< " " << from_utf8(name_);
pi.base.bv->message(os.str());
}
} }
docstring InsetInfo::toolTip(BufferView const & bv, int x, int y) const
{
odocstringstream os;
os << _("Information regarding ")
<< _(nameTranslator().find(type_))
<< " " << from_utf8(name_);
return os.str();
}
namespace { namespace {
Translator<InsetInfo::info_type, string> const initTranslator() Translator<InsetInfo::info_type, string> const initTranslator()

View File

@ -106,6 +106,8 @@ public:
void updateInfo(); void updateInfo();
/// ///
bool setMouseHover(bool mouse_hover); bool setMouseHover(bool mouse_hover);
///
docstring toolTip(BufferView const & bv, int x, int y) const;
private: private:
/// The translator between the information type enum and corresponding string. /// The translator between the information type enum and corresponding string.