Mar-30-2019, 12:57 AM
(Dec-19-2018, 06:23 PM)rarevesselt Wrote:(Dec-18-2018, 06:17 PM)Axel_Erfurt Wrote: You mean somethig like that?
video
Download Project
Thank so much.I can see your code so worked well.Thanks for the help.I will update with the other features.You have solved it.Thanks once again Azel_ErFurt and others.
The image I added is what I end up having.But,I need help on it.When I changed the quantity of product from 1 to another number, I want the table to update automatically.How can I do that?
My second interest is how can I make multiple users to operate the UI simultaneously.
This is function I used;
def your_function(self): self.row = self.Products_table.currentRow() self.currentproduct = (self.Products_table.item(self.row, 0).text() ) self.currentprice = (self.Products_table.item(self.row,1).text() ) ordereditems = QtGui.QTableWidgetItem() row = self.ordereditems.currentRow() numRows = self.ordereditems.rowCount() self.ordereditems.insertRow(numRows) self.total = 0.0 self.items ={} self.ordereditems.setItem(numRows, 0, QtGui.QTableWidgetItem(self.currentproduct)) self.ordereditems.setItem(numRows, 1, QtGui.QTableWidgetItem(str(self.currentprice))) self.ordereditems.setItem(numRows, 2, QtGui.QTableWidgetItem("1")) for numRows in range(numRows+1): self.ordereditems.setItem(numRows, 2, QtGui.QTableWidgetItem(str(self.currentquantity))) self.currentprice =float(self.ordereditems.item(numRows,1).text() ) amount = float(self.currentprice) * float(self.currentquantity) self.ordereditems.setItem(numRows, 3, QtGui.QTableWidgetItem(str(amount))) self.total += amount self.totallinedit.setText(str(self.total)) self.items = {str(self.currentproduct):self.currentquantity} self.items.update({str(self.currentproduct):self.currentquantity})