View Full Version : when i click a button in the menubar i want to open a new window?
arninio123
15th March 2012, 09:26
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.
Jonny174
15th March 2012, 12:04
Connect your button to slot, for example "slotOpen()", and in this slot show your new window
void MainWindow::slotOpen()
{
QWidget *wgt = new QWidget( this );
wgt->show();
}
arninio123
15th March 2012, 15:52
Connect your button to slot, for example "slotOpen()", and in this slot show your new window
void MainWindow::slotOpen()
{
QWidget *wgt = new QWidget( this );
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();
}
wysota
15th March 2012, 16:30
Do you have a "buton" (note the single "t") object anywhere in the ui file?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.