mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
* fix assert with 4.2.x when setting a null item delegate on an item view.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23414 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
45520d7ced
commit
7406991fd4
@ -46,16 +46,27 @@ public:
|
||||
explicit RtlItemDelegate(QObject * parent = 0)
|
||||
: QItemDelegate(parent) {}
|
||||
|
||||
void setEnabled(bool enabled = true)
|
||||
{
|
||||
enabled_ = enabled;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void drawDisplay(QPainter * painter,
|
||||
QStyleOptionViewItem const & option,
|
||||
QRect const & rect, QString const & text) const
|
||||
{
|
||||
if (!enabled_)
|
||||
return QItemDelegate::drawDisplay(painter, option, rect, text);
|
||||
|
||||
// FIXME: do this more elegantly
|
||||
docstring stltext = qstring_to_ucs4(text);
|
||||
reverse(stltext.begin(), stltext.end());
|
||||
QItemDelegate::drawDisplay(painter, option, rect, toqstr(stltext));
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled_;
|
||||
};
|
||||
|
||||
|
||||
@ -179,6 +190,7 @@ GuiCompleter::GuiCompleter(GuiWorkArea * gui, QObject * parent)
|
||||
setPopup(listView);
|
||||
popup()->setItemDelegateForColumn(1, new PixmapItemDelegate(this));
|
||||
rtlItemDelegate_ = new RtlItemDelegate(this);
|
||||
popup()->setItemDelegateForColumn(0, rtlItemDelegate_);
|
||||
|
||||
// create timeout timers
|
||||
popup_timer_.setSingleShot(true);
|
||||
@ -437,7 +449,7 @@ void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate
|
||||
|
||||
// turn the direction of the strings in the popup.
|
||||
// Qt does not do that itself.
|
||||
popup()->setItemDelegateForColumn(0, rtl ? rtlItemDelegate_ : 0);
|
||||
rtlItemDelegate_->setEnabled(rtl);
|
||||
|
||||
// set new model
|
||||
Inset::CompletionList const * list = cur.inset().createCompletionList(cur);
|
||||
|
Loading…
Reference in New Issue
Block a user