Thanks for u r advice...
i tried currentText...it is getting only first item value....when i press second item didn't print second value...
Here is the Code....
#include <QApplication>
#include <QLabel>
#include <QPushButton>
#include <QWidget>
#include <QComboBox>
#include <QDialog>
#include <QVBoxLayout>
#include <QMessageBox>
#include <stdio.h>
#include <QDebug>
int main(int argc,char* argv[])
{
char str[34]= "12333";
char str1[10]= "267788";
char str2[12]= "39987";
QLabel *label
= new QLabel("Plz Select the items in ComboBox");
layout->addWidget(label);
layout->addWidget(combo);
combo->addItem(str);
combo->addItem(str1);
combo->addItem(str2);
QString val
= combo
->currentText
();
qDebug()<<val;
w.show();
return a.exec();
}
#include <QApplication>
#include <QLabel>
#include <QPushButton>
#include <QWidget>
#include <QComboBox>
#include <QDialog>
#include <QVBoxLayout>
#include <QMessageBox>
#include <stdio.h>
#include <QDebug>
int main(int argc,char* argv[])
{
QApplication a(argc, argv);
QWidget w;
char str[34]= "12333";
char str1[10]= "267788";
char str2[12]= "39987";
QVBoxLayout *layout = new QVBoxLayout(&w);
QLabel *label = new QLabel("Plz Select the items in ComboBox");
QComboBox *combo = new QComboBox();
layout->addWidget(label);
layout->addWidget(combo);
combo->addItem(str);
combo->addItem(str1);
combo->addItem(str2);
QString val = combo->currentText();
qDebug()<<val;
QObject::connect(combo, SIGNAL(currentIndexChanged(QString)), label, SLOT(setText(QString)));
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
....PFA
Bookmarks