Hello Everyone

I'm writing a simple Active-x program, and I have this problem
if I hard code the values like this the program works

Qt Code:
  1. QAxWidget * activeX;
  2. activeX = new QAxWidget(this);
  3. activeX->setControl("{DE625294-70E6-45ED-B895-CFFA13AEB044}" );
  4.  
  5. activeX->setProperty("AutoStart", "1");
  6. activeX->setProperty("NetworkTimeout", "25000");
  7. activeX->setProperty("EnableReconnect", "true");
  8. activeX->setProperty("EnableContextMenu", "true");
  9. activeX->setProperty("ToolbarConfiguration", "default,-mute,-volume");
  10. activeX->setProperty("MediaType", "auto-sense");
  11. activeX->setProperty("MediaURL", "http://www.dyndns.org:8101/mjpg/1/video.mjpg?camera=1&resolution=320x240&compression=30&des_fps=30");
  12. activeX->setProperty("UIMode", "none");
  13. activeX->setProperty("ToolbarConfiguration", "default,-mute,-volume");
  14. activeX->setProperty("StretchToFit", "1");
To copy to clipboard, switch view to plain text mode 

The above code works fine, but if I do it like this, it wont

Qt Code:
  1. QHash<QString, QString> hash;
  2.  
  3. hash.insert("AutoStart", "1");
  4. hash.insert("NetworkTimeout", "25000");
  5. hash.insert("DisplayMessages", "true");
  6. hash.insert("EnableReconnect", "true");
  7. hash.insert("EnableContextMenu", "true");
  8. hash.insert("ToolbarConfiguration", "default,-mute,-volume");
  9. hash.insert("MediaType", "auto-sense");
  10. hash.insert("MediaURL", "http://www.dyndns.org:8101/mjpg/1/video.mjpg?camera=1&resolution=320x240&compression=30&des_fps=30");
  11. hash.insert("UIMode", "none");
  12. hash.insert("ToolbarConfiguration", "default,-mute,-volume");
  13. hash.insert("StretchToFit", "1");
  14.  
  15. QHash<QString, QString>::const_iterator i = hash.constBegin();
  16.  
  17. QAxWidget * activeX;
  18. activeX = new QAxWidget(this);
  19. activeX->setControl("{DE625294-70E6-45ED-B895-CFFA13AEB044}" );
  20.  
  21. while ( i != hash.constEnd() )
  22. {
  23. QString str = i.key();
  24. const char* cstr = str.toStdString().c_str();
  25. QString value = i.value();
  26.  
  27. activeX->setProperty(cstr, value );
  28. ++i;
  29. }
To copy to clipboard, switch view to plain text mode 

I need the 2nd way because I will be inserting different parameters at different times

please let me know what you think what could the problem be?