Results 1 to 3 of 3

Thread: Problem with resizing circle

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with resizing circle

    I drew a circle using addEclipse command in the paintevent and the boundary using the Qpainterpath. I wanted to resize the circle and move the circle . So I created a button for resizing . Whn I click on tht button , i change the radius in the mousemoveevent .Its all working fine . The PROBELM tht I m getting is tht whn I m increasing the radius the boundary is not increasing smoothly , i meant to say tht while transitioning boundary is getting thinner . After I release the button the boundary is fine . Also whn I m moving the circle , the boundary disappears sometime.
    Can somebody suggest me wht to do .....

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Problem with resizing circle

    Quote Originally Posted by SeNSe View Post
    Can somebody suggest me wht to do .....
    How could we without seeing any pice of your code!

  3. #3
    Join Date
    Apr 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with resizing circle

    void class :: mouseMoveEvent(QMouseEvent *event)
    {
    m_position_old = event->globalPos();
    }


    void class :: paintEvent(QPaintEvent *event)
    {
    Painter painter;
    painter.begin(this);
    QPen myPen;
    myPen.setWidth(10);
    myPen.setColor(QColor(128,128,128));
    painter.setPen(myPen);
    int PixPosX = m_position_old.x();
    int PixPosY = m_position_old.y();
    QRegion maskregion;
    QPainterPath magPainterPath;
    QRect rectMagWnd(PixPosX-Radius,PixPosY-Radius,2*Radius,2*Radius);

    magPainterPath.addEllipse(rectMagWnd);
    resizeBtn->setGeometry(rectMagWnd.x()+rectMagWnd.width()-pixWidth,rectMagWnd.y()+rectMagWnd.height()/2-pixHeight,pixWidth,pixHeight);
    closeBtn->setGeometry(resizeBtn->x()-2,resizeBtn->y()+25,pixWidth,pixHeight);
    shapeBtn->setGeometry(resizeBtn->x()-7,resizeBtn->y()+50,pixWidth,pixHeight);
    zoomBtn->setGeometry(resizeBtn->x()-15,resizeBtn->y()+75,pixWidth,pixHeight);

    painter.setClipPath(magPainterPath);
    maskregion=painter.clipRegion();
    setMask(maskregion);
    painter.drawPath(magPainterPath);
    painter.end();

    }


    I m changing radius in the mousemoveevent ... It is not relevant so I hvn't shown it
    Now I guess you must know wht I was saying earlier

Similar Threads

  1. problem while resizing mainwindow.
    By phillip_Qt in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2009, 08:44
  2. problem resizing rect
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2008, 11:09
  3. resizing down problem
    By MrGarbage in forum Qt Tools
    Replies: 1
    Last Post: 23rd October 2007, 19:37
  4. Problem with resizing dialog
    By Seema Rao in forum Qt Programming
    Replies: 8
    Last Post: 5th May 2006, 17:27
  5. Widget resizing problem
    By fwohlfert in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2006, 08:16

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
  •  
Qt is a trademark of The Qt Company.