我已经将一些带有循环的 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);
如何将信号连接到将从按钮执行命令的插槽?顺便说一句,命令设置为工具提示。
如果您知道将命令设置为按钮的更好方法,请告诉我(=