* setItemDelegate does not free the old delegate. So we better only create one instance and reuse that.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23172 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-02-24 00:49:57 +00:00
parent 14b7f34818
commit b313333c1a
2 changed files with 6 additions and 2 deletions

View File

@ -170,7 +170,8 @@ GuiCompleter::GuiCompleter(GuiWorkArea * gui, QObject * parent)
listView->setIndentation(0); listView->setIndentation(0);
setPopup(listView); setPopup(listView);
popup()->setItemDelegateForColumn(1, new PixmapItemDelegate(this)); popup()->setItemDelegateForColumn(1, new PixmapItemDelegate(this));
rtlItemDelegate_ = new RtlItemDelegate(this);
// create timeout timers // create timeout timers
popup_timer_.setSingleShot(true); popup_timer_.setSingleShot(true);
inline_timer_.setSingleShot(true); inline_timer_.setSingleShot(true);
@ -410,7 +411,7 @@ void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate
// turn the direction of the strings in the popup. // turn the direction of the strings in the popup.
// Qt does not do that itself. // Qt does not do that itself.
popup()->setItemDelegateForColumn(0, rtl ? new RtlItemDelegate : 0); popup()->setItemDelegateForColumn(0, rtl ? rtlItemDelegate_ : 0);
// set new model // set new model
Inset::CompletionList const * list Inset::CompletionList const * list

View File

@ -31,6 +31,7 @@ class Buffer;
namespace frontend { namespace frontend {
class GuiWorkArea; class GuiWorkArea;
class RtlItemDelegate;
class GuiCompleter : private QCompleter class GuiCompleter : private QCompleter
{ {
@ -113,6 +114,8 @@ private:
/// operations like backspace. Hence, we have to keep this flag /// operations like backspace. Hence, we have to keep this flag
/// in addition to know whether the popup is to be kept visible. /// in addition to know whether the popup is to be kept visible.
bool inlineVisible_; bool inlineVisible_;
///
RtlItemDelegate * rtlItemDelegate_;
}; // GuiCompleter }; // GuiCompleter
} // namespace frontend } // namespace frontend