Commit 1a03828b authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Limit number of factor levels to show in popup.

I was a bit too fast in calling that bug fixed, but now it should be:

BUG: 400755
parent 36ebec18
......@@ -2,7 +2,7 @@
celleditor - description
-------------------
begin : Mon Sep 13 2004
copyright : (C) 2004, 2007 by Thomas Friedrichsmeier
copyright : (C) 2004-2018 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier@kdemail.net
***************************************************************************/
......@@ -21,6 +21,8 @@
#include <QEvent>
#include <QKeyEvent>
#include <KLocalizedString>
#include "../debug.h"
CellEditor::CellEditor (QWidget* parent) : QLineEdit (parent) {
......@@ -47,9 +49,15 @@ void CellEditor::setValueLabels (const RObject::ValueLabels& labels) {
value_list->setFocusProxy (this);
value_list->installEventFilter (this); // somehow setting us as a focus proxy is not enough to continue to receive the key-presses
const int limit = 64;
int i = 0;
for (RObject::ValueLabels::const_iterator it = labels.constBegin (); it != labels.constEnd (); ++it) {
if (++i >= limit) break;
value_list->addAction (it.key () + ": " + it.value ())->setData (it.key ());
}
if (i >= limit) {
value_list->addAction (i18n ("[Omitted %1 more factor levels]", labels.size () - limit))->setEnabled (false);
}
connect (value_list, &QMenu::triggered, this, &CellEditor::selectedFromList);
QTimer::singleShot (200, this, SLOT (showValueLabels()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment