dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_item_data (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args.This ());
      if (item) {

         if (Args.Length ()) {

            int col = v8_to_uint32 (Args[0]);

            if (Args.Length () > 1) {

               QVariant variant = self->_qvariant_wrap_v8 (Args[1]);
               item->setData (col, Qt::UserRole, variant);
            }
            result = self->_qvariant_unwrap_v8 (item->data (col, Qt::UserRole));
         }
      }
   }

   return scope.Close (result);
}
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::_tree_item_add (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args.This ());
      if (item) {

         if (Args.Length ()) {

            QTreeWidgetItem *child = 0;
            if (Args[0]->IsArray ()) {

               QStringList list;
               V8Array array = v8_to_array (Args[0]);
               const int Length = array->Length ();
               for (int ix = 0; ix < Length; ++ix) {

                  V8Value value = array->Get (v8::Integer::New (ix));
                  list << v8_to_qstring (value);
               }
               child = new QTreeWidgetItem (item, list);
            }
            else {

               QTreeWidgetItem *prev = self->_to_qtreewidgetitem (Args[0]);
               if (prev) {

                  child = new QTreeWidgetItem (item, prev);
               }
               else {

                  child = new QTreeWidgetItem (item);
               }
            }

            if ((Args.Length () > 2) && child) {

               QVariant variant = self->_qvariant_wrap_v8 (Args[1]);
               int col = v8_to_uint32 (Args[2]);
               child->setData (col, Qt::UserRole, variant);
            }

            if (child) {

               result = self->create_v8_qtreewidgetitem (child);
            }
         }
      }
   }

   return scope.Close (result);
}