when i click a button in the menubar i want to open a new window?
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.
Re: when i click a button in the menubar i want to open a new window?
Connect your button to slot, for example "slotOpen()", and in this slot show your new window
Code:
void MainWindow::slotOpen()
{
wgt->show();
}
Re: when i click a button in the menubar i want to open a new window?
Quote:
Originally Posted by
Jonny174
Connect your button to slot, for example "slotOpen()", and in this slot show your new window
Code:
void MainWindow::slotOpen()
{
wgt->show();
}
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::on_buton_clicked()
- {
- slotOpen();
- }
Re: when i click a button in the menubar i want to open a new window?
Do you have a "buton" (note the single "t") object anywhere in the ui file?