demos/affine/xform.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the demonstration applications of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #include "xform.h"
00025 #include "hoverpoints.h"
00026 
00027 #include <QLayout>
00028 #include <QPainter>
00029 #include <QPainterPath>
00030 
00031 const int alpha = 155;
00032 
00033 XFormView::XFormView(QWidget *parent)
00034     : ArthurFrame(parent)
00035 {
00036     setAttribute(Qt::WA_MouseTracking);
00037     type = VectorType;
00038     m_rotation = 0.0;
00039     m_scale = 1.0;
00040     m_shear = 0.0;
00041 
00042     pixmap = QPixmap(":/res/bg1.jpg");
00043     pts = new HoverPoints(this, HoverPoints::CircleShape);
00044     pts->setConnectionType(HoverPoints::LineConnection);
00045     pts->setEditable(false);
00046     pts->setPointSize(QSize(15, 15));
00047     pts->setShapeBrush(QBrush(QColor(151, 0, 0, alpha)));
00048     pts->setShapePen(QPen(QColor(255, 100, 50, alpha)));
00049     pts->setConnectionPen(QPen(QColor(151, 0, 0, 50)));
00050     pts->setBoundingRect(QRectF(0, 0, 500, 500));
00051     ctrlPoints << QPointF(250, 250) << QPointF(350, 250);
00052     pts->setPoints(ctrlPoints);
00053     connect(pts, SIGNAL(pointsChanged(const QPolygonF&)),
00054             this, SLOT(updateCtrlPoints(const QPolygonF &)));
00055     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
00056 }
00057 
00058 void XFormView::mousePressEvent(QMouseEvent *)
00059 {
00060     setDescriptionEnabled(false);
00061 }
00062 
00063 void XFormView::resizeEvent(QResizeEvent *e)
00064 {
00065     pts->setBoundingRect(rect());
00066     ArthurFrame::resizeEvent(e);
00067 }
00068 
00069 void XFormView::paint(QPainter *p)
00070 {
00071     p->save();
00072     p->setRenderHint(QPainter::Antialiasing);
00073     p->setRenderHint(QPainter::SmoothPixmapTransform);
00074     switch (type) {
00075     case VectorType:
00076         drawVectorType(p);
00077         break;
00078     case PixmapType:
00079         drawPixmapType(p);
00080         break;
00081     case TextType:
00082         drawTextType(p);
00083         break;
00084     }
00085     p->restore();
00086 }
00087 
00088 void XFormView::updateCtrlPoints(const QPolygonF &points)
00089 {
00090     QPointF trans = points.at(0) - ctrlPoints.at(0);
00091 
00092     if (qAbs(points.at(0).x() - points.at(1).x()) < 10
00093         && qAbs(points.at(0).y() - points.at(1).y()) < 10)
00094         pts->setPoints(ctrlPoints);
00095     if (!trans.isNull()) {
00096         ctrlPoints[0] = points.at(0);
00097         ctrlPoints[1] += trans;
00098         pts->setPoints(ctrlPoints);
00099     }
00100     ctrlPoints = points;
00101 
00102     QLineF line(ctrlPoints.at(0), ctrlPoints.at(1));
00103     m_rotation = line.angle(QLineF(0, 0, 1, 0));
00104     if (line.dy() < 0)
00105         m_rotation = 360 - m_rotation;
00106 
00107     if (trans.isNull())
00108         emit rotationChanged(int(m_rotation*10));
00109 }
00110 
00111 void XFormView::setVectorType()
00112 {
00113     type = VectorType;
00114     update();
00115 }
00116 
00117 void XFormView::setPixmapType()
00118 {
00119     type = PixmapType;
00120     update();
00121 }
00122 
00123 void XFormView::setTextType()
00124 {
00125     type = TextType;
00126     update();
00127 }
00128 
00129 void XFormView::setAnimation(bool animate)
00130 {
00131     timer.stop();
00132     if (animate)
00133         timer.start(25, this);
00134 }
00135 
00136 void XFormView::changeRotation(int r)
00137 {
00138     setRotation(double(r)/10.0);
00139 }
00140 
00141 void XFormView::changeScale(int s)
00142 {
00143     setScale(double(s)/1000.0);
00144 }
00145 
00146 void XFormView::changeShear(int s)
00147 {
00148     setShear(double(s)/1000.0);
00149 }
00150 
00151 void XFormView::setShear(double s)
00152 {
00153     m_shear = s;
00154     update();
00155 }
00156 
00157 void XFormView::setScale(double s)
00158 {
00159     m_scale = s;
00160     update();
00161 }
00162 
00163 void XFormView::setRotation(double r)
00164 {
00165     double old_rot = m_rotation;
00166     m_rotation = r;
00167 
00168     QPointF center(pts->points().at(0));
00169     QMatrix m;
00170     m.translate(center.x(), center.y());
00171     m.rotate(m_rotation - old_rot);
00172     m.translate(-center.x(), -center.y());
00173     pts->setPoints(pts->points() * m);
00174 
00175     update();
00176 }
00177 
00178 void XFormView::timerEvent(QTimerEvent *e)
00179 {
00180     if (e->timerId() == timer.timerId()) {
00181         QPointF center(pts->points().at(0));
00182         QMatrix m;
00183         m.translate(center.x(), center.y());
00184         m.rotate(0.2);
00185         m.translate(-center.x(), -center.y());
00186         pts->setPoints(pts->points() * m);
00187 
00188         setUpdatesEnabled(false);
00189         static double scale_inc = 0.003;
00190         static double shear_inc = -0.001;
00191         emit scaleChanged(int((m_scale + scale_inc) * 1000));
00192         emit shearChanged(int((m_shear + shear_inc) * 1000));
00193         if (m_scale >= 4.0 || m_scale <= 0.1)
00194             scale_inc = -scale_inc;
00195         if (m_shear >= 1.0 || m_shear <= -1.0)
00196             shear_inc = -shear_inc;
00197         setUpdatesEnabled(true);
00198 
00199         pts->firePointChange();
00200     }
00201 }
00202 
00203 void XFormView::wheelEvent(QWheelEvent *e)
00204 {
00205     m_scale += e->delta()/600.0;
00206     m_scale = qMax(.1, qMin(4.0, m_scale));
00207     emit scaleChanged(int(m_scale*1000));
00208 }
00209 
00210 void XFormView::reset()
00211 {
00212     emit rotationChanged(0);
00213     emit scaleChanged(1000);
00214     emit shearChanged(0);
00215     ctrlPoints = QPolygonF();
00216     ctrlPoints << QPointF(250, 250) << QPointF(350, 250);
00217     pts->setPoints(ctrlPoints);
00218     pts->firePointChange();
00219 }
00220 
00221 void XFormView::drawPixmapType(QPainter *painter)
00222 {
00223     QPointF center(pixmap.width()/2.0, pixmap.height()/2.0);
00224     painter->translate(ctrlPoints.at(0) - center);
00225 
00226     painter->translate(center);
00227     painter->rotate(m_rotation);
00228     painter->scale(m_scale, m_scale);
00229     painter->shear(0, m_shear);
00230     painter->translate(-center);
00231 
00232     painter->drawPixmap(QPointF(0, 0), pixmap);
00233     painter->setPen(QPen(QColor(255, 0, 0, alpha), 0.25, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin));
00234     painter->setBrush(Qt::NoBrush);
00235     painter->drawRect(QRectF(0, 0, pixmap.width(), pixmap.height()).adjusted(-2, -2, 2, 2));
00236 }
00237 
00238 void XFormView::drawTextType(QPainter *painter)
00239 {
00240     QPainterPath path;
00241     QFont f("times new roman,utopia");
00242     f.setStyleStrategy(QFont::ForceOutline);
00243     f.setPointSize(72);
00244     f.setStyleHint(QFont::Times);
00245     path.addText(0, 0, f, textEditor->text());
00246 
00247     QFontMetrics fm(f);
00248     QRectF br(fm.boundingRect(textEditor->text()));
00249     QPointF center(br.center());
00250     painter->translate(ctrlPoints.at(0) - center);
00251 
00252     painter->translate(center);
00253     painter->rotate(m_rotation);
00254     painter->scale(m_scale, m_scale);
00255     painter->shear(0, m_shear);
00256     painter->translate(-center);
00257 
00258     painter->fillPath(path, Qt::black);
00259 
00260     painter->setPen(QPen(QColor(255, 0, 0, alpha), 0.25, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin));
00261     painter->setBrush(Qt::NoBrush);
00262     painter->drawRect(br.adjusted(-1, -1, 1, 1));
00263 }
00264 
00265 void XFormView::drawVectorType(QPainter *painter)
00266 {
00267     QPainterPath path;
00268     painter->translate(ctrlPoints.at(0) - QPointF(250,250));
00269 
00270     painter->scale(0.77, 0.77);
00271     painter->translate(98.9154 + 30 , -217.691 - 20);
00272 
00273     QRect br(-55, 275, 500, 590);
00274     QPoint center = br.center();
00275     painter->translate(center.x(), center.y());
00276     painter->rotate(m_rotation);
00277     painter->scale(m_scale, m_scale);
00278     painter->shear(0, m_shear);
00279     painter->translate(-center.x(), -center.y());
00280 
00281     painter->setPen(Qt::NoPen);
00282     path.moveTo(120, 470);
00283     path.lineTo(60+245, 470);
00284     path.lineTo(60+245, 470+350);
00285     path.lineTo(60, 470+350);
00286     path.lineTo(60, 470+80);
00287 
00288     painter->setBrush(Qt::white);
00289     painter->drawPath(path);
00290     path = QPainterPath();
00291 
00292     painter->setBrush(QColor( 193, 193, 191, 255));
00293     path.moveTo(329.336, 727.552);
00294     path.cubicTo(QPointF(315.224, 726.328), QPointF(304.136, 715.816), QPointF(303.128, 694.936));
00295     path.cubicTo(QPointF(306.368, 639.496), QPointF(309.608, 582.112), QPointF(271.232, 545.104));
00296     path.cubicTo(QPointF(265.256, 499.024), QPointF(244.016, 482.104), QPointF(234.008, 452.512));
00297     path.lineTo(218.24, 441.208);
00298     path.lineTo(237.104, 411.688);
00299     path.lineTo(245.168, 411.904);
00300     path.lineTo(323.936, 571.168);
00301     path.lineTo(340.424, 651.448);
00302     path.closeSubpath();
00303     painter->drawPath(path);
00304     path = QPainterPath();
00305 
00306     painter->setBrush(QColor(193, 193, 191, 255));
00307     path.moveTo(136.232, 439.696);
00308     path.cubicTo(QPointF(133.856, 455.248), QPointF(132.56, 470.512), QPointF(134.792, 485.272));
00309     path.cubicTo(QPointF(118.376, 507.592), QPointF(105.92, 530.128), QPointF(104.48, 553.312));
00310     path.cubicTo(QPointF(92.024, 586.504), QPointF(62.432, 614.584), QPointF(67.544, 680.104));
00311     path.cubicTo(QPointF(84.176, 697.456), QPointF(107.432, 713.584), QPointF(127.376, 730.36));
00312     path.cubicTo(QPointF(152.432, 751.312), QPointF(137.528, 778.96), QPointF(102.248, 772.408));
00313     path.cubicTo(QPointF(94.4, 763.768), QPointF(76.616, 709.624), QPointF(42.92, 676.288));
00314     path.lineTo(49.544, 632.584);
00315     path.lineTo(81.368, 547.408);
00316     path.lineTo(120.968, 484.048);
00317     path.lineTo(125.36, 456.688);
00318     path.lineTo(119.816, 386.776);
00319     path.lineTo(124.424, 361.216);
00320     path.lineTo(136.232, 439.696);
00321     path.closeSubpath();
00322     painter->drawPath(path);
00323     path = QPainterPath();
00324 
00325     painter->setBrush(QColor(193, 193, 191, 255));
00326     path.moveTo(115.64, 341.416);
00327     path.cubicTo(QPointF(116.576, 336.376), QPointF(117.8, 331.624), QPointF(119.312, 327.16));
00328     path.lineTo(121.688, 342.784);
00329     path.closeSubpath();
00330     painter->drawPath(path);
00331     path = QPainterPath();
00332 
00333     painter->setBrush(QColor(193, 193, 191, 255));
00334     path.moveTo(120.968, 500.464);
00335     path.cubicTo(QPointF(108.368, 523.792), QPointF(103.976, 546.256), QPointF(132.92, 550.216));
00336     path.cubicTo(QPointF(117.008, 553.888), QPointF(97.208, 568.648), QPointF(77.192, 593.488));
00337     path.lineTo(77.624, 543.016);
00338     path.lineTo(101.456, 503.272);
00339     path.closeSubpath();
00340     painter->drawPath(path);
00341     path = QPainterPath();
00342 
00343     painter->setBrush(QColor(193, 193, 191, 255));
00344     path.moveTo(-33.256, 818.488);
00345     path.cubicTo(QPointF(10.52, 838.144), QPointF(41.408, 837.064), QPointF(69.272, 850.96));
00346     path.cubicTo(QPointF(91.304, 862.552), QPointF(113.552, 861.184), QPointF(126.944, 847.144));
00347     path.cubicTo(QPointF(138.32, 832.456), QPointF(146.744, 831.736), QPointF(163.52, 830.224));
00348     path.cubicTo(QPointF(190.952, 828.568), QPointF(217.736, 828.28), QPointF(241.928, 830.8));
00349     path.lineTo(269.576, 833.032);
00350     path.cubicTo(QPointF(269.072, 864.064), QPointF(328.04, 867.88), QPointF(345.392, 844.336));
00351     path.cubicTo(QPointF(366.344, 819.424), QPointF(395.144, 808.264), QPointF(419.84, 790.192));
00352     path.lineTo(289.304, 725.536);
00353     path.cubicTo(QPointF(255.824, 806.464), QPointF(131.048, 827.632), QPointF(113.768, 763.264));
00354     path.closeSubpath();
00355     painter->drawPath(path);
00356     path = QPainterPath();
00357 
00358     painter->setBrush(QColor(193, 193, 191, 255));
00359     path.moveTo(286.424, 711.568);
00360     path.cubicTo(QPointF(273.824, 711.496), QPointF(260.936, 715.6), QPointF(261.944, 732.16));
00361     path.lineTo(266.192, 776.44);
00362     path.lineTo(304.424, 756.64);
00363     path.closeSubpath();
00364     painter->drawPath(path);
00365     path = QPainterPath();
00366 
00367     painter->setBrush(QColor(0, 0, 0, 255));
00368     path.moveTo(-37.36, 821.224);
00369     path.cubicTo(QPointF(7.136, 840.88), QPointF(38.6, 839.728), QPointF(66.968, 853.696));
00370     path.cubicTo(QPointF(89.36, 865.216), QPointF(111.968, 863.92), QPointF(125.648, 849.808));
00371     path.cubicTo(QPointF(137.24, 835.192), QPointF(145.808, 834.472), QPointF(162.872, 832.96));
00372     path.cubicTo(QPointF(190.736, 831.232), QPointF(218.024, 831.016), QPointF(242.648, 833.464));
00373     path.lineTo(270.728, 835.768);
00374     path.cubicTo(QPointF(270.224, 866.8), QPointF(330.272, 870.544), QPointF(347.912, 847));
00375     path.cubicTo(QPointF(369.224, 822.088), QPointF(398.528, 811), QPointF(423.656, 792.856));
00376     path.lineTo(290.816, 728.272);
00377     path.cubicTo(QPointF(256.76, 809.128), QPointF(129.824, 830.296), QPointF(112.256, 766));
00378     path.closeSubpath();
00379     painter->drawPath(path);
00380     path = QPainterPath();
00381 
00382     painter->setBrush(QColor(183, 114, 0, 255));
00383     path.moveTo(382.328, 691.984);
00384     path.cubicTo(QPointF(403.64, 698.968), QPointF(389.888, 720.28), QPointF(400.76, 732.52));
00385     path.cubicTo(QPointF(405.44, 742.888), QPointF(415.304, 752.032), QPointF(431.792, 760.528));
00386     path.cubicTo(QPointF(459.368, 774.424), QPointF(426.248, 799.336), QPointF(392.768, 812.08));
00387     path.cubicTo(QPointF(351.944, 825.616), QPointF(344.024, 862.912), QPointF(299.312, 851.896));
00388     path.cubicTo(QPointF(283.112, 846.496), QPointF(278.36, 831.808), QPointF(278.864, 809.128));
00389     path.cubicTo(QPointF(284.264, 762.76), QPointF(277.784, 730.432), QPointF(278.792, 698.824));
00390     path.cubicTo(QPointF(278.72, 686.152), QPointF(283.544, 684.64), QPointF(307.232, 687.952));
00391     path.cubicTo(QPointF(310.04, 726.328), QPointF(352.376, 727.336), QPointF(382.328, 691.984));
00392     path.closeSubpath();
00393     painter->drawPath(path);
00394     path = QPainterPath();
00395 
00396     painter->setBrush(QColor(242, 183, 0, 255));
00397     path.moveTo(339.632, 826.624);
00398     path.cubicTo(QPointF(371.6, 814.312), QPointF(403.856, 798.112), QPointF(429.848, 782.128));
00399     path.cubicTo(QPointF(437.84, 777.448), QPointF(438.92, 765.928), QPointF(427.688, 762.328));
00400     path.cubicTo(QPointF(403.352, 748.504), QPointF(390.104, 731.224), QPointF(392.912, 708.76));
00401     path.cubicTo(QPointF(393.344, 700.912), QPointF(383.696, 692.56), QPointF(381.104, 700.048));
00402     path.cubicTo(QPointF(359.864, 771.472), QPointF(291.32, 767.656), QPointF(300.752, 696.952));
00403     path.cubicTo(QPointF(301.256, 694.864), QPointF(301.76, 692.776), QPointF(302.264, 690.76));
00404     path.cubicTo(QPointF(289.952, 688.24), QPointF(285.2, 690.976), QPointF(285.776, 700.408));
00405     path.lineTo(295.28, 806.608);
00406     path.cubicTo(QPointF(297.656, 830.8), QPointF(317.312, 836.128), QPointF(339.632, 826.624));
00407     path.closeSubpath();
00408     painter->drawPath(path);
00409     path = QPainterPath();
00410 
00411     painter->setBrush(QColor(0, 0, 0, 255));
00412     path.moveTo(354.464, 537.544);
00413     path.cubicTo(QPointF(379.16, 569.8), QPointF(404.432, 651.088), QPointF(384.416, 691.552));
00414     path.cubicTo(QPointF(360.944, 737.776), QPointF(307.808, 743.248), QPointF(305.504, 695.8));
00415     path.cubicTo(QPointF(308.816, 639.64), QPointF(311.984, 581.536), QPointF(273.68, 544.096));
00416     path.cubicTo(QPointF(267.704, 497.368), QPointF(246.392, 480.232), QPointF(236.384, 450.28));
00417     path.lineTo(203.12, 426.088);
00418     path.lineTo(133.568, 435.088);
00419     path.cubicTo(QPointF(130.76, 452.152), QPointF(129.104, 468.784), QPointF(131.552, 484.912));
00420     path.cubicTo(QPointF(115.064, 507.376), QPointF(102.608, 530.056), QPointF(101.168, 553.312));
00421     path.cubicTo(QPointF(88.712, 586.648), QPointF(59.12, 614.944), QPointF(64.232, 680.752));
00422     path.cubicTo(QPointF(80.864, 698.248), QPointF(104.12, 714.448), QPointF(124.064, 731.296));
00423     path.cubicTo(QPointF(149.12, 752.392), QPointF(135.512, 776.296), QPointF(100.232, 769.672));
00424     path.cubicTo(QPointF(78.848, 746.056), QPointF(56.744, 722.872), QPointF(35.288, 699.328));
00425     path.cubicTo(QPointF(12.392, 683.056), QPointF(3.896, 662.176), QPointF(27.368, 630.496));
00426     path.cubicTo(QPointF(43.424, 609.04), QPointF(47.96, 562.456), QPointF(62, 543.664));
00427     path.cubicTo(QPointF(74.312, 525.16), QPointF(92.24, 508.6), QPointF(105.272, 490.096));
00428     path.cubicTo(QPointF(112.184, 477.928), QPointF(114.344, 468.568), QPointF(113.264, 454.456));
00429     path.lineTo(110.312, 369.136);
00430     path.cubicTo(QPointF(108.368, 307.216), QPointF(142.424, 274.24), QPointF(189.8, 275.248));
00431     path.cubicTo(QPointF(243.512, 275.752), QPointF(287.576, 312.472), QPointF(288.152, 378.28));
00432     path.cubicTo(QPointF(292.688, 410.32), QPointF(283.256, 428.68), QPointF(308.672, 474.472));
00433     path.cubicTo(QPointF(334.52, 522.712), QPointF(338.552, 520.12), QPointF(354.464, 537.544));
00434     path.closeSubpath();
00435     painter->drawPath(path);
00436     path = QPainterPath();
00437 
00438     painter->setBrush(QColor(193, 193, 191, 255));
00439     path.moveTo(261.296, 503.632);
00440     path.lineTo(263.528, 512.2);
00441     path.cubicTo(QPointF(257.696, 501.688), QPointF(250.712, 483.616), QPointF(241.928, 475.696));
00442     path.cubicTo(QPointF(239.264, 473.536), QPointF(235.808, 473.608), QPointF(233.72, 475.624));
00443     path.cubicTo(QPointF(222.056, 486.928), QPointF(193.112, 510.112), QPointF(169.928, 507.088));
00444     path.cubicTo(QPointF(152.072, 505.288), QPointF(134.648, 493.264), QPointF(130.832, 480.232));
00445     path.cubicTo(QPointF(128.816, 470.872), QPointF(129.752, 463.168), QPointF(130.976, 455.32));
00446     path.lineTo(240.704, 453.52);
00447     path.cubicTo(QPointF(238.472, 463.168), QPointF(253.088, 487), QPointF(261.296, 503.632));
00448     path.closeSubpath();
00449     painter->drawPath(path);
00450     path = QPainterPath();
00451 
00452     painter->setBrush(QColor(193, 193, 191, 255));
00453     path.moveTo(143.144, 363.232);
00454     path.cubicTo(QPointF(154.088, 363.232), QPointF(163.88, 376.84), QPointF(163.808, 395.632));
00455     path.cubicTo(QPointF(163.736, 408.232), QPointF(155.528, 411.472), QPointF(149.336, 417.016));
00456     path.cubicTo(QPointF(146.6, 419.536), QPointF(145.952, 433.144), QPointF(142.568, 433.144));
00457     path.cubicTo(QPointF(131.696, 433.144), QPointF(123.488, 413.776), QPointF(123.488, 395.632));
00458     path.cubicTo(QPointF(123.488, 377.56), QPointF(132.272, 363.232), QPointF(143.144, 363.232));
00459     path.closeSubpath();
00460     painter->drawPath(path);
00461     path = QPainterPath();
00462 
00463     painter->setBrush(QColor(255, 255, 255, 255));
00464     path.moveTo(144.368, 375.04);
00465     path.cubicTo(QPointF(154.088, 375.04), QPointF(160.856, 379.936), QPointF(161.648, 391.312));
00466     path.cubicTo(QPointF(162.224, 399.16), QPointF(160.136, 411.76), QPointF(154.664, 414.424));
00467     path.cubicTo(QPointF(152.144, 415.648), QPointF(143.432, 426.664), QPointF(140.408, 426.52));
00468     path.cubicTo(QPointF(128.096, 425.944), QPointF(125, 402.112), QPointF(125.936, 390.736));
00469     path.cubicTo(QPointF(126.8, 379.36), QPointF(134.72, 375.04), QPointF(144.368, 375.04));
00470     path.closeSubpath();
00471     painter->drawPath(path);
00472     path = QPainterPath();
00473 
00474     painter->setBrush(QColor(0, 0, 0, 255));
00475     path.moveTo(141.848, 382.672);
00476     path.cubicTo(QPointF(148.544, 382.096), QPointF(154.736, 389.728), QPointF(155.6, 399.664));
00477     path.cubicTo(QPointF(156.464, 409.6), QPointF(151.64, 418.24), QPointF(144.944, 418.816));
00478     path.cubicTo(QPointF(138.248, 419.392), QPointF(132.056, 411.76), QPointF(131.192, 401.752));
00479     path.cubicTo(QPointF(130.328, 391.816), QPointF(135.152, 383.248), QPointF(141.848, 382.672));
00480     path.closeSubpath();
00481     painter->drawPath(path);
00482     path = QPainterPath();
00483 
00484     painter->setBrush(QColor(193, 193, 191, 255));
00485     path.moveTo(151.064, 397.288);
00486     path.cubicTo(QPointF(151.424, 399.088), QPointF(149.408, 400.024), QPointF(148.832, 398.224));
00487     path.cubicTo(QPointF(148.256, 395.992), QPointF(146.888, 393.328), QPointF(145.088, 391.168));
00488     path.cubicTo(QPointF(143.936, 389.872), QPointF(145.088, 388.432), QPointF(146.528, 389.44));
00489     path.cubicTo(QPointF(149.048, 391.528), QPointF(150.488, 394.12), QPointF(151.064, 397.288));
00490     path.closeSubpath();
00491     painter->drawPath(path);
00492     path = QPainterPath();
00493 
00494     painter->setBrush(QColor(193, 193, 191, 255));
00495     path.moveTo(216.944, 360.712);
00496     path.cubicTo(QPointF(232.712, 360.712), QPointF(245.6, 377.416), QPointF(245.6, 397.792));
00497     path.cubicTo(QPointF(245.6, 418.24), QPointF(232.712, 434.872), QPointF(216.944, 434.872));
00498     path.cubicTo(QPointF(201.176, 434.872), QPointF(188.432, 418.24), QPointF(188.432, 397.792));
00499     path.cubicTo(QPointF(188.432, 377.416), QPointF(201.176, 360.712), QPointF(216.944, 360.712));
00500     path.closeSubpath();
00501     painter->drawPath(path);
00502     path = QPainterPath();
00503 
00504     painter->setBrush(QColor(255, 255, 255, 255));
00505     path.moveTo(224.792, 374.968);
00506     path.cubicTo(QPointF(235.664, 378.856), QPointF(241.928, 387.424), QPointF(242.72, 396.568));
00507     path.cubicTo(QPointF(243.656, 407.08), QPointF(239.408, 418.96), QPointF(230.264, 425.944));
00508     path.cubicTo(QPointF(227.672, 427.888), QPointF(197.72, 416.08), QPointF(195.992, 411.616));
00509     path.cubicTo(QPointF(193.4, 405.208), QPointF(191.816, 392.896), QPointF(193.76, 385.624));
00510     path.cubicTo(QPointF(194.552, 382.744), QPointF(197.216, 378.568), QPointF(201.176, 376.336));
00511     path.cubicTo(QPointF(207.44, 372.808), QPointF(216.656, 372.088), QPointF(224.792, 374.968));
00512     path.closeSubpath();
00513     painter->drawPath(path);
00514     path = QPainterPath();
00515 
00516     painter->setBrush(QColor(0, 0, 0, 255));
00517     path.moveTo(216.872, 380.944);
00518     path.cubicTo(QPointF(225.584, 380.944), QPointF(232.712, 389.296), QPointF(232.712, 399.448));
00519     path.cubicTo(QPointF(232.712, 409.672), QPointF(225.584, 418.024), QPointF(216.872, 418.024));
00520     path.cubicTo(QPointF(208.16, 418.024), QPointF(201.032, 409.672), QPointF(201.032, 399.448));
00521     path.cubicTo(QPointF(201.032, 389.296), QPointF(208.16, 380.944), QPointF(216.872, 380.944));
00522     path.closeSubpath();
00523     painter->drawPath(path);
00524     path = QPainterPath();
00525 
00526     painter->setBrush(QColor(193, 193, 191, 255));
00527     path.moveTo(227.096, 392.392);
00528     path.cubicTo(QPointF(228.104, 394.048), QPointF(226.448, 395.776), QPointF(225.224, 394.12));
00529     path.cubicTo(QPointF(223.784, 392.104), QPointF(221.408, 389.944), QPointF(218.888, 388.432));
00530     path.cubicTo(QPointF(217.232, 387.568), QPointF(217.808, 385.624), QPointF(219.68, 386.2));
00531     path.cubicTo(QPointF(222.92, 387.28), QPointF(225.368, 389.368), QPointF(227.096, 392.392));
00532     path.closeSubpath();
00533     painter->drawPath(path);
00534     path = QPainterPath();
00535 
00536     painter->setBrush(QColor(183, 114, 0, 255));
00537     path.moveTo(164.96, 404.488);
00538     path.cubicTo(QPointF(172.376, 402.328), QPointF(184.112, 403.048), QPointF(192.248, 404.632));
00539     path.cubicTo(QPointF(200.384, 406.792), QPointF(222.056, 418.24), QPointF(245.024, 430.696));
00540     path.cubicTo(QPointF(247.976, 432.208), QPointF(248.84, 437.104), QPointF(245.024, 438.688));
00541     path.cubicTo(QPointF(239.12, 439.12), QPointF(249.272, 453.664), QPointF(238.904, 458.848));
00542     path.cubicTo(QPointF(223.352, 462.88), QPointF(198.44, 485.992), QPointF(186.128, 487.864));
00543     path.cubicTo(QPointF(179.288, 489.376), QPointF(172.232, 489.592), QPointF(164.6, 487.864));
00544     path.cubicTo(QPointF(140.552, 482.968), QPointF(134.216, 455.608), QPointF(122.912, 450.064));
00545     path.cubicTo(QPointF(119.816, 446.824), QPointF(121.4, 441.208), QPointF(122.408, 440.056));
00546     path.cubicTo(QPointF(123.632, 434.224), QPointF(149.696, 406.216), QPointF(164.96, 404.488));
00547     path.closeSubpath();
00548     painter->drawPath(path);
00549     path = QPainterPath();
00550 
00551     painter->setBrush(QColor(242, 183, 0, 255));
00552     path.moveTo(185.408, 405.856);
00553     path.cubicTo(QPointF(198.44, 407.296), QPointF(226.088, 423.928), QPointF(239.408, 430.624));
00554     path.cubicTo(QPointF(242.72, 432.424), QPointF(242.504, 437.824), QPointF(239.552, 438.688));
00555     path.cubicTo(QPointF(236.384, 440.488), QPointF(235.448, 438.256), QPointF(232.928, 437.896));
00556     path.cubicTo(QPointF(228.896, 435.736), QPointF(222.272, 440.92), QPointF(217.016, 444.88));
00557     path.cubicTo(QPointF(186.704, 467.776), QPointF(180.656, 465.256), QPointF(156.176, 462.664));
00558     path.cubicTo(QPointF(147.68, 460.576), QPointF(142.136, 457.984), QPointF(139.688, 455.968));
00559     path.cubicTo(QPointF(141.488, 445.888), QPointF(160.496, 407.656), QPointF(166.76, 406.792));
00560     path.cubicTo(QPointF(168.344, 404.704), QPointF(179.936, 404.632), QPointF(185.408, 405.856));
00561     path.closeSubpath();
00562     painter->drawPath(path);
00563     path = QPainterPath();
00564 
00565     painter->setBrush(QColor(183, 114, 0, 255));
00566     path.moveTo(190.664, 412.048);
00567     path.lineTo(193.76, 413.416);
00568     path.cubicTo(QPointF(196.064, 414.712), QPointF(193.256, 418.168), QPointF(190.736, 417.088));
00569     path.lineTo(186.2, 415.504);
00570     path.cubicTo(QPointF(183.536, 413.272), QPointF(186.704, 410.104), QPointF(190.664, 412.048));
00571     path.closeSubpath();
00572     painter->drawPath(path);
00573     path = QPainterPath();
00574 
00575     painter->setBrush(QColor(193, 193, 191, 255));
00576     path.moveTo(268.568, 452.368);
00577     path.cubicTo(QPointF(273.032, 454.384), QPointF(279.224, 457.192), QPointF(282.536, 460.144));
00578     path.cubicTo(QPointF(285.488, 464.104), QPointF(286.784, 468.064), QPointF(286.424, 472.024));
00579     path.cubicTo(QPointF(285.776, 474.544), QPointF(284.12, 476.344), QPointF(281.24, 477.424));
00580     path.cubicTo(QPointF(277.856, 478.216), QPointF(273.68, 477.424), QPointF(271.376, 474.112));
00581     path.cubicTo(QPointF(269.864, 471.448), QPointF(265.256, 462.16), QPointF(263.96, 460.576));
00582     path.cubicTo(QPointF(262.232, 457.12), QPointF(261.944, 454.456), QPointF(262.88, 452.368));
00583     path.cubicTo(QPointF(264.032, 451.288), QPointF(266.048, 451), QPointF(268.568, 452.368));
00584     path.closeSubpath();
00585     painter->drawPath(path);
00586     path = QPainterPath();
00587 
00588     painter->setBrush(QColor(255, 255, 255, 255));
00589     path.moveTo(273.752, 461.584);
00590     path.cubicTo(QPointF(275.48, 462.376), QPointF(277.928, 463.456), QPointF(279.224, 464.68));
00591     path.cubicTo(QPointF(280.376, 466.264), QPointF(280.88, 467.776), QPointF(280.736, 469.36));
00592     path.cubicTo(QPointF(280.52, 470.296), QPointF(279.8, 471.016), QPointF(278.72, 471.448));
00593     path.cubicTo(QPointF(277.352, 471.808), QPointF(275.768, 471.448), QPointF(274.832, 470.152));
00594     path.cubicTo(QPointF(274.256, 469.144), QPointF(272.456, 465.472), QPointF(271.952, 464.824));
00595     path.cubicTo(QPointF(271.232, 463.456), QPointF(271.088, 462.448), QPointF(271.448, 461.584));
00596     path.cubicTo(QPointF(271.952, 461.152), QPointF(272.744, 461.08), QPointF(273.752, 461.584));
00597     path.closeSubpath();
00598     painter->drawPath(path);
00599     path = QPainterPath();
00600 
00601     painter->setBrush(QColor(193, 193, 191, 255));
00602     path.moveTo(238.616, 358.552);
00603     path.cubicTo(QPointF(239.048, 359.2), QPointF(238.976, 359.776), QPointF(238.4, 360.28));
00604     path.cubicTo(QPointF(237.896, 360.784), QPointF(237.176, 360.712), QPointF(236.24, 360.208));
00605     path.lineTo(231.632, 356.248);
00606     path.cubicTo(QPointF(231.056, 355.744), QPointF(230.912, 354.952), QPointF(231.272, 354.088));
00607     path.cubicTo(QPointF(232.28, 353.44), QPointF(233.144, 353.44), QPointF(233.936, 354.088));
00608     path.closeSubpath();
00609     painter->drawPath(path);
00610     path = QPainterPath();
00611 
00612     painter->setBrush(QColor(193, 193, 191, 255));
00613     path.moveTo(235.592, 305.992);
00614     path.cubicTo(QPointF(239.624, 308.224), QPointF(240.848, 313.912), QPointF(238.184, 318.592));
00615     path.cubicTo(QPointF(235.592, 323.2), QPointF(230.12, 325.144), QPointF(226.016, 322.84));
00616     path.cubicTo(QPointF(221.984, 320.536), QPointF(220.76, 314.92), QPointF(223.424, 310.24));
00617     path.cubicTo(QPointF(226.016, 305.56), QPointF(231.488, 303.688), QPointF(235.592, 305.992));
00618     path.closeSubpath();
00619     painter->drawPath(path);
00620     path = QPainterPath();
00621 
00622     painter->setBrush(QColor(193, 193, 191, 255));
00623     path.moveTo(374.912, 680.536);
00624     path.cubicTo(QPointF(378.296, 683.128), QPointF(373.256, 687.376), QPointF(371.024, 686.296));
00625     path.cubicTo(QPointF(369.152, 685.648), QPointF(367.784, 683.488), QPointF(366.92, 682.408));
00626     path.cubicTo(QPointF(366.128, 681.184), QPointF(366.2, 679.168), QPointF(366.92, 678.448));
00627     path.cubicTo(QPointF(367.712, 677.44), QPointF(369.728, 677.656), QPointF(371.024, 678.52));
00628     path.cubicTo(QPointF(372.32, 679.168), QPointF(373.616, 679.888), QPointF(374.912, 680.536));
00629     path.closeSubpath();
00630     painter->drawPath(path);
00631     path = QPainterPath();
00632 
00633     painter->setBrush(QColor(193, 193, 191, 255));
00634     path.moveTo(297.44, 551.512);
00635     path.cubicTo(QPointF(338.984, 572.896), QPointF(350, 611.56), QPointF(332.072, 664.192));
00636     path.cubicTo(QPointF(330.992, 666.64), QPointF(334.16, 668.368), QPointF(335.24, 666.064));
00637     path.cubicTo(QPointF(354.824, 610.336), QPointF(341.432, 571.312), QPointF(299.024, 548.56));
00638     path.cubicTo(QPointF(296.864, 547.552), QPointF(295.28, 550.432), QPointF(297.44, 551.512));
00639     path.closeSubpath();
00640     painter->drawPath(path);
00641     path = QPainterPath();
00642 
00643     painter->setBrush(QColor(193, 193, 191, 255));
00644     path.moveTo(72.008, 569.512);
00645     path.cubicTo(QPointF(38.312, 627.256), QPointF(38.096, 662.68), QPointF(62.504, 681.328));
00646     path.cubicTo(QPointF(63.728, 682.264), QPointF(64.448, 680.032), QPointF(63.296, 679.168));
00647     path.cubicTo(QPointF(36.296, 655.48), QPointF(48.896, 615.52), QPointF(74.168, 570.88));
00648     path.cubicTo(QPointF(74.888, 569.584), QPointF(72.512, 568.432), QPointF(72.008, 569.512));
00649     path.closeSubpath();
00650     painter->drawPath(path);
00651     path = QPainterPath();
00652 
00653     painter->setBrush(QColor(193, 193, 191, 255));
00654     path.moveTo(289.376, 586.864);
00655     path.cubicTo(QPointF(289.232, 589.168), QPointF(288.368, 589.528), QPointF(286.424, 587.368));
00656     path.cubicTo(QPointF(279.8, 575.848), QPointF(235.088, 551.44), QPointF(213.344, 548.704));
00657     path.cubicTo(QPointF(209.24, 547.264), QPointF(209.456, 545.392), QPointF(213.488, 544.816));
00658     path.cubicTo(QPointF(229.184, 544.816), QPointF(241.28, 537.904), QPointF(254.96, 537.904));
00659     path.cubicTo(QPointF(258.704, 538.048), QPointF(262.304, 539.488), QPointF(264.392, 541.648));
00660     path.cubicTo(QPointF(269.504, 544.96), QPointF(288.08, 570.592), QPointF(289.376, 586.864));
00661     path.closeSubpath();
00662     painter->drawPath(path);
00663     path = QPainterPath();
00664 
00665     painter->setBrush(QColor(193, 193, 191, 255));
00666     path.moveTo(180.152, 546.832);
00667     path.cubicTo(QPointF(180.872, 550.792), QPointF(163.808, 545.68), QPointF(164.744, 556.696));
00668     path.cubicTo(QPointF(165.032, 559.72), QPointF(160.496, 561.376), QPointF(160.64, 556.696));
00669     path.cubicTo(QPointF(160.64, 548.272), QPointF(161.072, 548.416), QPointF(152.72, 546.832));
00670     path.cubicTo(QPointF(151.208, 546.76), QPointF(151.352, 544.528), QPointF(152.72, 544.816));
00671     path.lineTo(152.72, 544.816);
00672     path.cubicTo(QPointF(158.696, 546.472), QPointF(166.76, 542.872), QPointF(166.4, 538.84));
00673     path.cubicTo(QPointF(166.256, 537.472), QPointF(168.56, 537.688), QPointF(168.488, 538.84));
00674     path.cubicTo(QPointF(167.984, 545.248), QPointF(181.664, 542.152), QPointF(180.152, 546.832));
00675     path.closeSubpath();
00676     painter->drawPath(path);
00677     path = QPainterPath();
00678 
00679     painter->setBrush(QColor(193, 193, 191, 255));
00680     path.moveTo(151.568, 705.376);
00681     path.cubicTo(QPointF(151.64, 708.328), QPointF(148.76, 707.68), QPointF(148.544, 705.592));
00682     path.cubicTo(QPointF(140.192, 680.536), QPointF(143.72, 618.832), QPointF(151.856, 598.96));
00683     path.cubicTo(QPointF(152.432, 596.08), QPointF(156.248, 596.944), QPointF(155.744, 598.96));
00684     path.cubicTo(QPointF(147.104, 635.464), QPointF(147.248, 673.048), QPointF(151.568, 705.376));
00685     path.closeSubpath();
00686     painter->drawPath(path);
00687     path = QPainterPath();
00688 
00689     painter->setBrush(QColor(183, 114, 0, 255));
00690     path.moveTo(51.704, 684.424);
00691     path.cubicTo(QPointF(75.68, 707.824), QPointF(91.376, 743.248), QPointF(114.632, 775.288));
00692     path.cubicTo(QPointF(148.472, 816.04), QPointF(121.472, 858.304), QPointF(66.464, 845.56));
00693     path.cubicTo(QPointF(38.888, 835.192), QPointF(-0.784, 836.344), QPointF(-32.68, 825.832));
00694     path.cubicTo(QPointF(-55.072, 820.36), QPointF(-55.864, 809.272), QPointF(-44.416, 787.6));
00695     path.cubicTo(QPointF(-40.384, 773.776), QPointF(-40.024, 751.312), QPointF(-43.768, 732.592));
00696     path.cubicTo(QPointF(-45.784, 718.408), QPointF(-39.232, 710.488), QPointF(-24.112, 708.832));
00697     path.lineTo(-24.112, 708.832);
00698     path.cubicTo(QPointF(-11.296, 708.688), QPointF(6.56, 713.872), QPointF(16.28, 686.44));
00699     path.cubicTo(QPointF(23.552, 673.336), QPointF(40.976, 672.976), QPointF(51.704, 684.424));
00700     path.closeSubpath();
00701     painter->drawPath(path);
00702     path = QPainterPath();
00703 
00704     painter->setBrush(QColor(242, 183, 0, 255));
00705     path.moveTo(24.632, 699.04);
00706     path.cubicTo(QPointF(23.84, 680.968), QPointF(39.32, 677.296), QPointF(49.688, 688.312));
00707     path.cubicTo(QPointF(68.192, 710.992), QPointF(85.112, 736.048), QPointF(100.376, 764.992));
00708     path.cubicTo(QPointF(124.712, 804.16), QPointF(104.624, 842.68), QPointF(67.904, 828.064));
00709     path.cubicTo(QPointF(49.688, 817.84), QPointF(6.128, 813.304), QPointF(-17.344, 809.128));
00710     path.cubicTo(QPointF(-33.04, 807.832), QPointF(-35.128, 797.608), QPointF(-29.152, 791.848));
00711     path.cubicTo(QPointF(-20.944, 782.416), QPointF(-20.08, 759.808), QPointF(-27.856, 740.512));
00712     path.cubicTo(QPointF(-35.56, 728.56), QPointF(-21.088, 715.384), QPointF(-9.712, 720.856));
00713     path.cubicTo(QPointF(0.8, 727.048), QPointF(25.64, 713.08), QPointF(24.632, 699.04));
00714     path.closeSubpath();
00715     painter->drawPath(path);
00716 
00717     painter->setPen(QPen(QColor(255, 0, 0, alpha), 0.25, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin));
00718     painter->setBrush(Qt::NoBrush);
00719     painter->drawRect(br.adjusted(-1, -1, 1, 1));
00720 }
00721 
00722 
00723 XFormWidget::XFormWidget(QWidget *parent)
00724     : QWidget(parent)
00725 {
00726     setWindowTitle("Affine Transformations");
00727 
00728     view = new XFormView(this);
00729     view->setMinimumSize(200, 200);
00730 
00731     QGroupBox *mainGroup = new QGroupBox(this);
00732     mainGroup->setFixedWidth(180);
00733     mainGroup->setTitle("Affine Transformations");
00734 
00735     QGroupBox *rotateGroup = new QGroupBox(mainGroup);
00736     rotateGroup->setAttribute(Qt::WA_ContentsPropagated);
00737     rotateGroup->setTitle("Rotate");
00738     QSlider *rotateSlider = new QSlider(Qt::Horizontal, rotateGroup);
00739     rotateSlider->setRange(0, 3600);
00740     rotateSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
00741 
00742     QGroupBox *scaleGroup = new QGroupBox(mainGroup);
00743     scaleGroup->setAttribute(Qt::WA_ContentsPropagated);
00744     scaleGroup->setTitle("Scale");
00745     QSlider *scaleSlider = new QSlider(Qt::Horizontal, scaleGroup);
00746     scaleSlider->setRange(1, 4000);
00747     scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
00748 
00749     QGroupBox *shearGroup = new QGroupBox(mainGroup);
00750     shearGroup->setAttribute(Qt::WA_ContentsPropagated);
00751     shearGroup->setTitle("Shear");
00752     QSlider *shearSlider = new QSlider(Qt::Horizontal, shearGroup);
00753     shearSlider->setRange(-990, 990);
00754     shearSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
00755 
00756     QGroupBox *typeGroup = new QGroupBox(mainGroup);
00757     typeGroup->setAttribute(Qt::WA_ContentsPropagated);
00758     typeGroup->setTitle("Type");
00759     QRadioButton *vectorType = new QRadioButton(typeGroup);
00760     QRadioButton *pixmapType = new QRadioButton(typeGroup);
00761     QRadioButton *textType= new QRadioButton(typeGroup);
00762     vectorType->setText("Vector Image");
00763     pixmapType->setText("Pixmap");
00764     textType->setText("Text");
00765     view->textEditor = new QLineEdit(typeGroup);
00766 
00767     QPushButton *resetButton = new QPushButton(mainGroup);
00768     resetButton->setText("Reset Transform");
00769 
00770     QPushButton *animateButton = new QPushButton(mainGroup);
00771     animateButton->setText("Animate");
00772     animateButton->setCheckable(true);
00773 
00774     QPushButton *showSourceButton = new QPushButton(mainGroup);
00775     showSourceButton->setText("Show Source");
00776 #ifdef QT_OPENGL_SUPPORT
00777     QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
00778     enableOpenGLButton->setText("Use OpenGL");
00779     enableOpenGLButton->setCheckable(true);
00780     enableOpenGLButton->setChecked(view->usesOpenGL());
00781     if (!QGLFormat::hasOpenGL())
00782         enableOpenGLButton->hide();
00783 #endif
00784     QPushButton *whatsThisButton = new QPushButton(mainGroup);
00785     whatsThisButton->setText("What's This?");
00786     whatsThisButton->setCheckable(true);
00787 
00788     QHBoxLayout *viewLayout = new QHBoxLayout(this);
00789     viewLayout->addWidget(view);
00790     viewLayout->addWidget(mainGroup);
00791 
00792     QVBoxLayout *rotateGroupLayout = new QVBoxLayout(rotateGroup);
00793     rotateGroupLayout->addWidget(rotateSlider);
00794 
00795     QVBoxLayout *scaleGroupLayout = new QVBoxLayout(scaleGroup);
00796     scaleGroupLayout->addWidget(scaleSlider);
00797 
00798     QVBoxLayout *shearGroupLayout = new QVBoxLayout(shearGroup);
00799     shearGroupLayout->addWidget(shearSlider);
00800 
00801     QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup);
00802     typeGroupLayout->addWidget(vectorType);
00803     typeGroupLayout->addWidget(pixmapType);
00804     typeGroupLayout->addWidget(textType);
00805     typeGroupLayout->addSpacing(4);
00806     typeGroupLayout->addWidget(view->textEditor);
00807 
00808     QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
00809     mainGroupLayout->addWidget(rotateGroup);
00810     mainGroupLayout->addWidget(scaleGroup);
00811     mainGroupLayout->addWidget(shearGroup);
00812     mainGroupLayout->addWidget(typeGroup);
00813     mainGroupLayout->addStretch(1);
00814     mainGroupLayout->addWidget(resetButton);
00815     mainGroupLayout->addWidget(animateButton);
00816     mainGroupLayout->addWidget(showSourceButton);
00817 #ifdef QT_OPENGL_SUPPORT
00818     mainGroupLayout->addWidget(enableOpenGLButton);
00819 #endif
00820     mainGroupLayout->addWidget(whatsThisButton);
00821 
00822     connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int)));
00823     connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int)));
00824     connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int)));
00825 
00826     connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType()));
00827     connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType()));
00828     connect(textType, SIGNAL(clicked()), view, SLOT(setTextType()));
00829     connect(textType, SIGNAL(toggled(bool)), view->textEditor, SLOT(setEnabled(bool)));
00830     connect(view->textEditor, SIGNAL(textChanged(const QString &)), view, SLOT(update()));
00831 
00832     connect(view, SIGNAL(rotationChanged(int)), rotateSlider, SLOT(setValue(int)));
00833     connect(view, SIGNAL(scaleChanged(int)), scaleSlider, SLOT(setValue(int)));
00834     connect(view, SIGNAL(shearChanged(int)), shearSlider, SLOT(setValue(int)));
00835 
00836     connect(resetButton, SIGNAL(clicked()), view, SLOT(reset()));
00837     connect(animateButton, SIGNAL(clicked(bool)), view, SLOT(setAnimation(bool)));
00838     connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool)));
00839     connect(whatsThisButton, SIGNAL(clicked(bool)), view->hoverPoints(), SLOT(setDisabled(bool)));
00840     connect(view, SIGNAL(descriptionEnabledChanged(bool)), view->hoverPoints(), SLOT(setDisabled(bool)));
00841     connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool)));
00842     connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource()));
00843 #ifdef QT_OPENGL_SUPPORT
00844     connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool)));
00845 #endif
00846     view->loadSourceFile(":res/xform.cpp");
00847     view->loadDescription(":res/xform.html");
00848 
00849     // defaults
00850     view->reset();
00851     vectorType->setChecked(true);
00852     view->textEditor->setText("Trolltech");
00853     view->textEditor->setEnabled(false);
00854 
00855     animateButton->animateClick();
00856 }

Generated on Thu Mar 15 11:52:27 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1