Results 1 to 12 of 12

Thread: Stop window moving when clicking LMB

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Stop window moving when clicking LMB

    Hi,

    Is it possible to stop my window from being moved around when user holds left mouse button and moves cursor around? I only want window to be able to move when use cursor is in caption bar.

    Regards,
    Steve

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Stop window moving when clicking LMB

    what are you talking about?
    Windows only move when you grab them by the title bar...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    Hi,

    I thought that also, but I can move my windows by holding mouse button anywhere, this is why I asked.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Stop window moving when clicking LMB

    what OS are you on?
    Is should be a setting in the OS then - this is not Qt feature.

    This also means you can't make selections in your windows...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    Windows XP. If the window has list widget, tree widget then it is fine if you click inside them, you can't move the window around.

    I just basically create a form derived from QWidget, I then add it to QWorkspace.

    Qt Code:
    1. m_pPlotterView = new PlotterView( this );
    2. m_pworkspace->addWindow( m_pPlotterView );
    3. m_pPlotterView->show();
    To copy to clipboard, switch view to plain text mode 

    Where m_pPlotterView is the derived QWidget class and 'this' is derived QMainWindow.

    Regards,
    Steve

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Stop window moving when clicking LMB

    I then add it to QWorkspace.
    Oh!!
    So you can't move windows around on your desktop, but only in your work space.
    Actually I am not sure if this is normal behaviour for work space either... but I don't really know - try to open another applications that use works psace and see.
    Then think good if it is indeed workspace what you need.
    If you really need all that works space gives you and you just don't want to move the windows in it, you can catch the move events of the windows and reimplement them.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    Nope, I can move windows around, I just want to be able to move windows around when user clicks the title bar, just like normal behaviour. Don't want user to be able to hold LMB down anywhere and be able to move the window - very strange...

    If I have a window derived from QDialog, then all is ok?

    Regards,
    Steve

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Stop window moving when clicking LMB

    you mean on the desktop? out side your workspace?
    Then this must be some OS setting.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    This is really annoying as I have a QwtPlotZoomer object on my form which allows you to create a rubber band over your graph and zoom in and out, but I can't do this as I cannot move the cursor within the QwtPlotZoomer object as the whole window moves! The only way I can do this is to have the window maximized.

    Regards,
    Steve

  10. #10
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    Hi,

    I changed my QWorkspace to QMdiArea and the functions to add my windows to the main area with addSubWindow and now it works!

    Regards,
    Steve

  11. #11
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Stop window moving when clicking LMB

    which means that it WAS only in the work space, not system wide, which was what I asked you...
    I am glad you solved it though.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  12. #12
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stop window moving when clicking LMB

    Yes. Although I would have thought this wouldn't have been default behaviour within QWorkspace, doesn't seem correct to me?

    Kind regards,
    Steve

Similar Threads

  1. Ctrl key to allow user to stop docking a window
    By irudkin in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2007, 04:42

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.