I'm wanting to use a QComboBox as a sort of data storage for my application. It's not a large ammount of data, and I think this would be the easiest way to not be constantly reading from the database file. This little snippit shows what I'm trying to do.
dataList << "D1" << "D2" << "D3";
ui
->ShowDate
->insertItem
(0,
QDate(query.
value(2).
toInt(), query.
value(0).
toInt(),
query.value(1).toInt()).toString(("MMMM d, yyyy")), dataList);
QStringList dataList;
dataList << "D1" << "D2" << "D3";
ui->ShowDate->insertItem(0, QDate(query.value(2).toInt(), query.value(0).toInt(),
query.value(1).toInt()).toString(("MMMM d, yyyy")), dataList);
To copy to clipboard, switch view to plain text mode
I know how to access the text with
ui->lineEdit->setText(ui->ShowDate->currentText());
ui->lineEdit->setText(ui->ShowDate->currentText());
To copy to clipboard, switch view to plain text mode
but how do I access the QVariant?
I'm new to not only Qt, but c++ as well, so a small snippit showing how to put, say dataList[0] into a lable...
ui->label->setText(<however to get dataList[0] in here>);
ui->label->setText(<however to get dataList[0] in here>);
To copy to clipboard, switch view to plain text mode
Qt version 4.5
Bookmarks