"QT5 Development and examples" 15. Implement a simple text editor 4

Source: Internet
Author: User

Mirroring the image function

Other specific code bases look ahead: http://blog.csdn.net/cutter_point/article/details/42839071

Slot function:
  void Showmirrorvertical ();    Vertical mirror  void showmirrorhorizontal ();    Horizontal mirroring

The corresponding response connection
  Implementation of image Mirroring action  //portrait  mirrorverticalaction = new Qaction (Qicon ("Mirrorvertical.png"), tr ("Mirrorvertical"), this );  Mirrorverticalaction->setstatustip (TR ("mirrorvertical the Image");  Connect (mirrorverticalaction, SIGNAL (triggered ()), this, SLOT (Showmirrorvertical ()));  Transverse  mirrorhorizontalaction = new Qaction (Qicon ("Mirrorhorizontal.png"), tr ("Mirrorhorizontal"), this);  Mirrorhorizontalaction->setstatustip (TR ("Mirrorhorizontal the Image");  Connect (mirrorhorizontalaction, SIGNAL (triggered ()), this, SLOT (Showmirrorhorizontal ()));

The implementation of the slot function:
Horizontal mirror void imageprocessor::showmirrorvertical () {  if (Img.isnull ())    return;  img = Img.mirrored (true, false);    Horizontal mirroring  Showwidget->imagelabel->setpixmap (Qpixmap::fromimage (IMG));} Vertical mirror void imageprocessor::showmirrorvertical () {  if (Img.isnull ())    return;  img = img.mirrored (false, true);    Vertical Mirror  showwidget->imagelabel->setpixmap (Qpixmap::fromimage (IMG));}

Operation Result:


Well, do not know what happened, the picture can not get up, then save it, anyway is vertical is upside down, horizontal is the effect of horizontal transverse shift!!! ,




















"QT5 Development and examples" 15. Implement a simple text editor 4

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.