This is the code i want to run .
i put QpushButton in QTableWidget by setCellWidget but when i add Menu action to the button the menu doesn't display why?
-
p = QtWidgets.QPushButton("Test")
-
menuf= QtWidgets.QMenu(p)
-
p.setMenu(menuf)
-
Op= QtWidgets.QAction(menuf)
-
Pp= QtWidgets.QAction(menuf)
-
_translate = QtCore.QCoreApplication.translate
-
Op.setText(_translate("MainWindow", "Section"))
-
Pp.setText(_translate("MainWindow", "Charge"))
-
p.addAction(Op)
-
p.addAction(Pp)
-
self.tableWidget.setCellWidget(2,1,p)
-
thingWidget = self.tableWidget.cellWidget(2,1)