Qt4 从QTableWidget连接来自CommanLink按钮的各种信号

Qt4 从QTableWidget连接来自CommanLink按钮的各种信号,qt4,qtablewidget,Qt4,Qtablewidget,我已将一些带有循环的CommandLinkButtons放入QTableWidget中: QCommandLinkButton *MysticalButton = new QCommandLinkButton; QueryReturn = ModHandling->ModuleXML("attribute",ModuleList.at(iMod),"Settings","Icon"); QIcon Icon(QueryReturn); QSize IconSize; IconSize.s

我已将一些带有循环的CommandLinkButtons放入QTableWidget中:

QCommandLinkButton *MysticalButton = new QCommandLinkButton;

QueryReturn = ModHandling->ModuleXML("attribute",ModuleList.at(iMod),"Settings","Icon");
QIcon Icon(QueryReturn);
QSize IconSize;
IconSize.scale(48, 48, Qt::KeepAspectRatio);
MysticalButton->setIconSize(IconSize);
MysticalButton->setIcon(Icon);

QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Title");
MysticalButton->setText(QueryReturn);

QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Description");
MysticalButton->setStatusTip(QueryReturn);

// I use the Tooltip to get the Command of this Button:
QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Exec");
MysticalButton->setToolTip(QueryReturn);

ui->tableWidget_Main->setCellWidget(iRow, iCol, MysticalButton);
如何将信号连接到将从按钮执行命令的插槽?顺便说一句,该命令设置为工具提示

如果您知道将命令设置为按钮的更好方法,请让我知道(

查看,或者在单击的插槽中使用
qobject\u cast(sender())

QSignalMapper * signalMapper = new QSignalMapper(this);

QCommandLinkButton *MysticalButton = new QCommandLinkButton;

QueryReturn = ModHandling->ModuleXML("attribute",ModuleList.at(iMod),"Settings","Icon");
QIcon Icon(QueryReturn);
QSize IconSize;
IconSize.scale(48, 48, Qt::KeepAspectRatio);
MysticalButton->setIconSize(IconSize);
MysticalButton->setIcon(Icon);

QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Title");
MysticalButton->setText(QueryReturn);

QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Description");
MysticalButton->setStatusTip(QueryReturn);

// I use the Tooltip to get the Command of this Button:
QueryReturn = ModHandling->ModuleXML("search", ModuleList.at(iMod), "Exec");
MysticalButton->setToolTip(QueryReturn);

ui->tableWidget_Main->setCellWidget(iRow, iCol, MysticalButton);

connect(MysticalButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(MysticalButton, QueryReturn);


connect(signalMapper, SIGNAL(mapped(const QString &)),
         this, SIGNAL(executeCommand(const QString &)));