-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWidget.cpp
More file actions
47 lines (37 loc) · 1.15 KB
/
MainWidget.cpp
File metadata and controls
47 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <QtWidgets>
#include <QWebEngineView>
#include "MainWidget.h"
#include "APIWebsockets.h"
// Constructor for main widget
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent)
{
button_ = new QPushButton(tr("Pick a point"));
logger_ = new QPlainTextEdit();
logger_->setReadOnly(true);
socketServer_ = new APIWebsockets(1111, this);
webEngineView_ = new QWebEngineView(this);
webEngineView_->load(QUrl("http://localhost:1234/examples/test_projet_info.html"));
QHBoxLayout *mainLayout = new QHBoxLayout();
QGridLayout *leftLayout = new QGridLayout();
leftLayout->addWidget(button_,0,0);
leftLayout->addWidget(logger_,1,0);
mainLayout->addLayout(leftLayout);
mainLayout->addWidget(webEngineView_);
mainLayout->setStretch(1,2);
setLayout(mainLayout);
setWindowTitle(tr("PotreeAPI demonstrator"));
//Signal and slots connexion
connect(button_, SIGNAL(released()), socketServer_, SLOT(initPointPicking()));
}
// Destructor
MainWidget::~MainWidget()
{
delete button_;
delete logger_;
delete webEngineView_;
}
void MainWidget::log(QString text)
{
this->logger_->appendPlainText(text);
}