Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Programs Using QT
Qt 6.11 is out! See what's new in the release blog

Programs Using QT

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kranti.reddy2001
    wrote on last edited by
    #1

    I have post some of the programs using QT framework.
    Please go through the posts and give your feed back.
    http://www.boostprogramming.com/forum/index.php/board,178.0.html

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I've browsed roughly through some of the examples and my overall impression is that they complicate things unnecessarily.

      For example the hello world program:
      @
      QApplication a(argc, argv);
      boost::shared_ptr < QLabel > QLabelPtr ( new QLabel("<h2>Hello ""<font color=red>World!</font></h2>") ) ;
      QLabelPtr ->show () ;
      return a.exec();
      @
      I mean - what is the point here?
      Why another giant library (boost) just for the shared_ptr when there's QSharedPointer already in Qt?
      Why a pointer at all?
      In case of hello world this would be a lot easier:
      @
      QApplication a(argc, argv);
      QLabel label("<h2>Hello <font color=red>World!</font></h2>") ;
      label.show () ;
      return a.exec();
      @

      Another example:
      @
      if ( daysRemaining == 0 )
      {
      std::cout << d2.toString().toStdString() << " is Monday " << std::endl;
      }
      else if ( daysRemaining == 1 )
      {
      std::cout << d2.toString().toStdString() << " is Tuesday " << std::endl;
      }
      else if ( daysRemaining == 2 )
      {
      ...
      @
      This is terrible! Why not simply:
      @
      QVector days;
      days << "Monday" << "Tuesday" << ...
      std::cout << ... << days[daysRemaining] << ...
      @

      One more:
      @
      QList<QString> list ;
      list.push_back ("Kranthi");
      list.push_back ("Kumar");
      list.push_back ("Reddy");
      QList<QString>::const_iterator listIter = list.begin();
      while (listIter != list.end() )
      {
      std::cout << listIter->toStdString().c_str() << std::endl;
      listIter ++ ;
      }
      @
      Again this can be greatly simplified:
      @
      QList<string> list ;
      list << "Kranthi" << "Kumar" << ...
      foreach(const string& s, list)
      cout << s.c_str() << endl;
      @
      Or even:
      @
      QStringList list;
      list << "Kranthi" << "Kumar" << ...
      qDebug() << list;
      @
      There are lots and lots of things like that. I just don't have time to look at them all but I'm afraid they mostly need a rewrite.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kranti.reddy2001
        wrote on last edited by
        #3

        Implement the second review comment.
        http://www.boostprogramming.com/forum/index.php/topic,216.0.html

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved