Results 1 to 3 of 3

Thread: Is QMousePress in an area?

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

    Default Is QMousePress in an area?

    Hey,

    I've a problem:

    I want to specificy a area, like a ellipse and I want to check, wether the mousepress(event) is in this area.

    For Example:

    Ellipse: 20, 20, 10, 10 and now I want to check, if the mousepositions are in this ellipse.

    Thanks in advance.


    nearlyNERD

  2. #2
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is QMousePress in an area?


  3. #3
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is QMousePress in an area?

    Qt Code:
    1. QRect rect(10,10,100,100);
    2. QPoint p(11,11);
    3. if(rect.contains(p))
    4. {
    5. qDebug()<<"Inside bounding box";
    6. if (QRegion(rect, QRegion::Ellipse).contains(p))
    7. qDebug()<<"Inside ellipse";
    8. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Desktop area in MAC
    By jay in forum Qt Programming
    Replies: 0
    Last Post: 4th March 2010, 03:42
  2. About QScroll Area
    By franco.amato in forum Qt Programming
    Replies: 16
    Last Post: 26th January 2010, 22:59
  3. Area that can be stretched
    By pippo42 in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2010, 08:46
  4. Qt From Without Title area
    By nleverin in forum Newbie
    Replies: 3
    Last Post: 7th March 2008, 06:45
  5. select a particular area
    By vishesh in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 21:44

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.