Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Widget can't move after set the windowFlag to Qt::Window
Forum Updated to NodeBB v4.3 + New Features

Widget can't move after set the windowFlag to Qt::Window

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
4 Posts 2 Posters 477 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.
  • GaoboG Offline
    GaoboG Offline
    Gaobo
    wrote on last edited by
    #1

    hello, I have some question about WebAssembly.
    I create a widget, and set windowFlag to Qt::Window. Then show it, why it show at top left of the browser, and i can't move it.
    my code is:

    Form::Form(QWidget *parent)
        : QWidget(parent)
        , ui(new Ui::Form)
    {
        ui->setupUi(this);
    
        this->setWindowFlags(Qt::Window);
        this->installEventFilter(this);
    }
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
    
        auto f = new Form(this);
        f->move(200, 200);
        f->show();
    }
    
    

    1724df75-ed2f-42e7-ae86-a993280f5904-image.png

    GaoboG jsulmJ 2 Replies Last reply
    0
    • GaoboG Gaobo

      hello, I have some question about WebAssembly.
      I create a widget, and set windowFlag to Qt::Window. Then show it, why it show at top left of the browser, and i can't move it.
      my code is:

      Form::Form(QWidget *parent)
          : QWidget(parent)
          , ui(new Ui::Form)
      {
          ui->setupUi(this);
      
          this->setWindowFlags(Qt::Window);
          this->installEventFilter(this);
      }
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
      
          auto f = new Form(this);
          f->move(200, 200);
          f->show();
      }
      
      

      1724df75-ed2f-42e7-ae86-a993280f5904-image.png

      GaoboG Offline
      GaoboG Offline
      Gaobo
      wrote on last edited by
      #2

      when i set Qt::Dialog to windowFlat, widget become moveable. why?
      then it have another question:
      the widget can never be showed

      1 Reply Last reply
      0
      • GaoboG Gaobo

        hello, I have some question about WebAssembly.
        I create a widget, and set windowFlag to Qt::Window. Then show it, why it show at top left of the browser, and i can't move it.
        my code is:

        Form::Form(QWidget *parent)
            : QWidget(parent)
            , ui(new Ui::Form)
        {
            ui->setupUi(this);
        
            this->setWindowFlags(Qt::Window);
            this->installEventFilter(this);
        }
        
        MainWindow::MainWindow(QWidget *parent)
            : QMainWindow(parent)
            , ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        
        
            auto f = new Form(this);
            f->move(200, 200);
            f->show();
        }
        
        

        1724df75-ed2f-42e7-ae86-a993280f5904-image.png

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Gaobo said in Widget can't move after set the windowFlag to Qt::Window:

        Then show it, why it show at top left of the browser, and i can't move it

        Because it is not a window - it has a parent (MainWindow), so it is part of main window. If you want to show it as a window then do not set a parent.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        GaoboG 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Gaobo said in Widget can't move after set the windowFlag to Qt::Window:

          Then show it, why it show at top left of the browser, and i can't move it

          Because it is not a window - it has a parent (MainWindow), so it is part of main window. If you want to show it as a window then do not set a parent.

          GaoboG Offline
          GaoboG Offline
          Gaobo
          wrote on last edited by
          #4

          @jsulm
          thanks;

          If you want to show it as a window then do not set a parent.

          Under windows, it show as a window when i not set parent for form. but under web(browser), it doesn't show. why?

          What difference between Qt::window and Qt::widget?

          when i set Qt::Dialog to windowFlat, widget become moveable. why?

          and i set it to dialog and set parent, form can normally show and move. why?

          1 Reply Last reply
          0
          • GaoboG Gaobo has marked this topic as solved on

          • Login

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