-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
78 lines (66 loc) · 1.97 KB
/
Copy pathmainwindow.cpp
File metadata and controls
78 lines (66 loc) · 1.97 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
69
70
71
72
73
74
75
76
77
78
#include "mainwindow.h"
#include "qgigimageviewer.h"
#include "gigbmpimage.h"
#include "qgigimagegraphicsview.h"
#include "qgigimagegraphicsscene.h"
#include "qthreadedgigimagegraphicsscene.h"
#include <QAction>
#include <QFileDialog>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QHBoxLayout>
#include <QMenu>
#include <QMenuBar>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, m_view(0)
, m_scene(0)
{
m_scene = new QThreadedGigImageGraphicsScene;
m_view = new QGigImageGraphicsView;
m_view->init(m_scene);
setCentralWidget(m_view);
createActions();
createMenus();
// if(m_scene->loadImage("c:/temp/RECORD_110715_174326/left/GoldenImage.bmp")) {
// m_view->resetTransform();
// }
}
MainWindow::~MainWindow()
{
}
void MainWindow::open(void)
{
QString filePath = QFileDialog::getOpenFileName(this,
tr("Open a gray scale image"),
"", // current dir
tr("BMP File(*.bmp)"));
if(!filePath.isEmpty()) {
if(m_scene->loadImage(filePath)) {
m_view->resetTransform();
}
}
}
void MainWindow::exit(void)
{
}
void MainWindow::createActions()
{
m_openAction = new QAction(tr("&Open"), this);
m_openAction->setIcon(QIcon(":/QGigImageViewer/images/open.png"));
m_openAction->setShortcut(tr("Ctrl+O"));
m_openAction->setStatusTip(tr("Open a 8 bit grayscale image file in windows bmp format"));
connect(m_openAction, SIGNAL(triggered()), this, SLOT(open()));
m_exitAction = new QAction(tr("E&xit"), this);
m_openAction->setIcon(QIcon(":/QGigImageViewer/images/exit.png"));
m_exitAction->setShortcut(tr("Ctrl+Q"));
m_exitAction->setStatusTip(tr("Exit the application"));
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close()));
}
void MainWindow::createMenus(void)
{
m_fileMenu = menuBar()->addMenu(tr("&File"));
m_fileMenu->addAction(m_openAction);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_exitAction);
}