* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Jürgen Spitzmüller
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "Cursor.h"
#include "Encoding.h"
#include "FuncRequest.h"
#include <QListWidgetItem>
#include <QString>
+#include <cstdio>
+
using namespace std;
namespace lyx {
void setSymbols(QList<char_type> const & symbols)
{
+ QAbstractItemModel::beginResetModel();
symbols_ = symbols;
- QAbstractItemModel::reset();
+ QAbstractItemModel::endResetModel();
}
private:
setFocusProxy(symbolsLW);
symbolsLW->setViewMode(QListView::IconMode);
- symbolsLW->setUniformItemSizes(true);
// increase the display size of the symbols a bit
QFont font= symbolsLW->font();
int size = font.pointSize() + 3;
font.setPointSize(size);
symbolsLW->setFont(font);
+ QFontMetrics fm(font);
+ symbolsLW->setGridSize(QSize(fm.maxWidth() + 2, fm.height() + 2));
symbolsLW->setModel(model_);
}
void GuiSymbols::scrollToItem(QString const & category)
{
- if (used_blocks.find(category) != used_blocks.end()) {
- int row = used_blocks[category];
- QModelIndex index = symbolsLW->model()->index(row, 0, QModelIndex());
- symbolsLW->scrollTo(index, QAbstractItemView::PositionAtTop);
- }
+ if (used_blocks.find(category) == used_blocks.end())
+ return;
+ int row = used_blocks[category];
+ QModelIndex index = symbolsLW->model()->index(row, 0, QModelIndex());
+ symbolsLW->scrollTo(index, QAbstractItemView::PositionAtTop);
}
+
void GuiSymbols::updateSymbolList(bool update_combo)
{
QString category = categoryCO->currentText();
char_type c = *it;
if (!update_combo && !show_all && (c <= range_start || c >= range_end))
continue;
-#if QT_VERSION >= 0x040300
QChar::Category const cat = QChar::category(uint(c));
-#else
- QChar const qc = uint(c);
- QChar::Category const cat = qc.category();
-#endif
// we do not want control or space characters
if (cat == QChar::Other_Control || cat == QChar::Separator_Space)
continue;
++numItem;
- if (show_all || c >= range_start && c <= range_end)
+ if (show_all || (c >= range_start && c <= range_end))
s.append(c);
if (update_combo) {
QString block = getBlock(c);
} // namespace frontend
} // namespace lyx
-#include "GuiSymbols_moc.cpp"
+#include "moc_GuiSymbols.cpp"