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;
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
QComboBox *comboBox;
QPushButton *pushButton;
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
comboBox=ui->comboBox;
pushButton=ui->pushButton;
}
void MainWindow::on_pushButton_clicked()
{
comboBox->addItem("hari");
}
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");
}
To copy to clipboard, switch view to plain text mode
Please help me ASAP!! this is really urgent! thank you very much!!
Bookmarks