Widget can't move after set the windowFlag to Qt::Window
-
hello, I have some question about WebAssembly.
I create a widget, and setwindowFlag
toQt::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(); }
-
hello, I have some question about WebAssembly.
I create a widget, and setwindowFlag
toQt::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(); }
-
hello, I have some question about WebAssembly.
I create a widget, and setwindowFlag
toQt::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(); }
@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.
-
@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.
@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? -
G Gaobo has marked this topic as solved on