(Dec-14-2018, 07:29 PM)starglider Wrote: [ -> ]In PyQt5 you can use a SIGNAL in a row that opens a form with your table,
or add a button to a cell in the row and open the sub-form with a table,
or place a table in a cell (I have to try this)
Can you be more specific.
I want to open the product cart beside product table without opening a new window.
I want product cart to be display only when I select a product and click on additem.
Is it possible for me to get that behavior?How can I do that?
This is product cart.py
and the product table is the image added before
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.setEnabled(True)
Dialog.resize(1280, 776)
self.comboBox = QtGui.QComboBox(Dialog)
self.comboBox.setGeometry(QtCore.QRect(330, 190, 104, 41))
self.comboBox.setMaximumSize(QtCore.QSize(16777215, 50))
self.comboBox.setEditable(True)
self.comboBox.setObjectName(_fromUtf8("comboBox"))
self.comboBox_3 = QtGui.QComboBox(Dialog)
self.comboBox_3.setGeometry(QtCore.QRect(430, 190, 291, 41))
self.comboBox_3.setEditable(True)
self.comboBox_3.setObjectName(_fromUtf8("comboBox_3"))
self.lineEdit = QtGui.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(720, 190, 113, 31))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.lineEdit_2 = QtGui.QLineEdit(Dialog)
self.lineEdit_2.setGeometry(QtCore.QRect(830, 190, 113, 31))
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
self.comboBox_4 = QtGui.QComboBox(Dialog)
self.comboBox_4.setGeometry(QtCore.QRect(950, 190, 160, 40))
self.comboBox_4.setEditable(True)
self.comboBox_4.setObjectName(_fromUtf8("comboBox_4"))
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(830, 140, 113, 32))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.pushButton_2 = QtGui.QPushButton(Dialog)
self.pushButton_2.setGeometry(QtCore.QRect(960, 140, 113, 32))
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.label = QtGui.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(339, 170, 71, 20))
self.label.setObjectName(_fromUtf8("label"))
self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(479, 170, 101, 20))
self.label_2.setObjectName(_fromUtf8("label_2"))
self.label_3 = QtGui.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(740, 170, 60, 16))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_4 = QtGui.QLabel(Dialog)
self.label_4.setGeometry(QtCore.QRect(860, 170, 60, 16))
self.label_4.setObjectName(_fromUtf8("label_4"))
self.label_5 = QtGui.QLabel(Dialog)
self.label_5.setGeometry(QtCore.QRect(990, 170, 60, 16))
self.label_5.setObjectName(_fromUtf8("label_5"))
self.line = QtGui.QFrame(Dialog)
self.line.setGeometry(QtCore.QRect(330, 160, 781, 16))
self.line.setFrameShape(QtGui.QFrame.HLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName(_fromUtf8("line"))
self.line_2 = QtGui.QFrame(Dialog)
self.line_2.setGeometry(QtCore.QRect(330, 120, 781, 16))
self.line_2.setFrameShape(QtGui.QFrame.HLine)
self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
self.line_2.setObjectName(_fromUtf8("line_2"))
self.line_3 = QtGui.QFrame(Dialog)
self.line_3.setGeometry(QtCore.QRect(330, 240, 781, 16))
self.line_3.setFrameShape(QtGui.QFrame.HLine)
self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
self.line_3.setObjectName(_fromUtf8("line_3"))
self.tableWidget = QtGui.QTableWidget(Dialog)
self.tableWidget.setGeometry(QtCore.QRect(320, 260, 771, 271))
self.tableWidget.setRowCount(1)
self.tableWidget.setColumnCount(5)
self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
self.pushButton_3 = QtGui.QPushButton(Dialog)
self.pushButton_3.setGeometry(QtCore.QRect(840, 280, 113, 32))
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
self.pushButton_4 = QtGui.QPushButton(Dialog)
self.pushButton_4.setGeometry(QtCore.QRect(960, 280, 113, 32))
self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
self.pushButton.setText(_translate("Dialog", "clear", None))
self.pushButton_2.setText(_translate("Dialog", "save", None))
self.label.setText(_translate("Dialog", "product_id", None))
self.label_2.setText(_translate("Dialog", "Product_name", None))
self.label_3.setText(_translate("Dialog", "price", None))
self.label_4.setText(_translate("Dialog", "quantity", None))
self.label_5.setText(_translate("Dialog", "value", None))
self.pushButton_3.setText(_translate("Dialog", "Edit", None))
self.pushButton_4.setText(_translate("Dialog", "delete", None))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())