MainWindow.cpp
1.66 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "stdafx.h"
#include "MainWindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
graphWidget = new PaperGraphWidget;
setCentralWidget(graphWidget);
/*QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(5);
graphWidget->setLayout(layout);*/
createActions();
createMenus();
QString message = tr("test message");
statusBar()->showMessage(message);
setMinimumSize(160, 160);
resize(800, 600);
}
MainWindow::~MainWindow()
{
}
void MainWindow::print_graph(std::ifstream& fin)
{
graphWidget->print_graph(fin);
}
//////////////////////////////////////////////////////////////////
// private methods
//////////////////////////////////////////////////////////////////
void MainWindow::createActions()
{
testHighlightAct = new QAction(tr("&Highlight"), this);
testHighlightAct->setStatusTip(tr("Highlighting node"));
connect(testHighlightAct, &QAction::triggered, this, &MainWindow::test_highlighting);
resetColorAct = new QAction(tr("&Reset colors"), this);
resetColorAct->setStatusTip(tr("Reset all node's color"));
connect(resetColorAct, &QAction::triggered, this, &MainWindow::reset_color);
}
void MainWindow::createMenus()
{
actionMenu = menuBar()->addMenu(tr("&Actions"));
actionMenu->addAction(testHighlightAct);
actionMenu->addAction(resetColorAct);
}
//////////////////////////////////////////////////////////////////
// slots
//////////////////////////////////////////////////////////////////
void MainWindow::test_highlighting()
{
/*QMessageBox::information(this, "test",
"test: "+QString::number(11));*/
graphWidget->path_highlight();
//graphWidget->update();
}
void MainWindow::reset_color()
{
graphWidget->reset_color();
}