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. Set QWidget to be "unmovable"
Forum Updated to NodeBB v4.3 + New Features

Set QWidget to be "unmovable"

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    strangelookingnerd
    wrote on last edited by
    #1

    Hi!

    I'm looking for a way to prevent several QWidgets from beeing moved.
    I got a MainWindow as parent and some QWidgets as Child-Windows which are created in a preset order and size in my MainWindow. Now I want these QWidgets to keep their position in the MainWindow, till the user tells a QWidgets to be movable (e.g. with a QPushButton in MainWindow). So the QWidgets moving behavior could be described as "static" when they are initialized and this "static"-Flag can be triggered. I couldn't figure out a "best practice"-way to to achieve this, since i couldn't find a flag or attribute that would work for me. I came across the possibility to use setWindowFlags(Qt::FramelessWindowHint) for "static" QWidgets and setWindowFlags(Qt::Widget) for "non-static". So I'm actually hiding the QWidgets Titlebar, which would work - BUT I need the Titlebar to show several additional status informations all the time, not only in "non-static" mode.

    I hope u actually got what my problem is and maybe got a solution for me :D

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ramblurr
      wrote on last edited by
      #2

      Are these QWidgets you are referring to embedded in your QMainWindow or are they separate windows?

      If the former I would call "QWidget::setFixedSize":http://doc.qt.nokia.com/4.7/qwidget.html#setFixedSize on your widgets.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        strangelookingnerd
        wrote on last edited by
        #3

        These are separate windows. Anyhow I dont see why setting a fixed size for the widgets would help me make me those QWidgets unmovable?

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          I'd take a look into the Widgets > Window Flags Qt example. Or try the cheap solution: when the user orders moving the window, move it back to the original position XD.

          Anyway, good luck!

          PS: also, I think it's possible to avoid movement via OS -Linux, that is-...

          --

          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