当我生成qpushbutton时,请点击DoEnst工作
当我生成按钮时,他们没有收到点击信号 如何为每个按钮添加不同的信号源? 是否可以在直播节目中生成按钮? 根据我的想法,这段代码应该根据从数据库中卸载的数据创建按钮,当您单击它时,根据条件,加载另一个列表并在窗口的一个区域中打开它,以及该列表的完整描述另一个中的结构元素
class Ui_MainWindow(object):
def changePalette(self, MainWindow, styleName=QPalette):
MainWindow.setPalette(styleName)
def changeStyle(self, styleName):
ColorStyle.ColorShema().setStyle(styleName="white")
def checkedSubtusk(self,task_id, name, score):
self.infoLeftDownbox(TaskName=name, score=score)
self.subtaskarray = BD.select_current_subtasks(tusk_id=task_id)
self.coordinate = 20
if not self.subtaskarray == None:
for self.button in self.subtaskarray:
self.subtusk(name="test", subTuskName=self.button[1], coordinate=self.coordinate)
self.coordinate += 30
else:
self.taskGroupBox.setStatusTip("What Happened?")
print("click to me")
def tusk(self, name, taskName,task_id,score, coordinate=30, ):
self.Tusk = QPushButton(self.taskGroupBox)
self.Tusk.setObjectName(name)
# self.Tusk.setEnabled(True)
self.Tusk.setGeometry(QRect(20, coordinate, 441, 21))
# self.Tusk.setCheckable(True)
self.Tusk.setChecked(True)
self.Tusk.setText(taskName)
# self.descriptBox.setVisible(False)
self.Tusk.setCursor(QCursor(Qt.PointingHandCursor))
self.Tusk.setAutoFillBackground(False)
self.Tusk.setAutoRepeat(False)
self.Tusk.setAutoRepeatDelay(300)
self.Tusk.setAutoDefault(True)
self.Tusk.clicked.connect(self.checkedSubtusk(task_id, name=name,score=score))
def subtusk(self,name,subTuskName,coordinate):
self.SubTusk = QPushButton(self.gBoxSubTask)
self.SubTusk.setObjectName(name)
self.SubTusk.setEnabled(True)
self.SubTusk.setGeometry(QRect(20, coordinate, 441, 25))
self.SubTusk.setCheckable(True)
self.SubTusk.setChecked(True)
self.SubTusk.setText(subTuskName)
# self.descriptBox.setVisible(False)
## main block
class MyWin(QMainWindow):
def __init__(self):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.newTaskWindow = Ui_CreateTaskForm()UI
self.ui.createTaskBtn.clicked.connect(self.openDialog)
self.ui.newTaskAction.triggered.connect(self.openDialog)
self.ui.exitAction.triggered.connect(self.exit)
self.datatusk = BD.select_today_tasks()
self.coordinate = 30
for self.button in self.datatusk:
self.ui.tusk(name="test", taskName=self.button[1], task_id=self.button[0],score=self.button[9], coordinate=self.coordinate)
self.coordinate += 30
# self.ui.Tusk.clicked.connect(self.ui.checkedSubtusk(1, name="22", score=0))
我正在从数据库上传一个列表,我想让它可点击。通过添加按下时处理图形块的能力,但按钮根本没有反应。 当程序启动时,它必须满足的条件立即得到满足。
when i generate buttons they don't receive click signal
how to add signal sources different for each button?
is it possible to generate buttons in a live program?
according to my idea, this code should create buttons based on the data unloaded from the database, and when you click on it, subject to the conditions, load another list and open it in one area of the window, and the full description of the structure element in another
class Ui_MainWindow(object):
def changePalette(self, MainWindow, styleName=QPalette):
MainWindow.setPalette(styleName)
def changeStyle(self, styleName):
ColorStyle.ColorShema().setStyle(styleName="white")
def checkedSubtusk(self,task_id, name, score):
self.infoLeftDownbox(TaskName=name, score=score)
self.subtaskarray = BD.select_current_subtasks(tusk_id=task_id)
self.coordinate = 20
if not self.subtaskarray == None:
for self.button in self.subtaskarray:
self.subtusk(name="test", subTuskName=self.button[1], coordinate=self.coordinate)
self.coordinate += 30
else:
self.taskGroupBox.setStatusTip("What Happened?")
print("click to me")
def tusk(self, name, taskName,task_id,score, coordinate=30, ):
self.Tusk = QPushButton(self.taskGroupBox)
self.Tusk.setObjectName(name)
# self.Tusk.setEnabled(True)
self.Tusk.setGeometry(QRect(20, coordinate, 441, 21))
# self.Tusk.setCheckable(True)
self.Tusk.setChecked(True)
self.Tusk.setText(taskName)
# self.descriptBox.setVisible(False)
self.Tusk.setCursor(QCursor(Qt.PointingHandCursor))
self.Tusk.setAutoFillBackground(False)
self.Tusk.setAutoRepeat(False)
self.Tusk.setAutoRepeatDelay(300)
self.Tusk.setAutoDefault(True)
self.Tusk.clicked.connect(self.checkedSubtusk(task_id, name=name,score=score))
def subtusk(self,name,subTuskName,coordinate):
self.SubTusk = QPushButton(self.gBoxSubTask)
self.SubTusk.setObjectName(name)
self.SubTusk.setEnabled(True)
self.SubTusk.setGeometry(QRect(20, coordinate, 441, 25))
self.SubTusk.setCheckable(True)
self.SubTusk.setChecked(True)
self.SubTusk.setText(subTuskName)
# self.descriptBox.setVisible(False)
## main block
class MyWin(QMainWindow):
def __init__(self):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.newTaskWindow = Ui_CreateTaskForm()UI
self.ui.createTaskBtn.clicked.connect(self.openDialog)
self.ui.newTaskAction.triggered.connect(self.openDialog)
self.ui.exitAction.triggered.connect(self.exit)
self.datatusk = BD.select_today_tasks()
self.coordinate = 30
for self.button in self.datatusk:
self.ui.tusk(name="test", taskName=self.button[1], task_id=self.button[0],score=self.button[9], coordinate=self.coordinate)
self.coordinate += 30
# self.ui.Tusk.clicked.connect(self.ui.checkedSubtusk(1, name="22", score=0))
I am uploading a list from a database and I want to make it clickable. By adding to it the ability to work with the graphic block when pressed, But the button does not react at all.
When a program starts, the condition it must fulfill is met immediately.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论