C++ (Qt)int usbController::s_buttonUpdate(){ int i= tableWidget->currentRow(); //строка if (tableWidget->selectedItems().isEmpty ()) { return true; } qDebug() << i; //QTableWidget QString tx; for (int j=0; j<6; ++j) { tx=tableWidget->item(i,j)->text(); switch (j) { case 0 : lineEdit_5->setText(tx); // группа case 1 : lineEdit_3->setText(tx);// контекст case 3 : lineEdit_1->setText(tx); // имя_носиетля case 4 : lineEdit_4->setText(tx); // имя владельца case 5 : lineEdit_2->setText(tx); // iSerial qDebug() << QString("Items in list: ") << tx; break; } } return true;}
C++ (Qt)QMap <int, QLineEdit*> edits;edits [0] = lineEdit_5;edits [1] = lineEdit_3;edits [3] = lineEdit_1;edits [4] = lineEdit_4;edits [5] = lineEdit_2; for (int j=0; j<6; ++j) { if (edits.contains (j)) { const QString text = tableWidget->item(i,j)->text(); edits [j]->setText (text); }}
C++ (Qt)QMap <int, QLineEdit*> edits;edits [0] = lineEdit_5;...
C++ (Qt)int usbController::s_buttonUpdate(){ int i= tableWidget->currentRow(); //строка if (tableWidget->selectedItems().isEmpty ()) { return true; } QMap <int, QLineEdit*> edits; edits [0] = lineEdit_5; edits [1] = lineEdit_3; edits [3] = lineEdit_1; edits [4] = lineEdit_4; edits [5] = lineEdit_2; for (int j=0; j<6; ++j) { if (edits.contains (j)) { const QString text = tableWidget->item(i,j)->text(); edits [j]->setText (text); } } return true;}
C++ (Qt)QLineEdit *edits[] = { lineEdit_5, lineEdit_3, 0, lineEdit_4, lineEdit_1 };