Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: Overlay

  1. #21
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 42 Times in 37 Posts

    Default Re: Overlay

    Quote Originally Posted by ToddAtWSU
    I am not sure why putting the * in front helps.
    It helps because you are now giving it the argument type that it is expecting rather than the argument type that it is not expecting.

    To me that turns the pointer into a pointer to a pointer
    No, that de-references the pointer. See any docs on C/C++ to see the meaning of the '*' operator.

    I thought the function wanted my argument de-referenced, but I guess not.
    The function wants a reference to a QPixmap object, nothing more. Whether that means de-referencing your variable depends on what kind of object you are dealing with, a QPixmap or a 'pointer to QPixmap'. The following should show you how to correctly deal with both cases.

    Example 1 - QPixmap allocated on the stack.
    Qt Code:
    1. mOverlay = QPixmap( 561, 351 );
    2. ...
    3. mpVideoPainter->drawPixmap( target, mOverlay, source );
    To copy to clipboard, switch view to plain text mode 

    Example 2 - QPixmap allocated on the heap.
    Qt Code:
    1. mpOverlay = new QPixmap( 561, 351 );
    2. ...
    3. mpVideoPainter->drawPixmap( target, *mpOverlay, source );
    To copy to clipboard, switch view to plain text mode 
    Last edited by Chicken Blood Machine; 22nd May 2006 at 23:02.
    Save yourself some pain. Learn C++ before learning Qt.

  2. #22
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 8 Times in 4 Posts

    Default Re: Overlay

    I don't know what I was thinking, must have been having a brain freeze at that point. I have been working with C/C++ for 4+ years now, but for some reason I was thinking the & and the * were backwards when I was working on that. Probably too much programming and not enough sunlight.

Similar Threads

  1. QtWidget in Overlay Planes on Windows OpenGL
    By IVTdeveloper in forum Qt Programming
    Replies: 2
    Last Post: 20th August 2008, 12:00
  2. QGLWidget with overlay
    By pandora-qt in forum Qt Programming
    Replies: 0
    Last Post: 29th February 2008, 11:44
  3. QScrollView Overlay
    By EricTheFruitbat in forum Qt Programming
    Replies: 5
    Last Post: 27th December 2006, 10:29
  4. Adding Rectangular overlay on graphics view
    By forrestfsu in forum Qt Programming
    Replies: 10
    Last Post: 21st November 2006, 20:42
  5. Pixmap Overlay
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 22nd June 2006, 21:19

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.