-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Итоговый PR: mouseartiom #6
base: master
Are you sure you want to change the base?
Changes from 69 commits
8d368e7
45851b5
3eec2bf
ae6d278
b03829f
1c9a669
b4ee6c1
c0b02ee
3d35bbf
47528ac
77e8c10
e598b20
1150164
14ab8f6
75405c8
094d958
fab1a91
866f45c
f0c9cff
2aedb01
13cc973
11a3566
359a41d
4c61732
ec1c69e
7a99dcc
728bab5
f6b95a0
291b5a7
4beb074
9bca0ee
806dc48
4a47cb9
117a12a
b35eb9f
a5ddf66
dac9c26
949ca60
b91667f
ce5db1e
24de712
7d8b3e3
8c18fe4
a4d3713
3719cc5
725f248
01ce70e
ccda882
dc6ee0d
c2a28d5
68ee06b
a92b10d
e45f7b8
408afe4
22b296a
c18fe16
5c25f1a
8def7a7
cd596b0
0d40f96
9246da3
3a70dea
68ddc13
cb07a42
b883c88
b4fa607
e3e8bfb
867879d
38e25b1
116a39e
47238a3
2854e54
cbc78ac
02074f6
09bd86b
dfdf850
f91d0e8
11c583c
39d7b1c
47bec5a
b666d90
53c17c6
891f9fb
ea9832c
1f5d458
3ffbe3b
615791c
c346a49
3985fb4
ca6425c
3e7fa1d
7a508ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.[oa] | ||
*vgcore* | ||
.vscode/** | ||
*.txt | ||
*.out | ||
*.exe | ||
*test* | ||
*.gch |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2018-04-12T00:30:21 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = adventure | ||
TEMPLATE = app | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which has been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
|
||
SOURCES += \ | ||
main.cpp \ | ||
mainwindow.cpp \ | ||
loading.cpp \ | ||
logbook.cpp \ | ||
mapfield.cpp | ||
|
||
HEADERS += \ | ||
mainwindow.h \ | ||
loading.h \ | ||
logbook.h \ | ||
mapfield.h | ||
|
||
FORMS += \ | ||
mainwindow.ui \ | ||
loading.ui |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "loading.h" | ||
#include "ui_loading.h" | ||
|
||
Loading::Loading(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::Loading) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
Loading::~Loading() | ||
{ | ||
delete ui; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef LOADING_H | ||
#define LOADING_H | ||
|
||
#include <QWidget> | ||
|
||
namespace Ui { | ||
class Loading; | ||
} | ||
|
||
class Loading : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit Loading(QWidget *parent = 0); | ||
~Loading(); | ||
|
||
private: | ||
Ui::Loading *ui; | ||
}; | ||
|
||
#endif // LOADING_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Loading</class> | ||
<widget class="QWidget" name="Loading"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "logbook.h" | ||
|
||
LogBook::LogBook(QWidget *parent) : QWidget(parent) | ||
{ | ||
|
||
} | ||
|
||
void printNewLine(QString newLine) { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef LOGBOOK_H | ||
#define LOGBOOK_H | ||
|
||
#include <QWidget> | ||
|
||
class LogBook : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit LogBook(QWidget *parent = nullptr); | ||
|
||
signals: | ||
|
||
public slots: | ||
void printNewLine(QString newLine); | ||
}; | ||
|
||
#endif // LOGBOOK_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "mainwindow.h" | ||
#include <QApplication> | ||
#include <QDebug> | ||
#include <QPoint> | ||
#include <QMouseEvent> | ||
#include <QtWidgets> | ||
#include "mapfield.h" | ||
|
||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
MainWindow mainWind; | ||
|
||
mainWind.show(); | ||
|
||
return a.exec(); | ||
} | ||
|
||
/*bool MapField::event(QMouseEvent *event) | ||
{ | ||
|
||
|
||
return true; | ||
} | ||
|
||
|
||
|
||
url(./img/map.png)*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "mainwindow.h" | ||
#include "ui_mainwindow.h" | ||
|
||
#include <QDebug> | ||
#include <QMouseEvent> | ||
|
||
MainWindow::MainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::MainWindow) | ||
{ | ||
ui->setupUi(this); | ||
|
||
MapField *mf = new MapField(this); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. где эти поля уничтожаются? |
||
LogBook *lb = new LogBook(this); | ||
|
||
connect(mf, &MapField::sendNewLine, lb, &LogBook::printNewLine); | ||
|
||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
qDebug() << "x = " << w.x(); | ||
qDebug() << "y = " << w.y(); | ||
qDebug() << "height = " << w.height(); | ||
qDebug() << "width = " << w.width(); | ||
QPoint pos = w.mapToGlobal(QPoint(0,0)); | ||
qDebug() << "x = " << pos.rx(); | ||
qDebug() << "y = " << pos.ry(); | ||
qDebug() << "x = " << pos.x(); | ||
qDebug() << "y = " << pos.y(); | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
|
||
#include <QMainWindow> | ||
|
||
#include "mapfield.h" | ||
#include "logbook.h" | ||
|
||
namespace Ui { | ||
class MainWindow; | ||
} | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = 0); | ||
~MainWindow(); | ||
|
||
private: | ||
Ui::MainWindow *ui; | ||
//MapField *map; | ||
}; | ||
|
||
#endif // MAINWINDOW_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>MainWindow</class> | ||
<widget class="QMainWindow" name="MainWindow"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>1500</width> | ||
<height>1000</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralWidget"> | ||
<widget class="QLineEdit" name="enterDecisionLine"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>1000</x> | ||
<y>960</y> | ||
<width>501</width> | ||
<height>41</height> | ||
</rect> | ||
</property> | ||
<property name="text"> | ||
<string>enter smth</string> | ||
</property> | ||
</widget> | ||
<widget class="QTextEdit" name="logBook"> | ||
<property name="enabled"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="geometry"> | ||
<rect> | ||
<x>1000</x> | ||
<y>270</y> | ||
<width>501</width> | ||
<height>691</height> | ||
</rect> | ||
</property> | ||
<property name="acceptDrops"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="html"> | ||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
p, li { white-space: pre-wrap; } | ||
</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;" bgcolor="#0000ff"> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">fsdfsdf</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">dfsdfsdf</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">dsfds</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">f</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">dsf</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">dsf</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">sd</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">fds</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">f</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">ds</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">fd</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">sf</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">ds</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">fsd</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">f</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">sd</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#d6d6d6;">f</span></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#d6d6d6;"><br /></p></body></html></string> | ||
</property> | ||
<property name="textInteractionFlags"> | ||
<set>Qt::TextSelectableByMouse</set> | ||
</property> | ||
<property name="placeholderText"> | ||
<string/> | ||
</property> | ||
</widget> | ||
<widget class="QTextEdit" name="heroInfo"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>1000</x> | ||
<y>0</y> | ||
<width>501</width> | ||
<height>271</height> | ||
</rect> | ||
</property> | ||
</widget> | ||
<widget class="MapField" name="mapFieldWidget" native="true"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>1001</width> | ||
<height>1001</height> | ||
</rect> | ||
</property> | ||
<property name="autoFillBackground"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="styleSheet"> | ||
<string notr="true">background-color: #ddbbcc;</string> | ||
</property> | ||
</widget> | ||
</widget> | ||
</widget> | ||
<layoutdefault spacing="6" margin="11"/> | ||
<customwidgets> | ||
<customwidget> | ||
<class>MapField</class> | ||
<extends>QWidget</extends> | ||
<header>mapfield.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "mapfield.h" | ||
#include <QDebug> | ||
#include <QPoint> | ||
#include <QMouseEvent> | ||
|
||
MapField::MapField(QWidget *parent) : QWidget(parent) | ||
{ | ||
} | ||
|
||
void MapField::mouseReleaseEvent(QMouseEvent *e) { | ||
qDebug() << "Mouse event worked"; | ||
QPoint point = e->pos(); | ||
|
||
qDebug() << point.x() << " and " << point.y(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. пока реализация не особо осмысленная.. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef MAPFIELD_H | ||
#define MAPFIELD_H | ||
|
||
#include <QWidget> | ||
|
||
class MapField : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit MapField(QWidget *parent = nullptr); | ||
|
||
protected: | ||
void mouseReleaseEvent(QMouseEvent *e); | ||
|
||
signals: | ||
void sendNewLine(QString newLine); | ||
|
||
public slots: | ||
}; | ||
|
||
#endif // MAPFIELD_H |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
где используется большая часть всех этих хедеров?