Results 1 to 3 of 3

Thread: Can I paint on Qt widget by invoking win32 sdk api?

  1. #1

    Default Can I paint on Qt widget by invoking win32 sdk api?

    Can I paint on Qt widget by invoking win32 sdk api?
    The code is below, it seems that do not work.
    I want to implement such function for some special aim.

    Qt Code:
    1. PAINTSTRUCT ps;
    2. HWND hwnd = (HWND)winId();
    3. HDC hdc = BeginPaint(hwnd,&ps);
    4. ::MoveToEx(hdc, 0, 0, NULL);
    5. bool stat = ::LineTo(hdc, 500, 500);
    6. EndPaint(hwnd,&ps);
    To copy to clipboard, switch view to plain text mode 

    The codes are all in function paintEvent.
    Last edited by jpn; 24th March 2008 at 10:45. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can I paint on Qt widget by invoking win32 sdk api?

    I'm not sure but think this is possible. If I remember correctly I once drew using X libs on Linux (not sure even about the Qt version I used then), so likewise this might also be possible on Windows. Where is the referred code placed in the class and are you sure it didn't work{Ok, got it now}, I meant Qt might have drawn something on it afterwards.

  3. #3

    Default Re: Can I paint on Qt widget by invoking win32 sdk api?

    Quote Originally Posted by yogeshm02 View Post
    I'm not sure but think this is possible. If I remember correctly I once drew using X libs on Linux (not sure even about the Qt version I used then), so likewise this might also be possible on Windows. Where is the referred code placed in the class and are you sure it didn't work{Ok, got it now}, I meant Qt might have drawn something on it afterwards.
    The codes are placed in function paintEvent.

Similar Threads

  1. Drawing a widget in QItemDelegate's paint method
    By darkadept in forum Qt Programming
    Replies: 17
    Last Post: 11th August 2009, 05:15
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. Invoking QT Docking widget from MFC MDI application
    By Vikram in forum Qt Programming
    Replies: 1
    Last Post: 7th July 2007, 18:26
  4. paint central widget of a QMainWindow???
    By Shuchi Agrawal in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 08:02

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.