Results 1 to 6 of 6

Thread: Avoid moving widgets

  1. #1
    Join Date
    Jul 2006
    Posts
    37
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Avoid moving widgets

    Hi everyone,

    I try to avoid a widget moving when a user try to move it with the mouse;

    simply with clicking the widget on its decorated bar, and trying to drag it, I would like the widget stays at its original position

    I have experienced moveEvent, but I get recursive loop which seems to be a normal behavior;

    However other events must work, like MousePress, enterEvent, ... just avoiding moving

    So not found real solution...

    If one of you has a way to do it

    Thanks,

    David
    Qt4.3.1, WinXp

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Avoid moving widgets

    Moving a window by dragging its decoration is implemented by the window manager not by your application. You can only revert the position back to its original state after a move has occured. Or you can get rid of window decorations by passing appropriate window flags while constructing the widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2006
    Posts
    37
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Avoid moving widgets

    Ok
    Thanks for your always good and quick reply

    so I imagine I have to implement moveEvent myself, but even if you get oldPos(), how you can go back to the first position without infinite loop?

    I tried with "boolean implementation", but I can't catch the good oldPos()

    maybe you have a solution or there is already a thread which mentioned this?

    Thanks you

    David

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Avoid moving widgets

    Quote Originally Posted by desch View Post
    so I imagine I have to implement moveEvent myself, but even if you get oldPos(), how you can go back to the first position without infinite loop?
    Don't do anything if the position already is set to the coordinates you want it to be. In other words only call move() when you want to change the position of the widget, not during every move event.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    desch (8th April 2009)

  6. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Avoid moving widgets

    You can also consider to use frameless window hint for your window. You wont be able to move it. Also you wont have the title bar.

  7. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Avoid moving widgets

    Quote Originally Posted by aamer4yu View Post
    You can also consider to use frameless window hint for your window. You wont be able to move it. Also you wont have the title bar.
    wysota already said about this in post #2
    ...Or you can get rid of window decorations by passing appropriate window flags while constructing the widget.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  2. Replies: 2
    Last Post: 16th May 2008, 14:39
  3. Painting / moving in a single step to avoid flickering
    By nooky59 in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2008, 10:33
  4. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23
  5. Moving widgets within a layout.
    By importantman in forum Qt Programming
    Replies: 6
    Last Post: 26th May 2007, 20:21

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.