You have errors in your code...
verticalLayout
= new QWidget(parent
);
verticalLayout = new QWidget(parent);
To copy to clipboard, switch view to plain text mode
Why do you create a widget in a widget? You should create a vertical layout here and not a widget.
I have changed your code a little:
#ifndef CONNECTIONMANAGER_H
#define CONNECTIONMANAGER_H
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QTextBrowser>
#include <QLineEdit>
#include <QSpacerItem>
{
Q_OBJECT
public:
public slots:
void zetTekst(void);
signals:
void chatBericht(void);
private:
//opvulling
};
#endif
#ifndef CONNECTIONMANAGER_H
#define CONNECTIONMANAGER_H
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QTextBrowser>
#include <QLineEdit>
#include <QSpacerItem>
class ChatWindow : public QWidget
{
Q_OBJECT
public:
ChatWindow(QWidget *parent = 0);
public slots:
void zetTekst(void);
signals:
void chatBericht(void);
private:
QTextEdit *tekstVak;
QLineEdit *verzendLijn;
QPushButton *verzendKnop;
//opvulling
};
#endif
To copy to clipboard, switch view to plain text mode
#include "chatwindow.h"
{
hlay->addWidget(verzendLijn);
hlay->addWidget(verzendKnop);
lay->addWidget(tekstVak);
lay->addLayout(hlay);
setLayout(lay);
//connect(verzendLijn, SIGNAL(returnPressed()), verzendKnop, SLOT(animateClick()));
connect(verzendKnop, SIGNAL(clicked()), this, SIGNAL(chatBericht()));
}
void ChatWindow::zetTekst()
{
tekstVak->append(tr("Test"));
}
#include "chatwindow.h"
ChatWindow::ChatWindow(QWidget *parent) : QWidget(parent)
{
QVBoxLayout *lay = new QVBoxLayout;
tekstVak = new QTextBrowser;
verzendLijn = new QLineEdit;
verzendKnop = new QPushButton(tr("Verzenden"));
QHBoxLayout *hlay = new QHBoxLayout;
hlay->addWidget(verzendLijn);
hlay->addWidget(verzendKnop);
lay->addWidget(tekstVak);
lay->addLayout(hlay);
setLayout(lay);
//connect(verzendLijn, SIGNAL(returnPressed()), verzendKnop, SLOT(animateClick()));
connect(verzendKnop, SIGNAL(clicked()), this, SIGNAL(chatBericht()));
}
void ChatWindow::zetTekst()
{
tekstVak->append(tr("Test"));
}
To copy to clipboard, switch view to plain text mode
The result attached (BTW. You could have used Designer to make your widget):
Bookmarks