23 #if defined (HAVE_CONFIG_H) 27 #include <QListWidget> 29 #include <QMouseEvent> 42 int lc =
list->count ();
44 list->clearSelection ();
50 if (1 <= idx && idx <= lc)
52 list->item (idx-1)->setSelected (
true);
53 list->scrollToItem (
list->item (idx-1));
55 &&
list->selectionMode () == QAbstractItemView::SingleSelection)
61 list->clearSelection ();
89 if ((up.get_max () - up.get_min ()) > 1)
90 list->setSelectionMode (QAbstractItemView::ExtendedSelection);
92 list->setSelectionMode (QAbstractItemView::SingleSelection);
94 if (
value.numel () > 0)
97 int lc =
list->count ();
103 if (1 <= idx && idx <= lc)
105 list->item (idx-1)->setSelected (
true);
106 list->scrollToItem (
list->item (idx-1));
107 if (
i == 0 && (
list->selectionMode ()
108 == QAbstractItemView::SingleSelection))
114 list->viewport ()->installEventFilter (
this);
118 connect (
list, SIGNAL (activated (
const QModelIndex &)),
131 QListWidget *
list = qWidget<QListWidget> ();
135 case uicontrol::properties::ID_STRING:
143 case uicontrol::properties::ID_MIN:
145 case uicontrol::properties::ID_MAX:
146 if ((up.get_max () - up.get_min ()) > 1)
147 list->setSelectionMode (QAbstractItemView::ExtendedSelection);
149 list->setSelectionMode (QAbstractItemView::SingleSelection);
152 case uicontrol::properties::ID_VALUE:
169 QListWidget *
list = qWidget<QListWidget> ();
171 QModelIndexList l =
list->selectionModel ()->selectedIndexes ();
175 foreach (
const QModelIndex& idx, l)
176 value(
i++) = idx.row () + 1;
211 case QEvent::KeyRelease:
221 return Object::eventFilter (watched,
e);
226 bool override_return =
false;
227 QListWidget *
list = qWidget<QListWidget> ();
231 case QEvent::MouseButtonPress:
233 QMouseEvent *m =
dynamic_cast<QMouseEvent *
> (
e);
235 if (m->button () & Qt::RightButton)
236 override_return =
true;
239 if (!
list->indexAt (m->pos ()).isValid ())
240 override_return =
true;
245 case QEvent::MouseButtonRelease:
247 QMouseEvent *m =
dynamic_cast<QMouseEvent *
> (
e);
249 if (m->button () & Qt::RightButton)
250 override_return =
true;
252 else if (!
list->indexAt (m->pos ()).isValid ())
254 list->setCurrentRow (
list->count () - 1);
255 override_return =
true;
static void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
void itemSelectionChanged(void)
bool eventFilter(QObject *watched, QEvent *e)
static Object * parentObject(const graphics_object &go)
ListBoxControl(const graphics_object &go, QListWidget *list)
QStringList fromStringVector(const string_vector &v)
virtual Container * innerContainer(void)=0
void itemActivated(const QModelIndex &)
void sendSelectionChange()
static ListBoxControl * create(const graphics_object &go)
bool eventFilter(QObject *watched, QEvent *e)
void itemPressed(QListWidgetItem *)
Vector representing the dimensions (size) of an Array.
static void updateSelection(QListWidget *list, const Matrix &value)
nd group nd example For each display the value
static void post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)