QT 信号槽用法 实例

来源:互联网 发布:蓝牙适配器串口软件 编辑:程序博客网 时间:2024/06/05 15:26
1.connect(ui->menu_2, SIGNAL(triggered(QAction*)), this, SLOT(ActionCollectOnceTrigger(QAction*)));
这个信号槽连接可以知道菜单点击的是哪个action
2.connect(ui->actionImport, SIGNAL(triggered()), this, SLOT(BatchImport()));
点击菜单中action 触发事件
3.connect(ui->tableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(showSelectedListItem()));tableWidget某一记录被选择4.connect(ui->BatImport, SIGNAL(clicked()), this, SLOT(unknownMaterialImport()));点击触发事件5.connect(ui->tableWidget1->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(mySort(int)));tableWidget表头选中触发函数6.connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(rightClickAddLeftDown(QPoint)));右击tableWidget  某行 出现菜单栏

原创粉丝点击