小编Ama*_*mar的帖子

如何在Qt按钮上设置标签的字体大小?

我正在使用此代码在大小为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>按钮上写的输出.

如何设置字体大小?

qt4 qpushbutton

8
推荐指数
2
解决办法
2万
查看次数

当组合框中的项目发生变化时,如何调用函数?

connect(ui->ComboBox,SIGNAL(currentIndexChanged()),this,SLOT(switchcall()));
Run Code Online (Sandbox Code Playgroud)

在qt,组合框项目我没有,服务器,客户端.当我选择其中一个它应该调用switchcall function.in这个功能我想执行任务取决于在combobox.how中的选择来做到这一点?

qt combobox qt4

7
推荐指数
2
解决办法
1万
查看次数

如何在Qt中连续写入文件?

我把这段代码写成函数,每次调用这个函数,我都要写入文件.但是这个函数只写一次到文件.每当我从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)

qt qt4

0
推荐指数
1
解决办法
997
查看次数

标签 统计

qt4 ×3

qt ×2

combobox ×1

qpushbutton ×1