Results 1 to 3 of 3

Thread: Widget is not so smooth when resizing?

  1. #1
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Widget is not so smooth when resizing?

    I'm not sure if I can fully expain what is this question,but please read on.

    Here,I'm creating a frameless window.
    Qt Code:
    1. MyWindow::MyWindow(QWidget *parent) :
    2. QMainWindow(parent)
    3. {
    4. ui.setupUi(this);
    5. setWindowFlags(Qt::FramelessWindowHint);
    6. setAttribute(Qt::WA_TranslucentBackground);
    7. setAttribute(Qt::WA_NoMousePropagation);
    8. resizeHandle = new ResizeHandle(this);
    9. resizeHandle->setCursor(Qt::SizeVerCursor);
    10. ...
    11. connect(resizeHandle, SIGNAL(sizeChanged(QPoint&)), this, SLOT(rearrange(QPoint&)));
    12. }
    To copy to clipboard, switch view to plain text mode 

    At the bottom,there's the resizeHandle.When I press on it,I can drag it.Then it will emit sizeChanged(QPoint&) signal,indicating how much I drag(usually 1 to 3 pixel per SIGNAL).Then I resize MyWindow in rearrange(QPoint&):
    Qt Code:
    1. void MyWindow::rearrange(QPoint& newSize)
    2. {
    3. int newH = newSize.ry();
    4.  
    5. resize(this->width(), this->height() + newH);
    6. QFrame* footer = ui.footerFrame;
    7. footer->setGeometry(footer->x(), footer->y() + newH, footer->width(), footer->height());
    8. ....
    9. }
    To copy to clipboard, switch view to plain text mode 
    Here is what it looks like when I resizing:

    Seems like a glitch.It's not always this dramatic,but it appears even when I'm dragging slowly.Anyway,it's all about the effect.
    Maybe I'm missing something when I implement such kind of function.Should I use so-called double-buffer or something,and how?
    It's not the goodbye that hurts,but the flashback that follow.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget is not so smooth when resizing?

    Have you tried this in release mode instead of debug? I'm noticed a few things are a bit jerky in debug mode, probably because of the unoptimised code and lots more validation.

  3. #3
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget is not so smooth when resizing?

    Ok,I will try that.

    This problem is gone when I build release.
    Thanks~
    Last edited by MorrisLiang; 11th May 2010 at 01:56.
    It's not the goodbye that hurts,but the flashback that follow.

Similar Threads

  1. QDock Widget resizing
    By vajindarladdad in forum Qt Programming
    Replies: 0
    Last Post: 9th December 2008, 10:12
  2. Resizing back the widget
    By gruszczy in forum Qt Programming
    Replies: 6
    Last Post: 23rd November 2008, 10:14
  3. selectively disallow widget resizing
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 14th February 2008, 21:41
  4. Resizing child Widget
    By Pragya in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2007, 06:58
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.