Results 1 to 8 of 8

Thread: QApplication::desktop() incomplete type

  1. #1
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QApplication::desktop() incomplete type

    I've done a new step - move to QT4

    i try to port some old test apps and the next line of code:
    Qt Code:
    1. width=QApplication::desktop()->width();
    To copy to clipboard, switch view to plain text mode 
    returns error while compiling
    Qt Code:
    1. error: invalid use of incomplete type ‘struct QDesktopWidget’
    To copy to clipboard, switch view to plain text mode 

    i haven't noticed any diff between Qt3 and Qt4 docs.

  2. #2
    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: QApplication::desktop() incomplete type

    did you include QDesktopWidget.h ?
    I'm a rebel in the S.D.G.

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

    codebehind (18th August 2008)

  4. #3
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication::desktop() incomplete type

    No. thanks. it works.

    I don't really understand why?
    I'm using QApplication and its function. I thought it was enough to include QApplication?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication::desktop() incomplete type

    Quote Originally Posted by codebehind View Post
    I'm using QApplication and its function. I thought it was enough to include QApplication?
    Read a bit about forward declarations.

    http://www.parashift.com/c++-faq-lit...html#faq-39.11

  6. #5
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication::desktop() incomplete type

    thanks for the link jacek. It makes things a little more clear but still does not explain me why I could compile this code with qt3 and with qt4 i couldn't?
    i've looked in qapplication.h and there is no forward declaration.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication::desktop() incomplete type

    Quote Originally Posted by codebehind View Post
    why I could compile this code with qt3 and with qt4 i couldn't?
    Because Qt4 sources are organised differently. Now the compiler must read QDesktopWidget code only when you really use it.

    Quote Originally Posted by codebehind View Post
    i've looked in qapplication.h and there is no forward declaration.
    Check again. Look near QT_MODULE macro.

  8. #7
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication::desktop() incomplete type

    Check again. Look near QT_MODULE macro.
    sorry. i was thinking about qt3 - qapplication.h

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication::desktop() incomplete type

    Quote Originally Posted by codebehind View Post
    i was thinking about qt3 - qapplication.h
    In that case everything is OK. That's the difference between Qt3 and Qt4 --- Qt4 uses forward declaration.

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 14:43
  2. Template classes and abstraction of type
    By Raistlin in forum General Programming
    Replies: 15
    Last Post: 1st April 2008, 11:18
  3. Make error with Qt Jambi 4.3.2_01
    By pamalite in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd November 2007, 13:05
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 20th July 2007, 00:38
  5. Replies: 3
    Last Post: 4th August 2006, 13:05

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.