qt qcombox 搜索功能

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include 
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QCompleter *pcomp = new QCompleter(ui->comboBox->model(),this);
    ui->comboBox->setCompleter(pcomp);
    char data = 'A';
    char data1 = 'C';
    for(int i = 0;i<26;i++)
    {
        QString str(data++);
        QString strw(data1++);
        ui->comboBox->addItem( str+strw);
    }
}

MainWindow::~MainWindow()
{
    delete ui;
}

qt qcombox 搜索功能_第1张图片

你可能感兴趣的:(qt,常用语法,qt,搜索)