Results 1 to 3 of 3

Thread: QPixmap::graWidget always getting null!

  1. #1
    Join Date
    Jan 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPixmap::graWidget always getting null!

    Hello I have some widgets that I need to save into a img, but I had some problems even before in the pixmap.
    The widget is a QCalendarWidget derived class, but after had problems I tried doing this:
    Qt Code:
    1. QPixmap pix;
    2. pix.grabWidget(c);
    3. if(pix.isNull()) qDebug("fail")
    To copy to clipboard, switch view to plain text mode 

    Myclass and even QCalendarWIdget, QWidget, etc.. always fail
    I need to do something else inside the widget class to grab it? (I am not calling it graWidget on the paintEvent() )

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPixmap::graWidget always getting null!

    grabWidget() is a static function, so you have to call it like that:
    Qt Code:
    1. pix = QPixmap::grabWidget(c);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap::graWidget always getting null!

    yeah it really was this thanks!

Similar Threads

  1. QPixmap is null on other machines
    By sepehr in forum Installation and Deployment
    Replies: 6
    Last Post: 12th July 2011, 07:24
  2. QPixmap seems to be null but it isn't
    By satoshi in forum Qt Programming
    Replies: 7
    Last Post: 8th May 2009, 09:23
  3. Replies: 4
    Last Post: 28th August 2008, 13:13
  4. Replies: 1
    Last Post: 21st August 2008, 07:44
  5. Replies: 5
    Last Post: 9th April 2007, 14:26

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.