Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget unmovable

QWidget unmovable

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    evergreen
    wrote on last edited by
    #1

    Hello,

    I've created my own class that inherits from QWidget. This widget is centered on my QMainWindow and countains several widget like some QSpinBox and QLineEdit.

    The problem is that when a QSpinBox or a QLineEdit at the bottom of the widget is right-clicked, the widget automaticly moves up to make the right-clicked menu visible on the mainWindow.

    I would like to know if there's a way to forbidde that either by making the widget unmovable or defining some properties for this menu that would avoid that move.

    Thanks

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Hi,

      I am not sure that I got correctly your idea but if the instance of your own class that inherits from QWidget is not part of the mainWindow you can consider to make it "modal":http://doc.qt.nokia.com/latest/qwidget.html#windowModality-prop. This way you will prevent other windows from getting input.

      Cheers,
      Leon

      http://anavi.org/

      1 Reply Last reply
      0
      • E Offline
        E Offline
        evergreen
        wrote on last edited by
        #3

        In think you got it but the QWidget is not a separate window, its parent is the QMainWibnow.
        Your solution would work but it's to different from what I want to do.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          steno
          wrote on last edited by
          #4

          That seems very odd that when you right click on a widget that it would move. Do you have any code we could look at?

          1 Reply Last reply
          0
          • E Offline
            E Offline
            evergreen
            wrote on last edited by
            #5

            In fact, my code is split in lots of files bso it won't be easy to show you.
            But I've made some deeper tests and the problem might be more complex indeed.

            In fact I think this is because I'm using a QGraphicsView with a scene. I put QLineEdit and Spinbox in it and when the they are right clicked the menu does everything possible not to get out of the QGraphicsView.

            I'm not sure I'm really clear sorry.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved