Qt -- change the Mouse shape, Qt -- the Mouse shape

Source: Internet
Author: User

Qt -- change the Mouse shape, Qt -- the Mouse shape

To change the shape of the mouse, it is useful when drawing the coordinate system. Please note:

1 this-> setMouseTracking (true); // set to trigger moveEvent 2 void mouseMoveEvent (QMouseEvent * event) 3 {4 QPoint mousepos = event () without pressing the mouse key () -> pos (); 5 6 // in coordinates (0 ~ Width, 0 ~ Height) changes the Mouse shape within the range of 7 if (mousepos. rx ()> 0 8 & mousepos. rx () <width 9 & mousepos. ry ()> 010 & mousepos. ry () 

 

 

Enumerated values corresponding to the Mouse shape:

Qt: ArrowCursor

Qt: UpArrowCursor

Qt: CrossCursor

Qt: IBeamCursor

Qt: WaitCursor

Qt: BusyCursor

Qt: ForbiddenCursor

Qt: PointingHandCursor

Qt: WhatsThisCursor

Qt: SizeVerCursor

Qt: SizeHorCursor

Qt: SizeBDiagCursor

Qt: SizeFDiagCursor

Qt: SizeAllCursor

Qt: SplitVCursor

Qt: SplitHCursor

Qt: OpenHandCursor

Qt: ClosedHandCursor

Qt: BlankCursor

 

You can also customize the Mouse shape:

1 Qcurosr * myCursor = new QCursor (QPixmap (":/images/custom.png"),-1,-1); //-1, -1 indicates that the hotspot is located in the image Center 2 this-> setCursor (* myCursor );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.