Given an enum:
enum AnEnum { Foo, Bar, Bash, Baz };
Can you iterate over each of these enums using Qt’s foreach loop?
This code doesn’t compile (not that I expected it to…)
foreach(AnEnum enum, AnEnum)
{
// do nothing
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If it is moced into a QMetaEnum than you can iterate over it like this:
http://qt-project.org/doc/qt-4.8/qmetaenum.html
Example using QNetworkReply which is a QMetaEnum: