
das soll nicht das Problem sein
als erstes die MainWindow.h
Code: Alles auswählen
// to avoid multiple class definitions by including this file more than once
// we have to surround the class definition by this compiler flag
#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_
#include "ui_wavLesen.h"
#include <string>
/**
* Sample MainWindow Class
* The class is a simple implementation of a QDesigner created form file
* defining a simple QMainWindow application
* The class inherits from QMainWindow and Ui_MainWindow. The Ui_MainWindow
* provides the QDesigner part of the implementation, while the QMainWindow
* provides the main functions of a QT Application
*/
//class MainWindow : public QMainWindow, protected Ui_MainWindow
class MainWindow : public QMainWindow, protected Ui_wavLesen
{
Q_OBJECT
public:
/**
* Constructor of the MainWindow class
* @param parent this optional parameter defines a parent widget the created instance will be child of
* @param flags optional parameter defining extra widget options (see also the QT documentation)
*/
MainWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);
/**
Destructor of the MainWindow class, defined virtual to guarantee that
the destructor will be called even if the instance of this class is
saved in a variable of a parent class type
*/
virtual ~MainWindow();
protected slots:
void startPushed();
void anzeiger();
};
#endif // end of #ifndef MAINWINDOW_H_
dann die MainWindow.cpp
Code: Alles auswählen
#include "MainWindow.h"
#include <qt/qmessagebox.h>
#include <iostream>
Ui_wavLesen uiWL;
QString was;
using namespace std;
MainWindow::MainWindow(QWidget* parent /* = 0 */,
Qt::WindowFlags flags /* = 0 */)
: QMainWindow(parent, flags)
{
// create gui elements defined in the Ui_MainWindow class
setupUi(this);
connect(m_startButton, SIGNAL(clicked()), this, SLOT(startPushed()));
// toggled(bool) // clicked() // clicked(bool) // released() // pressed()
//... SIGNAL(valueChanged(int)), SLOT(meinSlot(int)) ...
connect(m_in_lineEdit, SIGNAL(editingFinished()), this, SLOT(anzeiger()));
}
MainWindow::~MainWindow()
{
// no need to delete child widgets, QT does it all for us
}
void MainWindow::startPushed()
{
QMessageBox::information(this, tr("MainWindow Message"), tr("Hello World!"));
}
void MainWindow::anzeiger()
{
uiWL.getInLineEdit();
cout << "ausgabe: ";
}
und als letztes das Problemkind die ui_wavLesen.h
Code: Alles auswählen
/********************************************************************************
** Form generated from reading ui file 'wavLesen.ui'
**
** Created: Thu 28. Dec 14:59:17 2006
** by: Qt User Interface Compiler version 4.2.2
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_WAVLESEN_H
#define UI_WAVLESEN_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QStatusBar>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include <iostream>
using namespace std;
class Ui_wavLesen
{
public:
QAction *m_actionBeenden;
QWidget *centralwidget;
QWidget *verticalLayout;
QVBoxLayout *vboxLayout;
QVBoxLayout *vboxLayout1;
QLineEdit *m_in_lineEdit;
QPushButton *m_startButton;
QLineEdit *m_out_lineEdit;
QVBoxLayout *vboxLayout2;
QMenuBar *menubar;
QMenu *menu_Datei;
QStatusBar *statusbar;
void Ui_wavLesen::getInLineEdit();
void setupUi(QMainWindow *wavLesen)
{
wavLesen->setObjectName(QString::fromUtf8("wavLesen"));
wavLesen->setContextMenuPolicy(Qt::NoContextMenu);
m_actionBeenden = new QAction(wavLesen);
m_actionBeenden->setObjectName(QString::fromUtf8("m_actionBeenden"));
centralwidget = new QWidget(wavLesen);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(centralwidget->sizePolicy().hasHeightForWidth());
centralwidget->setSizePolicy(sizePolicy);
verticalLayout = new QWidget(centralwidget);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setGeometry(QRect(0, 0, 211, 251));
vboxLayout = new QVBoxLayout(verticalLayout);
vboxLayout->setSpacing(6);
vboxLayout->setMargin(0);
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
vboxLayout1 = new QVBoxLayout();
vboxLayout1->setSpacing(6);
vboxLayout1->setMargin(0);
vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1"));
vboxLayout->addLayout(vboxLayout1);
m_in_lineEdit = new QLineEdit(verticalLayout);
m_in_lineEdit->setObjectName(QString::fromUtf8("m_in_lineEdit"));
vboxLayout->addWidget(m_in_lineEdit);
m_startButton = new QPushButton(verticalLayout);
m_startButton->setObjectName(QString::fromUtf8("m_startButton"));
vboxLayout->addWidget(m_startButton);
m_out_lineEdit = new QLineEdit(verticalLayout);
m_out_lineEdit->setObjectName(QString::fromUtf8("m_out_lineEdit"));
vboxLayout->addWidget(m_out_lineEdit);
vboxLayout2 = new QVBoxLayout();
vboxLayout2->setSpacing(6);
vboxLayout2->setMargin(0);
vboxLayout2->setObjectName(QString::fromUtf8("vboxLayout2"));
vboxLayout->addLayout(vboxLayout2);
wavLesen->setCentralWidget(centralwidget);
menubar = new QMenuBar(wavLesen);
menubar->setObjectName(QString::fromUtf8("menubar"));
menubar->setGeometry(QRect(0, 0, 210, 19));
menu_Datei = new QMenu(menubar);
menu_Datei->setObjectName(QString::fromUtf8("menu_Datei"));
wavLesen->setMenuBar(menubar);
statusbar = new QStatusBar(wavLesen);
statusbar->setObjectName(QString::fromUtf8("statusbar"));
wavLesen->setStatusBar(statusbar);
menubar->addAction(menu_Datei->menuAction());
menu_Datei->addAction(m_actionBeenden);
retranslateUi(wavLesen);
QSize size(210, 280);
size = size.expandedTo(wavLesen->minimumSizeHint());
wavLesen->resize(size);
QObject::connect(m_actionBeenden, SIGNAL(triggered()), wavLesen, SLOT(close()));
QMetaObject::connectSlotsByName(wavLesen);
} // setupUi
void retranslateUi(QMainWindow *wavLesen)
{
wavLesen->setWindowTitle(QApplication::translate("wavLesen", "wavLesen", 0, QApplication::UnicodeUTF8));
m_actionBeenden->setText(QApplication::translate("wavLesen", "&Beenden", 0, QApplication::UnicodeUTF8));
m_startButton->setText(QApplication::translate("wavLesen", "Start", 0, QApplication::UnicodeUTF8));
menu_Datei->setTitle(QApplication::translate("wavLesen", "&Datei", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
inline void Ui_wavLesen::getInLineEdit()
{
cout << "bin hier";
}
namespace Ui {
class wavLesen: public Ui_wavLesen {};
} // namespace Ui
#endif // UI_WAVLESEN_H
wie ihr seht schreibe ich unten ne kleine get Methode naja mal sehen ob das was wird. Wenn ihr besseren weg wisst wäre ich froh. Bzw. wenn ihr zu der get spart nicht mit Kritik. Irgendwie muss ich doch m_in_lineEdit als Variable in die MainWindow.cpp bekommen.
Sry das ich soooooviel Code nun mitgeschickt habe... hoffe das hilft etwas...