00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <QMessageBox>
00023 #include <QMenu>
00024 #include <QKeyEvent>
00025 #include <QEvent>
00026 #include <QComboBox>
00027 #include <QAbstractItemView>
00028
00029 #include "subform2bf.h"
00030 #include "funcaux.h"
00031 #include "articulolist.h"
00032 #include "busquedaarticulo.h"
00033 #include "busquedatipoiva.h"
00034 #include "qtexteditdelegate.h"
00035 #include "busquedatrabajador.h"
00036 #include "busquedaalmacen.h"
00037 #include "plugins.h"
00038
00039
00041
00044 SubForm2Bf::SubForm2Bf(QWidget *parent) : SubForm3(parent) {
00045 _depura("SubForm2Bf::SubForm2Bf", 0);
00046 setDelete(TRUE);
00047 m_delegate = new QSubForm2BfDelegate(this);
00048 mui_list->setItemDelegate(m_delegate);
00049 mdb_idcliente = "";
00050 _depura("END SubForm2Bf::SubForm2Bf", 0);
00051 }
00052
00053
00055
00057 SubForm2Bf::~SubForm2Bf() {
00058 _depura("SubForm2Bf::~SubForm2Bf", 0);
00059 delete m_delegate;
00060 _depura("END SubForm2Bf::~SubForm2Bf", 0);
00061 }
00062
00063
00065
00068 void SubForm2Bf::cargar(QString query) {
00069 _depura("SubForm2Bf::cargar", 0);
00070 SubForm3::cargar(query);
00071 _depura("END SubForm2Bf::cargar", 0);
00072 }
00073
00074
00076
00081 void SubForm2Bf::on_mui_list_pressedAsterisk(int row, int col) {
00082 _depura("SubForm2Bf::pressedAsterisk", 0);
00083
00084 SDBRecord *rec = lineaat(row);
00085 SDBCampo *camp = (SDBCampo *) item(row, col);
00086
00087 if (camp->nomcampo() != "codigocompletoarticulo") {
00088 return;
00089 }
00090
00091 m_procesacambios = FALSE;
00092
00093 ArticuloList *artlist = new ArticuloList((Company *) empresaBase(), NULL, 0, ArticuloList::SelectMode);
00095 this->setEnabled(false);
00096 artlist->show();
00097 while (!artlist->isHidden())
00098 theApp->processEvents();
00099 this->setEnabled(true);
00100 QString idArticle = artlist->idarticulo();
00101 delete artlist;
00102
00104 if ( idArticle == "") {
00105 m_procesacambios = TRUE;
00106 return;
00107 }
00108
00109 cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + idArticle);
00110 if (!cur->eof()) {
00111 rec->setDBvalue("idarticulo", idArticle);
00112 rec->setDBvalue("codigocompletoarticulo", cur->valor("codigocompletoarticulo"));
00113 rec->setDBvalue("nomarticulo", cur->valor("nomarticulo"));
00114 }
00115 delete cur;
00116 m_procesacambios = TRUE;
00118 on_mui_list_cellChanged(row, col);
00119 _depura("END SubForm2Bf::pressedAsterisk", 0);
00120 }
00121
00122
00124
00128 void SubForm2Bf::on_mui_list_pressedSlash(int row, int col) {
00129 _depura("SubForm2Bf::pressedSlash", 0);
00130 SDBCampo *camp = (SDBCampo *) item(row, col);
00131 QString text = editaTexto(camp->text());
00132 camp->set(text);
00133 _depura("END SubForm2Bf::pressedSlash", 0);
00134 }
00135
00136
00138
00142 void SubForm2Bf::on_mui_list_pressedMinus(int row, int col) {
00143 _depura("SubForm2Bf::pressedMinus", 0);
00144
00145 SDBRecord *rec = lineaat(row);
00146 SDBCampo *camp = (SDBCampo *) item(row, col);
00147 cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + rec->DBvalue("idarticulo"));
00148 if (!cur->eof()) {
00149 rec->setDBvalue(camp->nomcampo(), cur->valor("obserarticulo"));
00150 }
00151 delete cur;
00153 on_mui_list_cellChanged(row, col);
00154 _depura("END SubForm2Bf::pressedMinus", 0);
00155 }
00156
00157
00159
00164 void SubForm2Bf::on_mui_list_cellChanged(int row, int col) {
00165 _depura("SubForm2Bf::on_mui_list_cellChanged", 0, QString::number(row) + " " + QString::number(col));
00166
00167 if (!m_procesacambios) {
00168 _depura("SubForm2Bf::on_mui_list_cellChanged", 0, QString::number(row) + " " + QString::number(col)+" m_procesacambios es FALSE");
00169 return;
00170 }
00171 m_procesacambios = FALSE;
00172
00173 cursor2 *cur2 = NULL;
00174 cursor2 *cur = NULL;
00175 cursor2 *cur1 = NULL;
00176
00178 int res = g_plugins->lanza("SubForm2Bf_on_mui_list_editFinished", this);
00179 if (res != 0) {
00180 m_procesacambios = TRUE;
00181 return;
00182 }
00183
00184 SDBRecord *rec = lineaat(row);
00185 if (rec == NULL) {
00186 _depura ("SubForm2Bf::on_mui_list_cellChanged", 0, QString::number(row) + " " + QString::number(col) + "la linea no existe");
00187 m_procesacambios = TRUE;
00188 return;
00189 }
00190
00191 SDBCampo *camp = (SDBCampo *) item(row, col);
00192 camp->refresh();
00193
00195 if ( ! camp->cambiado() ) {
00196 _depura("SubForm2Bf::on_mui_list_cellChanged", 0, QString::number(row) + " " + QString::number(col) + camp->valorcampo() + "Sin cambios");
00197 SubForm3::on_mui_list_cellChanged(row, col);
00198 m_procesacambios = TRUE;
00199 return;
00200 }
00201
00202 if (camp->nomcampo() == "desctipo_iva") {
00203 cur = empresaBase()->cargacursor("SELECT * FROM tipo_iva WHERE desctipo_iva = '" + camp->text() + "'");
00204 if (!cur->eof()) {
00205 rec->setDBvalue("idtipo_iva", cur->valor("idtipo_iva"));
00206 }
00207 }
00208
00209 if (camp->nomcampo() == "nomtrabajador") {
00210 cur = empresaBase()->cargacursor("SELECT * FROM trabajador WHERE apellidostrabajador ||', '||nomtrabajador = '" + camp->text() + "'");
00211 if (!cur->eof()) {
00212 rec->setDBvalue("idtrabajador", cur->valor("idtrabajador"));
00213 }
00214 }
00215
00216 if (camp->nomcampo() == "nomalmacen") {
00217 cur = empresaBase()->cargacursor("SELECT * FROM almacen WHERE nomalmacen ||', '||codigoalmacen = '" + camp->text() + "'");
00218 if (!cur->eof()) {
00219 rec->setDBvalue("idalmacen", cur->valor("idalmacen"));
00220 }
00221 }
00222
00223 if (camp->nomcampo() == "codigocompletoarticulo") {
00224 cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE codigocompletoarticulo = '" + camp->text() + "'");
00225 if (!cur->eof()) {
00226 rec->setDBvalue("idarticulo", cur->valor("idarticulo"));
00227 rec->setDBvalue("codigocompletoarticulo", cur->valor("codigocompletoarticulo"));
00228 rec->setDBvalue("nomarticulo", cur->valor("nomarticulo"));
00229 if (m_tablename == "lpresupuesto"
00230 || m_tablename == "lpedidoproveedor"
00231 || m_tablename == "lpedidocliente"
00232 || m_tablename == "lalbaranp"
00233 || m_tablename == "lfacturap"
00234 || m_tablename == "lalbaran"
00235 || m_tablename == "lfactura") {
00236 rec->setDBvalue("desc" + m_tablename, cur->valor("nomarticulo"));
00237 rec->setDBvalue("cant" + m_tablename, "1.00");
00238 rec->setDBvalue("descuento" + m_tablename, "0.00");
00239 rec->setDBvalue("pvp" + m_tablename, cur->valor("pvparticulo"));
00240 }
00241 } else {
00242 mensajeAviso(tr("Articulo inexistente"));
00243 delete cur;
00244 m_procesacambios = TRUE;
00245 return;
00246 }
00247
00248 cur1 = empresaBase()->cargacursor("SELECT * FROM tasa_iva WHERE idtipo_iva = " + cur->valor("idtipo_iva") + " ORDER BY fechatasa_iva LIMIT 1");
00249 if (!cur->eof() ) {
00250 if (m_tablename == "lpresupuesto"
00251 || m_tablename == "lpedidocliente"
00252 || m_tablename == "lpedidoproveedor"
00253 || m_tablename == "lalbaranp"
00254 || m_tablename == "lfacturap"
00255 || m_tablename == "lalbaran"
00256 || m_tablename == "lfactura") {
00257 rec->setDBvalue("iva" + m_tablename, cur1->valor("porcentasa_iva"));
00258
00260 if (mdb_idcliente != "") {
00261 cur2 = empresaBase()->cargacursor("SELECT recargoeqcliente FROM cliente WHERE idcliente = " + mdb_idcliente);
00262 if (!cur2->eof()) {
00263 if (cur2->valor("recargoeqcliente") == "t") {
00264 rec->setDBvalue("reqeq" + m_tablename, cur1->valor("porcentretasa_iva"));
00265 }
00266 }
00267 delete cur2;
00268 } else {
00269 rec->setDBvalue("reqeq" + m_tablename, "0");
00270 }
00271
00272 if (mdb_idproveedor != "") {
00273 cur2 = empresaBase()->cargacursor("SELECT recargoeqproveedor FROM proveedor WHERE idproveedor = " + mdb_idproveedor);
00274 if (!cur2->eof()) {
00275 if (cur2->valor("recargoeqproveedor") == "t") {
00276 rec->setDBvalue("reqeq" + m_tablename, cur1->valor("porcentretasa_iva"));
00277 }
00278 }
00279 delete cur2;
00280 } else {
00281 rec->setDBvalue("reqeq" + m_tablename, "0");
00282 }
00283
00284 }
00285 }
00286 if (cur1 != NULL)
00287 delete cur1;
00288 if (cur != NULL)
00289 delete cur;
00290 }
00291
00292 SubForm3::on_mui_list_cellChanged(row, col);
00293 m_procesacambios = TRUE;
00294
00295 _depura("END SubForm2Bf::on_mui_list_editFinished", 0);
00296 }
00297
00298
00300
00304 void SubForm2Bf::setIdCliente(QString id) {
00305 _depura("SubForm2Bf::setIdCliente", 0, id);
00306
00308 if (mdb_idcliente == "" ) {
00309 mdb_idcliente = id;
00310 return;
00311 }
00312
00314 if (mdb_idcliente == id) return;
00315
00317 for (int i = 0; i < rowCount() - 1; i++) {
00318 SDBRecord *rec = lineaat(i);
00319 rec->setDBvalue("iva" + m_tablename, "0");
00320 rec->setDBvalue("reqeq" + m_tablename, "0");
00321 }
00322
00323 mdb_idcliente = id;
00324
00326 if (id == "") {
00327 _depura("END SubForm2Bf::setIdCliente", 0, "idcliente invalido");
00328 return;
00329 }
00330
00331 cursor2 *curcliente = empresaBase()->cargacursor("SELECT recargoeqcliente, regimenfiscalcliente FROM cliente WHERE idcliente = " + mdb_idcliente);
00332
00333 if (!curcliente->eof()) {
00335 for (int i = 0; i < rowCount() - 1; i++) {
00336 SDBRecord *rec = lineaat(i);
00337 cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + rec->DBvalue("idarticulo") );
00338 cursor2 *cur1 = empresaBase()->cargacursor("SELECT * FROM tasa_iva WHERE idtipo_iva = " + cur->valor("idtipo_iva") + " ORDER BY fechatasa_iva LIMIT 1");
00339 if (!cur->eof()) {
00340
00341 if (curcliente->valor("regimenfiscalcliente") == "Normal") {
00342 rec->setDBvalue("iva" + m_tablename, cur1->valor("porcentasa_iva"));
00343 }
00344
00345 if (curcliente->valor("recargoeqcliente") == "t") {
00346 rec->setDBvalue("reqeq" + m_tablename, cur1->valor("porcentretasa_iva"));
00347 }
00348
00349 }
00350 delete cur1;
00351 delete cur;
00352 }
00353 }
00354 delete curcliente;
00355 _depura("END SubForm2Bf::setIdCliente", 0);
00356 }
00357
00358
00360
00364 void SubForm2Bf::setIdProveedor(QString id) {
00365 _depura("SubForm2Bf::setIdProveedor", 0, id);
00366
00368 if (mdb_idproveedor == "" ) {
00369 mdb_idproveedor = id;
00370 return;
00371 }
00372
00374 if (mdb_idproveedor == id) return;
00375
00376 mdb_idproveedor = id;
00377
00379 for (int i = 0; i < rowCount() - 1; i++) {
00380 SDBRecord *rec = lineaat(i);
00381 rec->setDBvalue("iva"+m_tablename, "0");
00382 rec->setDBvalue("reqeq"+m_tablename, "0");
00383 }
00384
00385 cursor2 *curproveedor = empresaBase()->cargacursor("SELECT recargoeqproveedor, regimenfiscalproveedor FROM proveedor WHERE idproveedor="+mdb_idproveedor);
00386 if (!curproveedor->eof()) {
00388 for (int i = 0; i < rowCount() - 1; i++) {
00389 SDBRecord *rec = lineaat(i);
00390 cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + rec->DBvalue("idarticulo") );
00391 cursor2 *cur1 = empresaBase()->cargacursor("SELECT * FROM tasa_iva WHERE idtipo_iva = " + cur->valor("idtipo_iva") + " ORDER BY fechatasa_iva LIMIT 1");
00392 if (!cur->eof() ) {
00393 if (curproveedor->valor("regimenfiscalproveedor") == "Normal") {
00394 rec->setDBvalue("iva"+m_tablename, cur1->valor("porcentasa_iva"));
00395 }
00396 if (curproveedor->valor("recargoeqproveedor") == "t") {
00397 rec->setDBvalue("reqeq"+m_tablename, cur1->valor("porcentretasa_iva"));
00398 }
00399
00400 }
00401 delete cur1;
00402 delete cur;
00403 }
00404 }
00405 delete curproveedor;
00406 _depura("END SubForm2Bf::setIdProveedor", 0);
00407 }
00408
00409
00411
00414 void SubForm2Bf::setEmpresaBase(EmpresaBase *c) {
00415 _depura("SubForm2Bf::setcompany", 0);
00416 SubForm3::setEmpresaBase(c);
00417 m_delegate->setEmpresaBase(c);
00418 _depura("END SubForm2Bf::setcompany", 0);
00419 }
00420
00421
00423
00426 int SubForm2Bf::cerrarEditor() {
00427 _depura("SubForm2Bf::cerrarEditor", 0);
00428 QWidget *editor = mui_list->QAbstractItemView::indexWidget(mui_list->currentIndex());
00429 m_delegate->cerrarEditor(editor);
00430 _depura("END SubForm2Bf::cerrarEditor", 0);
00431 return 0;
00432 }
00433
00434
00439
00442 QSubForm2BfDelegate::QSubForm2BfDelegate(QObject *parent = 0) : QItemDelegate(parent), PEmpresaBase() {
00443 _depura("QSubForm2BfDelegate::QSubForm2BfDelegate", 0);
00444 m_subform = (SubForm2Bf *) parent;
00445 installEventFilter(this);
00446 _depura("END QSubForm2BfDelegate::QSubForm2BfDelegate", 0);
00447 }
00448
00449
00451
00453 QSubForm2BfDelegate::~QSubForm2BfDelegate() {
00454 _depura("QSubForm2BfDelegate::~QSubForm2BfDelegate", 0);
00455 _depura("END QSubForm2BfDelegate::~QSubForm2BfDelegate", 0);
00456 }
00457
00458
00460
00465 QWidget *QSubForm2BfDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
00466 _depura("QSubForm2BfDelegate::createEditor", 0);
00467 SHeader *linea;
00468 linea = m_subform->cabecera()->at(index.column());
00469 _depura("QSubForm2BfDelegate::createEditor", 0, "CurrentColumn: " + QString::number(index.column()));
00470 _depura("QSubForm2BfDelegate::createEditor", 0, "CurrentRow" + QString::number(index.row()));
00471
00472 if (linea->nomcampo() == "desc" + m_subform->tableName()) {
00473 QTextEditDelegate *editor = new QTextEditDelegate(parent);
00474 editor->setObjectName("QTextEditDelegate");
00475 return editor;
00476
00477 } else if (linea->nomcampo() == "cant" + m_subform->tableName()
00478 || linea->nomcampo() == "pvp" + m_subform->tableName()
00479 || linea->nomcampo() == "descuento" + m_subform->tableName()
00480 || linea->nomcampo() == "iva" + m_subform->tableName()
00481 || linea->nomcampo() == "reqeq" + m_subform->tableName()) {
00482
00483 QDoubleSpinBox2 *editor = new QDoubleSpinBox2(parent);
00484 editor->setMinimum(-1000000);
00485 editor->setMaximum(1000000);
00486 return editor;
00487
00488 } else if (linea->nomcampo() == "codigocompletoarticulo") {
00489 BusquedaArticuloDelegate *editor = new BusquedaArticuloDelegate(parent);
00490 editor->setEmpresaBase((Company *)m_subform->empresaBase());
00491 return editor;
00492 } else if (linea->nomcampo() == "desctipo_iva") {
00493 BusquedaTipoIVADelegate *editor = new BusquedaTipoIVADelegate(parent);
00494 editor->setEmpresaBase((Company *)m_subform->empresaBase());
00495 return editor;
00496 } else if (linea->nomcampo() == "nomtrabajador") {
00497 BusquedaTrabajadorDelegate *editor = new BusquedaTrabajadorDelegate(parent);
00498 editor->setEmpresaBase((Company *)m_subform->empresaBase());
00499 return editor;
00500 } else if (linea->nomcampo() == "nomalmacen") {
00501 BusquedaAlmacenDelegate *editor = new BusquedaAlmacenDelegate(parent);
00502 editor->setEmpresaBase((Company *)m_subform->empresaBase());
00503 return editor;
00504 } else {
00505
00506
00508
00509
00510
00511 return QItemDelegate::createEditor(parent, option, index);
00512 }
00513 _depura("END QSubForm2BfDelegate::createEditor", 0);
00514 }
00515
00516
00518
00524 void QSubForm2BfDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
00525 _depura("QSubForm2BfDelegate::setModelData", 0);
00526 _depura("QSubForm2BfDelegate::setModelData", 0, "CurrentColumn: " + QString::number(index.column()));
00527 _depura("QSubForm2BfDelegate::setModelData", 0, "CurrentRow: " + QString::number(index.row()));
00528
00530 if (index.column() < 0 || index.row() < 0)
00531 return;
00532
00533 SHeader *linea;
00534 linea = m_subform->cabecera()->at(index.column());
00535 if (linea->nomcampo() == "desc" + m_subform->tableName()) {
00536 QTextEditDelegate *textedit = qobject_cast<QTextEditDelegate *>(editor);
00537 model->setData(index, textedit->toPlainText());
00538 return;
00539
00540 } else if (linea->nomcampo() == "cant" + m_subform->tableName()
00541 || linea->nomcampo() == "pvp" + m_subform->tableName()
00542 || linea->nomcampo() == "descuento" + m_subform->tableName()
00543 || linea->nomcampo() == "reqeq" + m_subform->tableName()
00544 || linea->nomcampo() == "iva" + m_subform->tableName()) {
00545
00546 QDoubleSpinBox2 *spinBox = static_cast<QDoubleSpinBox2*>(editor);
00547 spinBox->interpretText();
00548 QString value = spinBox->text();
00549 model->setData(index, value);
00550
00551 } else if (linea->nomcampo() == "codigocompletoarticulo") {
00552 BusquedaArticuloDelegate *comboBox = static_cast<BusquedaArticuloDelegate*>(editor);
00553 QString value = comboBox->currentText();
00554 value = value.left(value.indexOf(".-"));
00555 model->setData(index, value);
00556 } else if (linea->nomcampo() == "desctipo_iva") {
00557 BusquedaTipoIVADelegate *comboBox = static_cast<BusquedaTipoIVADelegate*>(editor);
00558 QString value = comboBox->currentText();
00559 model->setData(index, value);
00560 } else if (linea->nomcampo() == "nomtrabajador") {
00561 BusquedaTrabajadorDelegate *comboBox = static_cast<BusquedaTrabajadorDelegate*>(editor);
00562 QString value = comboBox->currentText();
00563 model->setData(index, value);
00564 } else if (linea->nomcampo() == "nomalmacen") {
00565 BusquedaAlmacenDelegate *comboBox = static_cast<BusquedaAlmacenDelegate*>(editor);
00566 QString value = comboBox->currentText();
00567 model->setData(index, value);
00568 } else {
00569 QItemDelegate::setModelData(editor, model, index);
00570 }
00571 _depura("END QSubForm2BfDelegate::setModelData", 0);
00572 }
00573
00574
00576
00580 void QSubForm2BfDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const {
00581 _depura("QSubForm2BfDelegate::setEditorData", 0);
00582 _depura("QSubForm2BfDelegate::setEditorData", 0, "CurrentColumn: " + QString::number(index.column()));
00583 _depura("QSubForm2BfDelegate::setEditorData", 0, "CurrentRow: " + QString::number(index.row()));
00584 SHeader *linea;
00585 linea = m_subform->cabecera()->at(index.column());
00586 if (linea->nomcampo() == "desc" + m_subform->tableName()) {
00587 QString data = index.model()->data(index, Qt::DisplayRole).toString();
00588 QTextEditDelegate *textedit = qobject_cast<QTextEditDelegate*>(editor);
00589 textedit->setText(data);
00590
00591 } else if (linea->nomcampo() == "cant" + m_subform->tableName()
00592 || linea->nomcampo() == "pvp" + m_subform->tableName()
00593 || linea->nomcampo() == "descuento" + m_subform->tableName()
00594 || linea->nomcampo() == "reqeq" + m_subform->tableName()
00595 || linea->nomcampo() == "iva" + m_subform->tableName()) {
00596
00597 QString value = index.model()->data(index, Qt::DisplayRole).toString();
00598 QDoubleSpinBox2 *spinBox = static_cast<QDoubleSpinBox2*>(editor);
00599 spinBox->setValue(value.toDouble());
00600 spinBox->selectAll();
00601
00602 } else if (linea->nomcampo() == "codigocompletoarticulo") {
00603 QString value = index.model()->data(index, Qt::DisplayRole).toString();
00604 BusquedaArticuloDelegate *comboBox = static_cast<BusquedaArticuloDelegate*>(editor);
00605 comboBox->addItem(value);
00606 } else if (linea->nomcampo() == "desctipo_iva") {
00607 QString value = index.model()->data(index, Qt::DisplayRole).toString();
00608 BusquedaTipoIVADelegate *comboBox = static_cast<BusquedaTipoIVADelegate*>(editor);
00609 comboBox->set(value);
00610 } else if (linea->nomcampo() == "nomtrabajador") {
00611 QString value = index.model()->data(index, Qt::DisplayRole).toString();
00612 BusquedaTrabajadorDelegate *comboBox = static_cast<BusquedaTrabajadorDelegate*>(editor);
00613 comboBox->set(value);
00614 } else if (linea->nomcampo() == "nomalmacen") {
00615 QString value = index.model()->data(index, Qt::DisplayRole).toString();
00616 BusquedaAlmacenDelegate *comboBox = static_cast<BusquedaAlmacenDelegate*>(editor);
00617 comboBox->set(value);
00618 } else {
00619 QItemDelegate::setEditorData(editor, index);
00620 }
00621 _depura("END QSubForm2BfDelegate::setEditorData", 0);
00622 }
00623
00624
00626
00631 bool QSubForm2BfDelegate::eventFilter(QObject *obj, QEvent *event) {
00633 if (event->type() == QEvent::KeyPress) {
00634 _depura("QSubForm2BfDelegate::eventFilter", 0, obj->objectName() + " --> " + QString::number(event->type()));
00635 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
00636 int key = keyEvent->key();
00637 _depura("QSubForm2BfDelegate::key = : ", 0, QString::number(key));
00638 Qt::KeyboardModifiers mod = keyEvent->modifiers();
00640 switch (key) {
00641 case Qt::Key_Return:
00642 case Qt::Key_Enter:
00643 if (obj->objectName() == "QTextEditDelegate") {
00644 obj->event(event);
00645 return TRUE;
00646 }
00647 case Qt::Key_Tab:
00648 return TRUE;
00649 }
00650 return QItemDelegate::eventFilter(obj, event);
00651 }
00652
00653 if (event->type() == QEvent::KeyRelease) {
00654 _depura("QSubForm2BfDelegate::eventFilter", 0, obj->objectName() + " --> " + QString::number(event->type()));
00655 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
00656 int key = keyEvent->key();
00657 _depura("QSubForm2BfDelegate::key = : ", 0, QString::number(key));
00658 Qt::KeyboardModifiers mod = keyEvent->modifiers();
00660 switch (key) {
00661 case Qt::Key_Return:
00662 case Qt::Key_Enter:
00663 if (obj->objectName() == "QTextEditDelegate") {
00664 obj->event(event);
00665 return TRUE;
00666 }
00667 case Qt::Key_Tab:
00668 QApplication::sendEvent(m_subform->mui_list, event);
00669 return TRUE;
00670 }
00671 return QItemDelegate::eventFilter(obj, event);
00672 }
00673
00674 return QItemDelegate::eventFilter(obj, event);
00675 }
00676
00677
00679
00683 int QSubForm2BfDelegate::cerrarEditor(QWidget *editor) {
00684 _depura("QSubForm2BfDelegate::cerrarEditor", 0);
00685 emit closeEditor(editor, QAbstractItemDelegate::NoHint);
00686 _depura("END QSubForm2BfDelegate::cerrarEditor", 0);
00687 return 0;
00688 }
00689