- 2008/6/17
https://openhome.cc/Gossip/Qt4Gossip/QGridLayout.html
更正第一個程式範例與執行圖片。。XD
更正第一個程式範例與執行圖片。。XD
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
QLabel *label = new QLabel(texts[i]);
label->setFrameStyle(QFrame::Panel + QFrame::Sunken);
label->setMinimumSize(55, 0);
label->setAlignment(Qt::AlignCenter);
layout->addWidget(label, i, j);
}
}
改為:
for(int i = 0, k = 0; i < 3; i++, k = k + 3) {
for(int j = 0; j < 3; j++) {
QLabel *label = new QLabel(texts[k + j]);
label->setFrameStyle(QFrame::Panel + QFrame::Sunken);
label->setMinimumSize(55, 0);
label->setAlignment(Qt::AlignCenter);
layout->addWidget(label, i, j);
}
}