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中嗎?
如何控制我在插槽中連接的按鈕。 在我的代碼中,只有一個按鈕有效......不是所有的按鈕。 只是洋蔥湯;(
哇完美!!!!!!!!!!!!!!!!!!! !!!!!! 感謝您的幫助! –