bool ReplaceCfg::eventFilter(QObject *o, QEvent *e) { if (e->type() == QEvent::KeyPress){ QKeyEvent *ke = (QKeyEvent*)e; if ((ke->key() == Key_Right) && (m_col == 0)){ if (!m_edit->hasMarkedText() && (m_edit->cursorPosition() == (int)m_edit->text().length())){ m_col = 1; setEdit(); return true; } } if ((ke->key() == Key_Left) && (m_col == 1)){ if (!m_edit->hasMarkedText() && (m_edit->cursorPosition() == 0)){ m_col = 0; setEdit(); return true; } } if ((ke->key() == Key_Enter) || (ke->key() == Key_Return)){ QString text = m_edit->text(); flush(); if ((m_col == 0) && !text.isEmpty()) m_col = 1; setEdit(); return true; } if (ke->key() == Key_Escape){ m_edit->setText(m_editItem->text(m_col)); m_edit->setSelection(0, m_edit->text().length()); return true; } } return ReplaceCfgBase::eventFilter(o, e); }
void PostScene::callBack(vector<PBase*> _callBackData){ if (_callBackData.size() == 1){ if (_callBackData.at(0)->getID() == ""){ SceneManager::instance()->showScene("listScene"); } else{ setTool(static_cast<tabCheck*>(_callBackData.at(0))); setEdit(true); } } else{ setEdit(false); } }
void ReplaceCfg::mouseButtonPressed(int, QListViewItem *item, const QPoint&, int col) { if (item){ m_col = col; setEdit(); } }
ReplaceCfg::ReplaceCfg(QWidget *parent, ReplacePlugin *plugin) : ReplaceCfgBase(parent) { m_plugin = plugin; lstKeys->addColumn(i18n("You type")); lstKeys->addColumn(i18n("You send")); lstKeys->setExpandingColumn(1); lstKeys->setSorting(2); for (unsigned i = 1; i <= m_plugin->getKeys(); i++){ QString key = m_plugin->getKey(i); QString value = m_plugin->getValue(i); if (key.isEmpty()) continue; new QListViewItem(lstKeys, key, value, number(m_count++).c_str()); } new QListViewItem(lstKeys, "", "", number(m_count++).c_str()); lstKeys->adjustColumn(); m_edit = new IntLineEdit(lstKeys->viewport()); m_edit->installEventFilter(this); lstKeys->setFocusProxy(m_edit); m_col = 0; lstKeys->setCurrentItem(lstKeys->firstChild()); m_editItem = NULL; m_editCol = (unsigned)(-1); setEdit(); connect(lstKeys, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(lstKeys->header(), SIGNAL(sizeChange(int,int,int)), this, SLOT(sizeChange(int,int,int))); connect(lstKeys, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int)), this, SLOT(mouseButtonPressed(int, QListViewItem*, const QPoint&, int))); }
void Ventana_Principal::AnalisisJSON() { Pestana *actual = (Pestana*)ui->tabWidget->currentWidget(); if(actual != NULL){ QFile file("temp.txt"); //SE CREA UN ARCHIVO TEMPORAL PARA COMPILARLO if ( file.open( file.WriteOnly ) ) { //BUFFER PARA EL TEXTO QUE SE DESEA COMPILAR QTextStream stream1( &file ); stream1 << actual->enviar_texto(); } const char* x = "temp.txt"; FILE* input = fopen(x, "r" ); errores_json->ven()->clear(); SetVentanita_json(errores_json->ven()); setFila(); setColumna(); setEdit(actual->textedit()); yyrestart(input);//SE PASA LA CADENA DE ENTRADA A FLEX yyparse();//SE INICIA LA COMPILACION ArbolJ *nuevo = setArbolito(); if(nuevo != NULL && correctojson() != 1){ //nuevo->Dibujar(); } } }
//TODOODOT : implement correct version void updateFromTransactionsQueryForRow(QueryEntry *qe, Array<int> numTransactions, int row, bool dView, bool edit) { setDetailedView(dView); setEdit(edit); resized(); this->row = row; if(qe) { // summary const int numFields = 3; for (int i=0; i<getNumChildComponents(); i++) { TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i)); if (te && te->getName().startsWith("#")) { const int ord = te->getName().substring(1).getIntValue(); const int row = ord/numFields; const int field = ord%numFields; if (row < numTransactions.size()) { te->setText(qe->getFieldFromRow(row, field)); te->setEnabled(edit); te->setVisible(true); } else { te->setVisible(false); } } } } }
void MatrixSelector::selectionWatcher( const QString & tag ) { QString label = "[" + tag + "]"; emit selectionChangedLabel(label); setEdit(tag); }
SlimLineEdit::SlimLineEdit(QWidget *parent) : QWidget(parent), ui(new Ui::SlimLineEdit) { ui->setupUi(this); ui->stackedWidget->setCurrentWidget(ui->page_view); connect(ui->button_edit, SIGNAL(clicked()), this, SLOT(setEdit())); connect(ui->button_validate, SIGNAL(clicked()), this, SLOT(setNormal())); connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(setNormal())); }
void __fastcall TfrmMain::btnEditClick(TObject *Sender) { if(ListView3->Selected==NULL) { Application->MessageBoxA("请选择一个设备!","提示",MB_ICONINFORMATION); return; } setEdit(true); dwAdd = 2; lblAdd->Caption = "正在编辑"; }
void __fastcall TfrmMain::btnAddClick(TObject *Sender) { if(ListView3->Selected==NULL) { Application->MessageBoxA("请选择一个设备!","提示",MB_ICONINFORMATION); return; } dwAdd = 1; iCaseVtoG = 0; iCaseVID = -1; iCaseDef = ""; setEdit(true); ClearSet(); lblAdd->Caption ="正在添加"; }
void MatrixSelector::update() { QString prev = _matrix->currentText(); QString tag; bool found = false; int index; /* xxx if (_matrix->listBox()->isVisible()) { QTimer::singleShot(250, this, SLOT(update())); return; } */ blockSignals(true); _matrix->clear(); if (_provideNoneMatrix) { _matrix->insertItem(0, "<None>"); } KstMatrixList matrices = KST::matrixList.list(); KST::matrixList.lock().readLock(); for (KstMatrixList::ConstIterator i = matrices.begin(); i != matrices.end(); ++i) { (*i)->readLock(); tag = (*i)->tag().displayString(); (*i)->unlock(); _matrix->addItem(tag); if (!found && tag == prev) { found = true; } } KST::matrixList.lock().unlock(); if (found) { index = _matrix->findText(prev); if (index != -1) { _matrix->setCurrentIndex(index); } } blockSignals(false); setEdit(_matrix->currentText()); }
void HospitalisationPay::edit(QString strNo) { ui.addButton->setEnabled(false); ui.editButton->setEnabled(true); setEdit(false); Isupdate=true; QSqlQuery query(*sql.db); query.exec("select * from zy_pay where sheetno='"+strNo+"'"); while(query.next()) { ui.sheetNoEdit->setText(query.value(1).toString()); QDateTime date = QDateTime::fromString(query.value(2).toString(),"yyyy-MM-dd hh:mm:ss"); ui.dateTimeEdit->setDateTime(date); QString strhospitalNo = query.value(3).toString(); for (int i =0;i<ui.hospitalNocomboBox->count();i++) { if (ui.hospitalNocomboBox->itemText(i)==strhospitalNo) { ui.hospitalNocomboBox->setCurrentIndex(i); } } getInfo(strhospitalNo); //ui.hospitalNocomboBox->setEditText(query.value(3).toString()); ui.nameEdit->setText(query.value(4).toString()); ui.registrydateEdit->setText(query.value(5).toDateTime().toString("yyyy-MM-dd hh:mm:ss")); ui.bedEdit->setText(query.value(6).toString()); QString strchargemethod = query.value(7).toString(); for (int i =0;i<ui.chargemethodcomboBox->count();i++) { if (ui.chargemethodcomboBox->itemText(i)==strchargemethod) { ui.chargemethodcomboBox->setCurrentIndex(i); } } // ui.chargemethodcomboBox->setEditText(query.value(7).toString()); ui.amountEdit->setText(query.value(8).toString()); //ui.remarkEdit->setText(query.value(9).toString()); ui.payerEdit->setText(query.value(10).toString()); } }
void MatrixSelector::setSelection( const QString & tag ) { if (tag.isEmpty()) { if (_provideNoneMatrix) { blockSignals(true); _matrix->setCurrentIndex(0); blockSignals(false); _editMatrix->setEnabled(false); } return; } else { int index; blockSignals(true); index = _matrix->findText(tag); if (index != -1) { _matrix->setCurrentIndex(index); } blockSignals(false); setEdit(tag); } }
void HospitalisationPay::on_addButton_clicked() { on_discardButton_clicked(); initUI(); //installEventFilter(this); setEdit(true); QSqlQuery query(*sql.db); query.exec("select * from zy_pay"); int icount=0; while(query.next()) { icount++; } itotalcount=icount+1; QString strNo= "ZYSK"+QString::number(itotalcount, 10); ui.sheetNoEdit->setText(strNo); ui.saveButton->setEnabled(true); ui.discardButton->setEnabled(true); strNo = ui.hospitalNocomboBox->currentText(); getInfo(strNo); }
void SlimLineEdit::setNormal() { setEdit(false); }
void __fastcall TfrmMain::btnSaveClick(TObject *Sender) { TListItem*Item; if(chkIf->Checked && cmbDoOP->ItemIndex==-1) { Application->MessageBoxA("请选择下一个要做的命令!","提示",MB_ICONINFORMATION); return; } if(dwAdd==1) { Item = ListView4->Items->Add(); Item->Caption = cmbOP->Text; Item->SubItems->Add(edtStep->Text); Item->SubItems->Add(edtOID->Text); Item->SubItems->Add(cmbCallType->Text); Item->SubItems->Add((chkLinkPort->Checked==true)?"连接":"不连接"); Item->SubItems->Add(cmbDataType->Text); Item->SubItems->Add(edtValue->Text); Item->SubItems->Add(cmbUse->Text); Item->SubItems->Add(edtSource->Text); Item->SubItems->Add(edtDesc->Text); Item->SubItems->Add(edtDLL->Text); //10 Item->SubItems->Add(cmbTaskSet->Text); Item->SubItems->Add(cmbPortType->Text); Item->SubItems->Add(edtPortDesc->Text); Item->SubItems->Add(cmbLinkLast->Text); Item->SubItems->Add(edtLinkValue->Text); Item->SubItems->Add(chkIf->Checked==true?"IF":""); Item->SubItems->Add(edtCase->Text); Item->SubItems->Add(cmbDoOP->Text); Item->SubItems->Add(cmbCommandType->Text); Item->SubItems->Add(btnTelnet->Hint); Item->SubItems->Add(chkErrorEnd->Checked==true?"1":"0");//21 Item->SubItems->Add(Memo1->Text); Item->SubItems->Add(btnCase->Hint); Item->SubItems->Add(IntToStr(iCaseVtoG));//case的值是动态获取 Item->SubItems->Add(IntToStr(iCaseVID)); Item->SubItems->Add(iCaseDef); int irw=1; if(cmbRW->ItemIndex==1) irw=2; Item->SubItems->Add(IntToStr(irw)); } else { Item = ListView4->Selected; Item->Caption = cmbOP->Text; Item->SubItems->Strings[0]=(edtStep->Text); Item->SubItems->Strings[1]=(edtOID->Text); Item->SubItems->Strings[2]=(cmbCallType->Text); Item->SubItems->Strings[3]=((chkLinkPort->Checked==true)?"连接":"不连接"); Item->SubItems->Strings[4]=(cmbDataType->Text); Item->SubItems->Strings[5]=(edtValue->Text); Item->SubItems->Strings[6]=(cmbUse->Text); Item->SubItems->Strings[7]=(edtSource->Text); Item->SubItems->Strings[8]=(edtDesc->Text); Item->SubItems->Strings[9]=(edtDLL->Text); Item->SubItems->Strings[10] = cmbTaskSet->Text; Item->SubItems->Strings[11] = cmbPortType->Text; Item->SubItems->Strings[12] = edtPortDesc->Text; Item->SubItems->Strings[13] = cmbLinkLast->Text; Item->SubItems->Strings[14] = edtLinkValue->Text; Item->SubItems->Strings[15] =(chkIf->Checked==true?"IF":""); Item->SubItems->Strings[16] =(edtCase->Text); Item->SubItems->Strings[17] =(cmbDoOP->Text); Item->SubItems->Strings[18] = cmbCommandType->Text; Item->SubItems->Strings[19] = btnTelnet->Hint; Item->SubItems->Strings[20] = chkErrorEnd->Checked==true?"1":"0"; Item->SubItems->Strings[21] = Memo1->Text; Item->SubItems->Strings[22] = btnCase->Hint; Item->SubItems->Strings[23] = IntToStr(iCaseVtoG); Item->SubItems->Strings[24] = IntToStr(iCaseVID); Item->SubItems->Strings[25] = iCaseDef; int irw=1; if(cmbRW->ItemIndex==1) irw=2; Item->SubItems->Strings[26] = IntToStr(irw); } FChange = true; setEdit(false); }
void HospitalisationPay::on_editButton_clicked() { ui.deleteButton->setEnabled(true); ui.saveButton->setEnabled(true); setEdit(true); }
void ReplaceCfg::selectionChanged() { if (m_bDelete) return; setEdit(); }
void HospitalisationPay::on_saveButton_clicked() { QSqlQuery query(*sql.db); QString strNo=ui.sheetNoEdit->text(); if(Isupdate) { QString strsql = "select *from zy_pay where sheetno ='"+strNo+"'"; query.exec(strsql); while(query.next()) { itotalcount=query.value(0).toInt(); } } QString strsql = "delete from zy_pay where sheetno ='"+strNo+"'"; query.exec(strsql); if (ui.nameEdit->text()=="") { QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("请填写病人姓名")); box.setStandardButtons (QMessageBox::Ok); box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定")); box.exec(); return; } if (ui.amountEdit->text()=="") { if (Isrefund) { QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("请填写退款金额")); box.setStandardButtons (QMessageBox::Ok); box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定")); box.exec(); } else { QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("请填写交款金额")); box.setStandardButtons (QMessageBox::Ok); box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定")); box.exec(); } return; } query.prepare("INSERT INTO zy_pay VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?)");//, ? query.bindValue(0, itotalcount); query.bindValue(1, ui.sheetNoEdit->text()); query.bindValue(2, ui.dateTimeEdit->dateTime()); query.bindValue(3, ui.hospitalNocomboBox->currentText()); query.bindValue(4, ui.nameEdit->text()); query.bindValue(5, ui.registrydateEdit->text()); query.bindValue(6, ui.bedEdit->text()); query.bindValue(7, ui.chargemethodcomboBox->currentText()); if(Isrefund) query.bindValue(8, ui.amountEdit->text().toDouble()*(-1)); else query.bindValue(8, ui.amountEdit->text().toDouble()); query.bindValue(9, ui.remarkEdit->document()->toPlainText()); //query.bindValue(10, ui.payerEdit->text()); if(query.exec()) { ui.editButton->setEnabled(true); ui.saveButton->setEnabled(false); ui.discardButton->setEnabled(false); setEdit(false); strNo = ui.hospitalNocomboBox->currentText(); getInfo(strNo); QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("是否打印押金条?")); box.setStandardButtons (QMessageBox::Ok|QMessageBox::Cancel); box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定")); box.setButtonText (QMessageBox::Cancel,QString::fromLocal8Bit("取 消")); if(box.exec()==QMessageBox::Ok) { on_printButton_clicked(); } } else { QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("保存失败!")); box.setStandardButtons (QMessageBox::Ok); box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定")); box.exec(); } }
void PhotoName::mousePressEvent(QGraphicsSceneMouseEvent*) { setEdit(); m_view->scene()->clearSelection(); parentItem()->setSelected(true); }
void __fastcall TfrmMain::btnCancelClick(TObject *Sender) { setEdit(false); }
void ReplaceCfg::sizeChange(int,int,int) { setEdit(); }