Skip to content

Commit 23ee7f1

Browse files
Add files via upload
1 parent 34c374e commit 23ee7f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3214
-0
lines changed

Odev1/Homework/Balon.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include <QRandomGenerator>
2+
#include "clickablelabel.h"
3+
4+
class Balon{
5+
6+
public:
7+
8+
// Constructor
9+
Balon(ClickableLabel *label_temp, int wid){
10+
11+
x= 9 + (QRandomGenerator::global()->generate() % (wid-68));
12+
label=label_temp;
13+
14+
label->setFixedWidth(50);
15+
label->setFixedHeight(50);
16+
17+
label->move(x,80);
18+
19+
int a=QRandomGenerator::global()->generate()%7;
20+
QString temp = ":/images/images/"+QString::number(a)+".jpg";
21+
22+
QPixmap pix(temp);
23+
label->setPixmap(pix.scaled(50,50,Qt::KeepAspectRatio));
24+
25+
label->show();
26+
}
27+
28+
// balonun konumunu asagiya kaydirma
29+
void new_move(){
30+
31+
getLabel()->move(x, getLabel()->pos().y()+6);
32+
33+
}
34+
35+
// balon disari ciktimi kontrolu
36+
static int check(Balon *bal, int H){
37+
38+
if(bal->label->pos().y()>H+4){
39+
return 1;
40+
}
41+
42+
else{
43+
return 0;
44+
}
45+
46+
}
47+
48+
ClickableLabel * getLabel(){
49+
return label;
50+
}
51+
52+
private:
53+
54+
// balon konumu
55+
int x;
56+
57+
// tiklanabilir label
58+
ClickableLabel *label;
59+
60+
};

Odev1/Homework/Homework.pro

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
QT += core gui
2+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
3+
4+
CONFIG += c++11
5+
6+
# The following define makes your compiler emit warnings if you use
7+
# any Qt feature that has been marked deprecated (the exact warnings
8+
# depend on your compiler). Please consult the documentation of the
9+
# deprecated API in order to know how to port your code away from it.
10+
DEFINES += QT_DEPRECATED_WARNINGS
11+
12+
# You can also make your code fail to compile if it uses deprecated APIs.
13+
# In order to do so, uncomment the following line.
14+
# You can also select to disable deprecated APIs only up to a certain version of Qt.
15+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
16+
17+
SOURCES += \
18+
Balon.cpp \
19+
clickablelabel.cpp \
20+
main.cpp \
21+
mainwindow.cpp
22+
23+
HEADERS += \
24+
clickablelabel.h \
25+
mainwindow.h
26+
27+
FORMS += \
28+
mainwindow.ui
29+
30+
# Default rules for deployment.
31+
qnx: target.path = /tmp/$${TARGET}/bin
32+
else: unix:!android: target.path = /opt/$${TARGET}/bin
33+
!isEmpty(target.path): INSTALLS += target
34+
35+
RESOURCES += \
36+
images.qrc

Odev1/Homework/Homework.pro.user

Lines changed: 321 additions & 0 deletions
Large diffs are not rendered by default.

Odev1/Homework/clickablelabel.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "clickablelabel.h"
2+
3+
ClickableLabel::ClickableLabel(QWidget* parent, Qt::WindowFlags f)
4+
: QLabel(parent) {
5+
6+
}
7+
8+
ClickableLabel::~ClickableLabel() {}
9+
10+
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
11+
emit clicked();
12+
}

Odev1/Homework/clickablelabel.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef CLICKABLELABEL_H
2+
#define CLICKABLELABEL_H
3+
4+
#include <QLabel>
5+
#include <QWidget>
6+
#include <Qt>
7+
8+
class ClickableLabel : public QLabel {
9+
Q_OBJECT
10+
11+
public:
12+
explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
13+
~ClickableLabel();
14+
15+
signals:
16+
void clicked();
17+
18+
protected:
19+
void mousePressEvent(QMouseEvent* event);
20+
21+
};
22+
23+
#endif // CLICKABLELABEL_H

Odev1/Homework/images.qrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<RCC>
2+
<qresource prefix="/images">
3+
<file>images/0.jpg</file>
4+
<file>images/1.jpg</file>
5+
<file>images/2.jpg</file>
6+
<file>images/3.jpg</file>
7+
<file>images/4.jpg</file>
8+
<file>images/5.jpg</file>
9+
<file>images/6.jpg</file>
10+
<file>images/arkaplan.jpg</file>
11+
<file>images/patlama.jpg</file>
12+
</qresource>
13+
</RCC>

Odev1/Homework/images/0.jpg

82.3 KB
Loading

Odev1/Homework/images/1.jpg

56.5 KB
Loading

Odev1/Homework/images/2.jpg

6.02 KB
Loading

Odev1/Homework/images/3.jpg

14.2 KB
Loading

0 commit comments

Comments
 (0)