Results 1 to 4 of 4

Thread: Strange behavior of Q_DECLARE_PRIVATE_D() macro

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2015
    Posts
    41
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Strange behavior of Q_DECLARE_PRIVATE_D() macro

    Hi, I found strange behavior of Q_DECLARE_PRIVATE_D macro

    For example when i declare:
    Qt Code:
    1. QScopedPointer<MetaDataPrivate> d_ptr;
    2. Q_DECLARE_PRIVATE(MetaData)
    To copy to clipboard, switch view to plain text mode 

    then it works fine but when I try use Q_DECLARE_PRIVATE_D macro with second parameter for name of my pointer
    Qt Code:
    1. QScopedPointer<MetaDataPrivate> d;
    2. Q_DECLARE_PRIVATE_D(d, MetaData)
    To copy to clipboard, switch view to plain text mode 

    I get error:
    error: invalid cast from type 'QScopedPointer<MetaDataPrivate>' to type 'MetaDataPrivate*'
    Maybe someone know what I am doing wrong here? How I can use Q_DECLARE_PRIVATE_D with my name of pointer.

    Regards,

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Strange behavior of Q_DECLARE_PRIVATE_D() macro

    maybe
    Qt Code:
    1. QScopedPointer<MetaDataPrivate> d;
    2. Q_DECLARE_PRIVATE_D(d.data(), MetaData)
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. strange behavior of qt 5.4
    By gisac in forum Qt Programming
    Replies: 4
    Last Post: 26th December 2015, 21:32
  2. QLCDNumber strange behavior!
    By saman_artorious in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2013, 13:08
  3. setCellWidget - strange behavior
    By Archa4 in forum Newbie
    Replies: 5
    Last Post: 28th April 2011, 08:26
  4. QAudioInput example strange behavior
    By m15ch4 in forum Qt Programming
    Replies: 0
    Last Post: 13th August 2010, 06:55
  5. Strange behavior of QSyntaxHighlighter in Qt3
    By lorebett in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2009, 14:50

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.