#include "Buffer.h"
#include "BufferView.h"
+#include "CompletionList.h"
#include "Cursor.h"
#include "Dimension.h"
#include "FuncRequest.h"
#include "Paragraph.h"
#include "version.h"
+#include "support/assert.h"
#include "support/debug.h"
#include <QApplication>
namespace lyx {
namespace frontend {
-class RtlItemDelegate : public QItemDelegate {
+class RtlItemDelegate : public QItemDelegate
+{
public:
- explicit RtlItemDelegate(QObject * parent = 0)
- : QItemDelegate(parent), enabled_(false) {}
+ explicit RtlItemDelegate(QObject * parent)
+ : QItemDelegate(parent), enabled_(false)
+ {}
void setEnabled(bool enabled = true)
{
}
protected:
- virtual void drawDisplay(QPainter * painter,
+ void drawDisplay(QPainter * painter,
QStyleOptionViewItem const & option,
QRect const & rect, QString const & text) const
{
};
-class PixmapItemDelegate : public QItemDelegate {
+class PixmapItemDelegate : public QItemDelegate
+{
public:
- explicit PixmapItemDelegate(QObject *parent = 0)
- : QItemDelegate(parent) {}
+ explicit PixmapItemDelegate(QObject * parent)
+ : QItemDelegate(parent)
+ {}
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option,
};
-class GuiCompletionModel : public QAbstractListModel {
+class GuiCompletionModel : public QAbstractListModel
+{
public:
///
- GuiCompletionModel(QObject * parent,
- Inset::CompletionList const * l)
- : QAbstractListModel(parent), list_(l) {}
+ GuiCompletionModel(QObject * parent, CompletionList const * l)
+ : QAbstractListModel(parent), list_(l)
+ {}
///
- ~GuiCompletionModel()
- { delete list_; }
+ ~GuiCompletionModel() { delete list_; }
///
bool sorted() const
{
if (list_)
return list_->sorted();
- else
- return false;
+ return false;
}
///
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const
if (index.column() == 0)
return toqstr(list_->data(index.row()));
- else if (index.column() == 1) {
+
+ if (index.column() == 1) {
// get icon from cache
QPixmap scaled;
QString const name = ":" + toqstr(list_->icon(index.row()));
}
private:
- ///
- Inset::CompletionList const * list_;
+ /// owned by us
+ CompletionList const * list_;
};
rtlItemDelegate_->setEnabled(rtl);
// set new model
- Inset::CompletionList const * list = cur.inset().createCompletionList(cur);
+ CompletionList const * list = cur.inset().createCompletionList(cur);
setModel(new GuiCompletionModel(this, list));
modelActive_ = true;
if (list->sorted())
}
-void GuiCompleter::hidePopup(Cursor & cur)
+void GuiCompleter::hidePopup(Cursor &)
{
popupVisible_ = false;
// Trigger asynchronous part of hideInline. We might be
// in a dispatcher here and the setModel call might
// trigger focus events which is are not healthy here.
- QTimer::singleShot(0, this, SLOT(asyncHideModel()));
+ QTimer::singleShot(0, this, SLOT(asyncHideInline()));
// mark that the asynchronous part will reset the model
if (!popupVisible())
i = n;
else
i = l;
- BOOST_ASSERT(0 <= i && i <= n);
+ LASSERT(i <= n, /**/);
}
// select the first if none was found