prasad1001
8th March 2014, 12:50
Hello all,
I am new to Qt, i am trying to add a new item to combobox when a pushbutton is clicked. At that time the combobox is showing the added item but when i closed the app and open the app it doesn't showing the added item i.e it is not saved to combobox.
How to save the new item to combobox
Here is my code:
mainwindow.h
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
QComboBox *comboBox;
QPushButton *pushButton;
mainwindow.cpp
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
comboBox=ui->comboBox;
pushButton=ui->pushButton;
}
void MainWindow::on_pushButton_clicked()
{
comboBox->addItem("hari");
}
Please help me ASAP!! this is really urgent! thank you very much!!
I am new to Qt, i am trying to add a new item to combobox when a pushbutton is clicked. At that time the combobox is showing the added item but when i closed the app and open the app it doesn't showing the added item i.e it is not saved to combobox.
How to save the new item to combobox
Here is my code:
mainwindow.h
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
QComboBox *comboBox;
QPushButton *pushButton;
mainwindow.cpp
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
comboBox=ui->comboBox;
pushButton=ui->pushButton;
}
void MainWindow::on_pushButton_clicked()
{
comboBox->addItem("hari");
}
Please help me ASAP!! this is really urgent! thank you very much!!