[SOLVED] Cast event when window size is changed
-
@Bremenpl If you want to some it in accordance with the MainWindow that you can get width and height from
QResizeEvent
and move theQUndoView
. Something likevoid MainWindow::resizeEvent(QResizeEvent *e) { undoView->move(e->size().width(),undoView->y()); }
This will move
undoView
onx
axis as mainwindow resize. Add some more calculation as per your requirement. -
@p3c0
Theres an initialisation of the pointer in the class header:QUndoView *undoView;
Then In the mainwindow constructor I am running:
undoStack = new QUndoStack(this); undoView = new QUndoView(undoStack); undoView->setWindowTitle(tr("Command List")); undoView->setWindowFlags(Qt::WindowStaysOnTopHint); undoView->setAttribute(Qt::WA_QuitOnClose, false); undoView->show(); moveUndoView(); // PLEASE NOTE THAT THIS WORKS IN HERE, NO SEGFAULTS
-
@Bremenpl Does it crash when you attempt to resize manually or as soon as you execute the application ? Because resize event will be fired at application startup too. Make sure
undoView
was initialized prior to this first resize event. -
@p3c0
You are right, that is the problem. The thing is, that I cant really create this object before i execute this->show() (MainWindow), because the program crashes as well.Edit: undoStack and undoView had to be both declared before ui is build, I have forgot about that one. Now everything works, thank you a lot for help!