Hm. I am not aware of how to change the way attachment are sent. I use thunderbird and when add an
attachment is not displayed inline. So i just try it again like i did before.
berhard
PS: As far as i remember this problem was discussed in the list some month ago, but i can't remember
the solution nor can i find the thread.
Stefan Schimanski schrieb:
Hi!
Sorry for being unresponsive at the moment. Could you send the patch as
a file attachment? Something between your and my mail program likes to
corrupt the patch if it is sent as plain text in the mail.
Stefan
Am 28.05.2008 um 21:08 schrieb Bernhard Roider:
Hello all,
as Stefan seems to be not available since a few weeks: could somebody
test this patch with newer qt versions (4.3, 4.4)? I have no
capacities to upgrade my version atm.
thanks
Bernhard
Bernhard Roider schrieb:
Hello Stefan,
today i finally found some time to investigate the problem we
discussed at the beginning of march concerning the completion list:
rtl text does not work and icons are not displayed for math symbols.
Here is a patch that solves that issue for me using qt 4.2.3. There
are two things that caused the problem:
1. QCompleter::setModel() changed the item delegates internally, so
the specialized ones vanished
2. item delegates for columns are not used --> qt bug?
The attached patch solves both issues so that it works with my qt
version. It should be tested for newer versions of qt.
Another issue: Here the destructor ~CompleterItemDelegate is never
called. Do we have to delete it manually?
bernhard
Index: src/frontends/qt4/GuiCompleter.cpp
===================================================================
--- src/frontends/qt4/GuiCompleter.cpp (revision 24807)
+++ src/frontends/qt4/GuiCompleter.cpp (working copy)
@@ -43,13 +43,16 @@
namespace lyx {
namespace frontend {
-class RtlItemDelegate : public QItemDelegate
+class CompleterItemDelegate : public QItemDelegate
{
public:
- explicit RtlItemDelegate(QObject * parent)
+ explicit CompleterItemDelegate(QObject * parent)
: QItemDelegate(parent), enabled_(false)
{}
+ ~CompleterItemDelegate()
+ {}
+
void setEnabled(bool enabled = true)
{
enabled_ = enabled;
@@ -70,23 +73,14 @@
reverse(stltext.begin(), stltext.end());
QItemDelegate::drawDisplay(painter, option, rect,
toqstr(stltext));
}
-
-private:
- bool enabled_;
-};
-
-class PixmapItemDelegate : public QItemDelegate
-{
-public:
- explicit PixmapItemDelegate(QObject * parent)
- : QItemDelegate(parent)
- {}
-
-protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
+ if (index.column() == 0) {
+ QItemDelegate::paint(painter, option, index);
+ return;
+ }
QStyleOptionViewItem opt = setOptions(index, option);
QVariant value = index.data(Qt::DisplayRole);
QPixmap pixmap = qvariant_cast<QPixmap>(value);
@@ -103,9 +97,11 @@
drawFocus(painter, opt, option.rect);
painter->restore();
}
+
+private:
+ bool enabled_;
};
-
class GuiCompletionModel : public QAbstractListModel
{
public:
@@ -116,6 +112,12 @@
///
~GuiCompletionModel() { delete list_; }
///
+ void setList(CompletionList const * l) {
+ delete list_;
+ list_ = l;
+ reset();
+ }
+ ///
bool sorted() const
{
if (list_)
@@ -183,7 +185,8 @@
modelActive_(false)
{
// Setup the completion popup
- setModel(new GuiCompletionModel(this, 0));
+ model_ = new GuiCompletionModel(this, 0);
+ setModel(model_);
setCompletionMode(QCompleter::PopupCompletion);
setWidget(gui_);
@@ -198,9 +201,8 @@
listView->setUniformRowHeights(true);
setPopup(listView);
- rtlItemDelegate_ = new RtlItemDelegate(this);
- popup()->setItemDelegateForColumn(0, rtlItemDelegate_);
- popup()->setItemDelegateForColumn(1, new PixmapItemDelegate(this));
+ itemDelegate_ = new CompleterItemDelegate(this);
+ popup()->setItemDelegate(itemDelegate_);
// create timeout timers
popup_timer_.setSingleShot(true);
@@ -484,11 +486,11 @@
// turn the direction of the strings in the popup.
// Qt does not do that itself.
- rtlItemDelegate_->setEnabled(rtl);
+ itemDelegate_->setEnabled(rtl);
// set new model
CompletionList const * list = cur.inset().createCompletionList(cur);
- setModel(new GuiCompletionModel(this, list));
+ model_->setList(list);
modelActive_ = true;
if (list->sorted())
setModelSorting(QCompleter::CaseSensitivelySortedModel);
@@ -556,7 +558,7 @@
{
popup()->hide();
if (!inlineVisible())
- setModel(new GuiCompletionModel(this, 0));
+ model_->setList(0);
}
@@ -591,7 +593,7 @@
void GuiCompleter::asyncHideInline()
{
if (!popupVisible())
- setModel(new GuiCompletionModel(this, 0));
+ model_->setList(0);
}
Index: src/frontends/qt4/GuiCompleter.h
===================================================================
--- src/frontends/qt4/GuiCompleter.h (revision 24807)
+++ src/frontends/qt4/GuiCompleter.h (working copy)
@@ -31,7 +31,8 @@
namespace frontend {
class GuiWorkArea;
-class RtlItemDelegate;
+class CompleterItemDelegate;
+class GuiCompletionModel;
class GuiCompleter : private QCompleter
{
@@ -139,7 +140,9 @@
/// a coming reset here by setting it to false.
bool modelActive_;
///
- RtlItemDelegate * rtlItemDelegate_;
+ CompleterItemDelegate * itemDelegate_;
+ ///
+ GuiCompletionModel * model_;
}; // GuiCompleter
} // namespace frontend