반응형
#include <QString>
QString::number(n)
https://doc.qt.io/qt-5/qstring.html#number
다수개의 QPushButton text 지정
// QPushButton 배열 할당 QPushButton *btn_num[10]; // for문 - 각 버튼에 숫자 text 출력 (0~9) for(int i=0; i<10; i++) { btn_nump[i] = new QPushButton(QString::number(i), this); }
Wrong Case
// wrong case (1) btn_num[i] = new QPushButton(tr(i+""),this); // java형식 // wrong case(2) btn_num[2] = new QPushButton(tr("0"+i),this); // 아스키코드 시도했음(틀림)
반응형