Hello
I'm searching on this site on how to open a new window when you click a button in the menubar.
But i really can't find a solution for my problem.
So can someone pls help. Than you Very Much.
Hello
I'm searching on this site on how to open a new window when you click a button in the menubar.
But i really can't find a solution for my problem.
So can someone pls help. Than you Very Much.
Connect your button to slot, for example "slotOpen()", and in this slot show your new window
Qt Code:
void MainWindow::slotOpen() { wgt->show(); }To copy to clipboard, switch view to plain text mode
This is the code than.
but when i click buton there opens no window
- #include "mainwindowimpl.h"
- #include <QMenuBar>
- #include <QWidget>
- //
- MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
- : QMainWindow(parent, f)
- {
- setupUi(this);
- }
- //
- void MainWindowImpl::slotOpen()
- {
- QWidget *wgt = new QWidget( this );
- wgt->show();
- }
- void MainWindowImpl:n_buton_clicked()
- {
- slotOpen();
- }
Do you have a "buton" (note the single "t") object anywhere in the ui file?
Bookmarks