Results 1 to 11 of 11

Thread: Simple C++ question -- Creating a QPoint object

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Simple C++ question -- Creating a QPoint object

    This is not correct
    Qt Code:
    1. QPoint windowPos = new QPoint(0, 0);
    To copy to clipboard, switch view to plain text mode 

    You create and object that is supposed to be on stack as if it were an object to be on heap. Don't mix these things.

    Do it this way
    Qt Code:
    1. QPoint *windowPos = new QPoint(0, 0);
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. QPoint windowPos(0, 0);
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

  2. The following user says thank you to lyuts for this useful post:

    N3wb (17th September 2009)

Similar Threads

  1. Simple namespace question
    By JPNaude in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2009, 09:31
  2. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  3. Sending simple object via udp...with a twist
    By the scribe in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2007, 10:16
  4. Creating object of other class in Run() method
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 15:05
  5. Creating simple text editor from the eamples code
    By overcast in forum Qt Programming
    Replies: 4
    Last Post: 14th February 2007, 15:46

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.