This repository was archived by the owner on May 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.cpp
More file actions
42 lines (33 loc) · 1.28 KB
/
MainWindow.cpp
File metadata and controls
42 lines (33 loc) · 1.28 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
#include <QtGui>
#include "MainWindow.h"
MainWindow::MainWindow()
{
setWindowTitle("Funky ScreenShot");
QDesktopWidget* bureau = QApplication::desktop();
int x = (bureau->screenGeometry(bureau->primaryScreen()).width()/2) - (width()/2);
int y = (bureau->screenGeometry(bureau->primaryScreen()).height()/2) - (height()/2);
move(x,y);
VLayout = new QVBoxLayout;
selectScreenBt = new QPushButton("Selectionner un espace de screen");
lastScreenLb = new QLabel;
screenArea = new ScreenArea; // Espace de sélection
screenArea->setVisible(false);
VLayout->addWidget(selectScreenBt);
VLayout->addWidget(lastScreenLb);
setLayout(VLayout);
QObject::connect(selectScreenBt,SIGNAL(clicked()),this,SLOT(selectScreen())); // Sélectionner un espace de screen
QObject::connect(screenArea,SIGNAL(leaveArea()),this,SLOT(leaveArea())); // On quitte l'espace de screen
QObject::connect(screenArea, SIGNAL(screenSaved(QString)), this, SLOT(leaveArea(QString)));
}
void MainWindow::selectScreen()
{
setVisible(false);
screenArea->setVisible(true);
}
void MainWindow::leaveArea(QString lastScreen)
{
setVisible(true);
screenArea->setVisible(false);
if(lastScreen != "")
lastScreenLb->setText("Dernier screen : " + lastScreen);
}