1
저는 한국어이므로, 영어가 능숙하지 않다는 것을 이해하십시오.어떻게 QButtton 어레이에 연결할 수 있습니까?
저는 POS 시스템을 Qt5로 만듭니다.
일부 버튼 (빨간색)을 누르면 테이블 (노란색)에 표시하고 싶습니다. 이 같은
:
그래서, 나는 항목의 일부 이름이 QPushButton을 배열에 넣어 일부 파일을 읽습니다.
및 I는 다음과 같이 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에 넣을 수 있습니까?
어떻게 내 슬롯에 연결할 수있는 단추를 제어 할 수 있습니까? 내 코드에서 단 하나의 버튼 만 작동합니다 ... 모든 버튼이 아닙니다. 단지 양파 수프 (
당신은 각각의 푸시 버튼에 연결해야
와우 완벽한을 !!!!!!!!!!!!!!!!!!! !!!!!! 도와 주셔서 감사합니다! –