我正在使用此代码在大小为16的按钮上设置标签
ui->pushButton->setText(tr("<font size=16>Tank 1 \n %1%2C</font>").arg(szTemp).arg(degree));
Run Code Online (Sandbox Code Playgroud)
但我得到了<font size=16>Tank 1 005c</font>按钮上写的输出.
如何设置字体大小?
connect(ui->ComboBox,SIGNAL(currentIndexChanged()),this,SLOT(switchcall()));
Run Code Online (Sandbox Code Playgroud)
在qt,组合框项目我没有,服务器,客户端.当我选择其中一个它应该调用switchcall function.in这个功能我想执行任务取决于在combobox.how中的选择来做到这一点?
我把这段代码写成函数,每次调用这个函数,我都要写入文件.但是这个函数只写一次到文件.每当我从windows打开文件时我发现只写了一个字文件.每次打电话时如何连续写入文件?
/* Try and open a file for output */
QString outputFilename = "Results.txt";
QFile outputFile(outputFilename);
outputFile.open(QIODevice::WriteOnly);
/* Check it opened OK */
if(!outputFile.isOpen()){
qDebug() <<"- Error, unable to open" << outputFilename << "for output";
return ;
}
/* Point a QTextStream object at the file */
QTextStream outStream(&outputFile);
/* Write the line to the file */
outStream <<"\n"<< szTemp;//"Victory!\n";
/* Close the file */
outputFile.close();
Run Code Online (Sandbox Code Playgroud)