Results 1 to 3 of 3

Thread: sintax

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default sintax

    hello guys; Can anyone learn me what is the "#if 1, #else, #endif" meant? Thanks
    Qt Code:
    1. void myLabel::mousePressEvent(QMouseEvent* e) {
    2. printf("press\n");
    3. QDragObject *drobj;
    4. if ( pixmap() ) {
    5. drobj = new QImageDrag( pixmap()->convertToImage(), this );
    6. #if 1
    7. QPixmap pm;
    8. pm.convertFromImage(pixmap()->convertToImage().smoothScale(
    9. pixmap()->width()/3,pixmap()->height()/3));
    10. drobj->setPixmap(pm,QPoint(-5,-7));
    11. #else
    12. // Try it.
    13. (void)new DragMoviePlayer(drobj);
    14. #endif
    15. } else {
    16. drobj = new QTextDrag( text(), this );
    17. }
    18. drobj->dragCopy();
    19. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by mickey; 26th May 2006 at 18:35.
    Regards

  2. #2
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: sintax

    Those are precompiler constructs. The compiler checks the condition (which, I think, is always true in this case) and decides which code to parse and compile.

    I don't understand why they're there, though. They don't seem to do anything useful.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: sintax

    sorry, I modified it; now, I'll know where it is!
    Regards

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.