1
我是韩国人,所以请理解我不擅长英语。如何连接QButtton阵列?
我只是用Qt5做POS系统。
我想推动一些按钮(红色)时,显示在桌子上(黄色);
这样的:
所以,我读了一些文件有项目的一些名字,把他们在QPushButton阵列。
和我连接该QPushButton阵列是这样的:
void qt_test::put_item(QWidget *Widget, QString location){
QGridLayout *layout = new QGridLayout();
QPushButton *button[25]; //set QPushButton array;
QString name[25]; //store name of item;
fileio file;
file.file_io2(name, location); //read file and get name of item;
int temp=0;
for(int i=0;i<5;i++){
for(int j=1;j<6;j++,temp++){
//insert name in QPushButton
button[temp] = new QPushButton(name[temp]);
button[temp]->setMinimumSize(10,70);
layout->addWidget(button[temp],i,j);
}
}
Widget->setLayout(layout);
//connect QPushArray.
connect(*button,SIGNAL(clicked()),this,SLOT(input_item()));
}
,这是我认为
void qt_test::input_item(){
if(!(P_ROW==9)){
ui.sel_item_table->item(P_ROW,0)->setText("test");
++P_ROW;
}
问题是槽,
我不知道如何我可以将QPushBotton中的文本放在QTable中吗?
如何控制我在插槽中连接的按钮。 在我的代码中,只有一个按钮有效......不是所有的按钮。 只是洋葱汤;(
哇完美!!!!!!!!!!!!!!!!!!! !!!!!! 感谢您的帮助! –