本文主要是介绍9_6_comboBox,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
comboBox
#include "widget.h"
#include "ui_widget.h"
#include<QDebug>#include<fstream>Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);//读文件std::ifstream file_user("D:\\Users\\wsiyu\\Desktop\\chooseUser.txt");if(!file_user.is_open()){qDebug()<<"file_user open filed"<<endl;return;}std::ifstream file_arms("D:\\Users\\wsiyu\\Desktop\\chooseArms.txt");if(!file_user.is_open()){qDebug()<<"file_arms open filed"<<endl;return;}std::string user;std::string arms;while(std::getline(file_user,user)){ui->comboBox_uesr->addItem(QString::fromStdString(user));}while(std::getline(file_arms, arms)){ui->comboBox_arms->addItem(QString::fromStdString(arms));}
}Widget::~Widget()
{delete ui;
}
这篇关于9_6_comboBox的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!