Results 1 to 4 of 4

Thread: Syntax confusion

  1. #1
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Syntax confusion

    Hi,

    I have a syntax confusion with QList variable. I would like to ask you for the confirmation. My code is

    Qt Code:
    1. VlcInstance::VlcInstance ( const QList< const char * > & args, QObject * parent = NULL) // Function syntax to pass my arguments.
    2.  
    3. const QList<const char *> *args = new QList<const char *>();
    4. //preparation of the vlc command
    5. const char* vlc_args[] = {"-I", "dummy"};
    6. args->append(vlc_args);
    7. VlcInstance(args, this); // I believe that I am passing pointer argument value which is the address
    To copy to clipboard, switch view to plain text mode 

    Though I have understanding with pointers, I am still confused as it has many pointers. I would really appreciate the correction with little bit of explanation. for future understanding.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Syntax confusion

    First don't create the list through a pointer, especially that the VlcInstance requires an object and not a pointer to an object. Second of all is the idea of storing const char * items in the list your own? If so, change it asap to QString (which would make the whole parameter QStringList instead of QList<const char *>) or std::string.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Syntax confusion

    is the idea of storing const char * items in the list your own?
    No its not my idea. It was the class function defined in an external library which I downlaoded and linked to my project. So, can you correct me at passing const char* into List syntax If I am wrong.
    Last edited by baluk; 11th December 2010 at 15:35.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Syntax confusion

    I already did, see the first sentence of my post.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Regarding syntax
    By Yayati.Ekbote in forum Qt Programming
    Replies: 3
    Last Post: 27th January 2010, 14:15
  2. Odd Syntax
    By acxdotfm in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2008, 20:23
  3. StyleSheet syntax checking
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 30th June 2008, 10:09
  4. QPaintEvent syntax question
    By last2kn0 in forum Newbie
    Replies: 5
    Last Post: 25th January 2008, 20:36
  5. Refreshing syntax highlighting
    By jpn in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2006, 20:09

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.