[Qt-interest] Acquiring device context in Qt

Manish Chaturvedi manish_chaturvedi at persistent.co.in
Fri Jun 12 14:29:31 CEST 2009


Hi All,

I am trying to have Qt equivalent for MFC code i.e.

HICON   m_hIconCursor;

void MyClass::OnPaint()
{
      CPaintDC dc(this);

      CRect rClient;
      GetClientRect(rClient);

      dc.FillSolidRect(rClient, RGB(255,255,255));

      // Draw the cursor
      dc.DrawIcon(0, 0, m_hIconCursor);
}

I've written QT equavalent OnPaint() event like this:

QCursor   m_hIconCursor;

void MyClass::OnPaintEvent(QPaintEvent* event)
{
      QPainter p(this);

      QRect rect = geometry();

      p.drawRect(rect);

//Don't see any API of QPainter to draw the QCurser. ?? any one has idea how to do this..
      // Draw the cursor

      //dc.DrawIcon(0, 0, m_hIconCursor);
}

Let me know if it is right to use QPainter for  CPaintDC.if not, what could be the possible replacement of it in Qt4.3.4. I cannot see any API of QPainter which will allow me to paint the curser on the window.
Does any body has any clue how to implement this? Any help will be apprietiated.

PS: I am implementing this on Mac.
Thanks in advance!
Manish


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090612/b58560d5/attachment.html 


More information about the Qt-interest-old mailing list