Good day! I'm newbie in Qt, please, help me!
When I was writing my programs on C# 2008, there have been many ways to get the current value of the ComboBox. In Qt, I create QComboBox and insert items without using UI designer.
Qt Code:
  1. dataExp = new QComboBox();
  2. codeList = new QComboBox();
  3. apiPrivate = new QComboBox();
  4. // items: codeList
  5. codeList->addItem("PHP", "php");
  6. codeList->addItem("JavaScript", "javascript");
  7. // end of items for codeList
  8. //items: dataExp
  9. dataExp->addItem("Never delete", "N");
  10. dataExp->addItem("10 Minutes", "10M");
  11. dataExp->addItem("1 Hour", "1H");
  12. dataExp->addItem("1 Day", "1D");
  13. dataExp->addItem("1 Month", "1M");
  14. // end of items for dataExp
  15. // items: apiPrivate
  16. apiPrivate->addItem("Public", "0");
  17. apiPrivate->addItem("Private", "1");
  18. // end of items for apiPrivate
To copy to clipboard, switch view to plain text mode 
My question: now to get value from selected item?
I try that:
Qt Code:
  1. private_stat = apiPrivate->itemText(apiPrivate->currentIndex());
  2. prog_lang = codeList->itemText(codeList->currentIndex());
  3. date_expire = dataExp->itemText(dataExp->currentIndex());
To copy to clipboard, switch view to plain text mode 
But returned default value
Tell me, what to do?