-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
66 lines (55 loc) · 2.14 KB
/
mainwindow.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "mainwindow.h"
/**
* @brief Construct a new Main Window:: Main Window object
*
* @param parent
*/
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , consoleWidget(new ConsoleWidget())
{
this->createCentralWidget();
this->createDockWindows();
this->setWindowTitle("Embedded Python Console Test Application");
this->resize(500,600);
}
/**
* @brief Destroy the Main Window:: Main Window object
*
*/
MainWindow::~MainWindow()
{
}
/**
* @brief Creates the Central Widget
*
*/
void MainWindow::createCentralWidget()
{
QGroupBox* formGroupBox = new QGroupBox(tr("Passing Varibles to Python Console Test:"));
QFormLayout *layout = new QFormLayout;
QPushButton* button1 = new QPushButton(tr("Int Arrary"));
QPushButton* button2 = new QPushButton(tr("Double Arrary"));
QPushButton* button3 = new QPushButton(tr("Char Arrary"));
layout->addRow(new QLabel(tr("Add Numpy Arrary called x to python console:")), button1);
layout->addRow(new QLabel(tr("Add Numpy Arrary called y to python console:")), button2);
layout->addRow(new QLabel(tr("TODO Dialog Test")), button3);
layout->addRow(new QTextEdit());
formGroupBox->setLayout(layout);
this->setCentralWidget(formGroupBox);
//Dummy Data to Test - Sending to Python.
int myNum[3] = {10, 20, 30};
double balance[5] = {1000.0, 2.0, 3.4, 17.0, 50.0};
const char* cars[4] = {"Volvo", "BMW", "Ford", "Mazda"};
// QObject::connect(button1, &QPushButton::clicked, this, &ConsoleWidget::updateConsole , Qt::QueuedConnection);
// QObject::connect(button2, &QPushButton::clicked, this, &ConsoleWidget::updateConsole , Qt::QueuedConnection);
// QObject::connect(button3, &QPushButton::clicked, this, &ConsoleWidget::updateConsole , Qt::QueuedConnection);
}
/**
* @brief Create all the Dock Windows
*
*/
void MainWindow::createDockWindows(){
QDockWidget* dock = new QDockWidget(tr("Python Console"), this);
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
dock->setWidget(consoleWidget);
this->addDockWidget(Qt::BottomDockWidgetArea, dock);
}