Results 1 to 3 of 3

Thread: Proper way of testing whether Qt is being used by a program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    11 N 78 E
    Posts
    110
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Proper way of testing whether Qt is being used by a program

    I have a small library which I would like to be used with both Qt and non-Qt programs. Basically I want to use QList if the calling program will be using Qt anyway, else I want to use std::list. So I am thinking of using #define-s like:

    Qt Code:
    1. #ifdef QT_VERSION
    2. #define MYLIST QList
    3. #else
    4. #include <list>
    5. #define MYLIST std::list
    6. #endif
    To copy to clipboard, switch view to plain text mode 

    ... and then use MYLIST throughout my code. I think it is safe to assume for practical purposes that if QT_VERSION is defined, Qt is being used? Is this OK? I want to know what is the accepted/conventional of testing whether Qt is being used.

    In relation, if a program uses Qt, does it mean it also uses std::list anyway? I'm asking since QList seems to have facilities to convert to and from std::list which may not be possible if std::list is not used somewhere inside Qt?
    Last edited by jamadagni; 10th August 2012 at 07:49. Reason: missing [code] tags
    Penguin #395953 using Qt for open-source development on X11 using C++ and
    Python via PyQt

Similar Threads

  1. Testing Qt-Software with a GUI Testing Tool
    By nightghost in forum Qt Programming
    Replies: 8
    Last Post: 22nd February 2012, 07:43
  2. Proper way to use qmake and moc?
    By mossen in forum Newbie
    Replies: 1
    Last Post: 6th May 2011, 02:52
  3. Replies: 2
    Last Post: 9th December 2010, 14:11
  4. Replies: 5
    Last Post: 29th October 2007, 22:49
  5. Proper way to #include Qt?
    By pherthyl in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2006, 02:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.