我有一个显示一些动态数据的表格。我需要实现一个功能,如果用户单击该行的指定列(请注意,该特定列不需要显示任何数据。它只需要充当接收此特殊用户输入的位置(单击是我的想法)),我应该能够打开一个新窗口。请注意,这个新窗口根本不需要编辑表格的内容。事实上,它将显示表格本身中不存在的一些其他上下文数据。
如何在 Qt 中实现这个?
最佳答案
使用信号和槽。希望这会有所帮助!
connect(tableView,SIGNAL(clicked(const QModelIndex &)),this,SLOT(function(const QModelIndex &)));
void function(const QModelIndex &index)
{
int row=index.row();
int column=index.column();
dialog->show();
//do the stuff
}
关于c++ - 在 Qt 中单击 QTableView 中某一行的特定单元格时打开一个新窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46746730/