我在學習QT是如何工作的。我有這個小碼:Qt:寫入文件
QApplication app(argc, argv);
QWidget fenetre;
fenetre.setFixedWidth(400);
fenetre.setFixedHeight(400);
QPushButton *bouton = new QPushButton("Quit", &fenetre);
bouton->setFixedHeight(50);
bouton->setFixedWidth(100);
bouton->move(170,310);
QLabel *label = new QLabel("Something", &fenetre);
label->move(30,200);
QLineEdit *line = new QLineEdit(&fenetre);
line->move(200,200);
QWidget::connect(bouton, SIGNAL(clicked()),qApp, SLOT(quit()));
fenetre.show();
我想知道我怎麼可以把0標籤的內容在文件(.txt)連續。 目標是在程序完成時,將用戶放入文本文件中的QLineEdit
框中。
感謝
'QLabel'或'QLineEdit'? – eyllanesc
我的不好,我的意思是可以由用戶修改的QLineEdit的內容,是的。對不起:/ – Clement
那麼你有沒有試圖在程序結束時將line-> text()中的字符串存儲到文件中? –