[gelöst] Probleme mit Connections
Verfasst: 6. November 2007 14:41
Hallo,
ich bekomm das mit der Connection irgendwie nicht hin
Hier ist mein Code:
connect(rbTophat,SIGNAL(clicked()), this, SLOT(test("Tophat")));
Es passiert einfach nix. Normalerweise müsste in der Statusleiste dann "Tophat" zu lesen sein, sobald ich den RadioButton anklicke.
Was mache ich falsch?
Vielen Dank im Voraus.
Viele Grüße
Jana
ich bekomm das mit der Connection irgendwie nicht hin
Code: Alles auswählen
#include <QtGui>
#include <QGridLayout>
#include <QGroupBox>
#include <QRadioButton>
#include "mainwindow.h"
#include "mdisimmod.h"
MainWindow::MainWindow()
{
//erzeugt Fläche für SubWindows
mdiArea = new QMdiArea;
setCentralWidget(mdiArea);
//erzeugt Menü-Bar
createMenus();
createStatusBar();
//Titelzeile
setWindowTitle(tr("Inhouse Simulator"));
}
void MainWindow::createMenus()
{
//File-Menü
fileMenu = menuBar()->addMenu(tr("&File"));
//Edit-Menü
editMenu = menuBar()->addMenu(tr("&Edit"));
//View-Menü (einzelne Fenster öffnen)
viewMenu = menuBar()->addMenu(tr("&View"));
//öffnen des Source-Fenster
QAction *simModule = viewMenu->addAction(tr("Simulation Modules"));
connect(simModule, SIGNAL(triggered()), this, SLOT(newFile()));
//Fenster-Menü (welche Fenster sind gerade offen)
winMenu = menuBar()->addMenu(tr("&Windows"));
//Hilfe-Menü
helpMenu = menuBar()->addMenu(tr("&Help"));
}
void MainWindow::newFile()
{
//Subwindow erzeugen
MdiSimMod *child = new MdiSimMod;
child->newSimMod();
//GroupBox festlegen
QGroupBox *gbSource = new QGroupBox(tr("Source"));
QRadioButton *rbTophat = new QRadioButton(tr("Tophat"));
QRadioButton *rbProcess = new QRadioButton(tr("Processed Measured"));
QRadioButton *rbSynthes = new QRadioButton(tr("Synthesized Physical"));
QVBoxLayout *blSource = new QVBoxLayout;
blSource->addWidget(rbTophat);
blSource->addWidget(rbProcess);
blSource->addWidget(rbSynthes);
gbSource->setLayout(blSource);
QGridLayout *grid = new QGridLayout;
grid->addWidget(gbSource,0,0);
child->setLayout(grid);connect(rbTophat,SIGNAL(clicked()), this, SLOT(test("Tophat")));
Code: Alles auswählen
mdiArea->addSubWindow(child);
child->show();
}
void MainWindow::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
void MainWindow::test(QString text)
{
statusBar()->showMessage(text);
}Was mache ich falsch?
Vielen Dank im Voraus.
Viele Grüße
Jana