Basic idea: Suppose A is the main window and B is a child window. A on or off, the a window first, and then the picture is full of the whole b window, in the PaintEvent to dynamically zoom or enlarge the drawing. Finally, using animation, the b window is animated to open or close, after the animation has finished, B sends a signal to a, a, a display.
The core code is sent:
In a window:
Qpixmap Pixmap;
Ctestdialog Dlg (this);
Dlg. Setpixmap (Pixmap.grabwidget (this));
Hide ();
Dlg.exec ();
b window:
Ctestdialog::ctestdialog (Qwidget *pparent): Qdialog (pparent)
{
UI.SETUPUI (this);
Setwindowflags (Qt::D ialog | Qt::framelesswindowhint);
}
Ctestdialog::~ctestdialog ()
{
}
void Ctestdialog::setpixmap (const qpixmap &PIXMAP)
{
M_backpixmap = Pixmap;
M_image = Pixmap.toimage ();
Update ();
Qdesktopwidget *desktopwidget = qapplication::d esktop ();
Qrect screenrect = Desktopwidget->screengeometry ();
Qpropertyanimation *animation = new Qpropertyanimation (This, "geometry");
Animation->setduration (2200);
Animation->seteasingcurve (qeasingcurve::outbounce);
Animation->setstartvalue (Qrect ((Screenrect.width ())/2, (Screenrect.height ()-50)/2, 50, 50));
Animation->setendvalue (Qrect ((Screenrect.width ()-$)/2, (Screenrect.height ()-400)/2, 500, 400));
Animation->start ();
}
void Ctestdialog::p aintevent (qpaintevent *p)
{
Qpalette Pal (palette ());
Pal.setbrush (Qpalette::window, Qbrush (m_image.scaled (This->size (), Qt::ignoreaspectratio, Qt:: (smoothtransformation)));
SetPalette (PAL);
}
http://blog.csdn.net/itjobtxq/article/details/9663757
QT Implementation window zoom open and close (overlapping window, too interesting)