dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_add_item (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *lw = self->v8_to_qobject<QListWidget> (Args.This ()); if (lw) { if (Args.Length ()) { QString param = v8_to_qstring (Args[0]); QListWidgetItem *item = new QListWidgetItem (param, lw); if (Args.Length () >= 2) { QVariant variant = self->_qvariant_wrap_v8 (Args[1]); item->setData (Qt::UserRole, variant); } result = self->create_v8_qlistwidgetitem (item); } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_take_item (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *lw = self->v8_to_qobject<QListWidget> (Args.This ()); if (lw) { if (Args.Length ()) { QListWidgetItem *item = self->_to_qlistwidgetitem (Args[0]); if (item) { item = lw->takeItem (lw->row (item)); if (item) { result = self->create_v8_qlistwidgetitem (item); } } } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_find_items (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *table = self->v8_to_qobject<QListWidget> (Args.This ()); if (table) { if (Args.Length ()) { QString str (v8_to_qstring (Args[0])); Qt::MatchFlags flag = Qt::MatchExactly; if (Args.Length () > 1) { flag = (Qt::MatchFlags)v8_to_uint32 (Args[1]); } QList<QListWidgetItem *> items = table->findItems (str, flag); const int Length = items.count (); V8Array array = v8::Array::New (Length); for (int ix = 0; ix < Length; ++ix) { V8Value value = self->create_v8_qlistwidgetitem (items.at (ix)); array->Set (v8::Integer::New (ix), value); } result = array; } } } return scope.Close (result); }