Commit b363e54a authored by roangel's avatar roangel
Browse files

Added svg Crazyfly class, with coordinate system

parent 551b118b
...@@ -30,11 +30,15 @@ set(CMAKE_AUTOMOC ON) ...@@ -30,11 +30,15 @@ set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED) find_package(Qt5Gui REQUIRED)
find_package(Qt5Svg REQUIRED)
# GUI -- Add src and includes # GUI -- Add src and includes
set(MY_LIB_PATH_SRC ${PROJECT_SOURCE_DIR}/GUI_Qt/CrazyFlyGUI/src) set(MY_LIB_PATH_SRC ${PROJECT_SOURCE_DIR}/GUI_Qt/CrazyFlyGUI/src)
set(MY_LIB_PATH_INC ${PROJECT_SOURCE_DIR}/GUI_Qt/CrazyFlyGUI/include) set(MY_LIB_PATH_INC ${PROJECT_SOURCE_DIR}/GUI_Qt/CrazyFlyGUI/include)
# GUI -- Resource file
set(MY_RESOURCE_FILE_QRC ${PROJECT_SOURCE_DIR}/GUI_Qt/CrazyFlyGUI/CrazyFlyGUI.qrc)
# #set the default path for built executables to the "bin" directory # #set the default path for built executables to the "bin" directory
# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) # set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# #set the default path for built libraries to the "lib" directory # #set the default path for built libraries to the "lib" directory
...@@ -56,6 +60,9 @@ set(SRC_HDRS_QOBJECT ...@@ -56,6 +60,9 @@ set(SRC_HDRS_QOBJECT
qt5_wrap_ui(UIS_HDRS GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui) qt5_wrap_ui(UIS_HDRS GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui)
qt5_wrap_cpp(SRC_MOC_HDRS ${SRC_HDRS_QOBJECT}) qt5_wrap_cpp(SRC_MOC_HDRS ${SRC_HDRS_QOBJECT})
# GUI -- wrap resource file qrc->rcc
qt5_add_resources(MY_RESOURCE_FILE_RCC ${MY_RESOURCE_FILE_QRC})
## Uncomment this if the package has a setup.py. This macro ensures ## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed ## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
...@@ -208,7 +215,7 @@ add_executable(CentralManagerService src/CentralManagerService.cpp) ...@@ -208,7 +215,7 @@ add_executable(CentralManagerService src/CentralManagerService.cpp)
# Add sources here # GUI -- Add sources here
set(MY_CPP_SOURCES # compilation of sources set(MY_CPP_SOURCES # compilation of sources
${MY_LIB_PATH_SRC}/mainguiwindow.cpp ${MY_LIB_PATH_SRC}/mainguiwindow.cpp
${MY_LIB_PATH_SRC}/main.cpp ${MY_LIB_PATH_SRC}/main.cpp
...@@ -224,8 +231,8 @@ set(MY_CPP_SOURCES # compilation of sources ...@@ -224,8 +231,8 @@ set(MY_CPP_SOURCES # compilation of sources
) )
# Add executables here # GUI -- Add executables here
add_executable(my_GUI ${MY_CPP_SOURCES} ${UIS_HDRS} ${SRC_MOC_HDRS}) add_executable(my_GUI ${MY_CPP_SOURCES} ${UIS_HDRS} ${SRC_MOC_HDRS} ${MY_RESOURCE_FILE_RCC})
qt5_use_modules(my_GUI Widgets) qt5_use_modules(my_GUI Widgets)
...@@ -272,10 +279,13 @@ target_link_libraries(CentralManagerService ${catkin_LIBRARIES}) ...@@ -272,10 +279,13 @@ target_link_libraries(CentralManagerService ${catkin_LIBRARIES})
# GUI -- link libraries # GUI -- link libraries
target_link_libraries(my_GUI Qt5::Widgets) # GUI -- let my_GUI have acesss to Qt stuff target_link_libraries(my_GUI Qt5::Widgets) # GUI -- let my_GUI have acesss to Qt stuff
target_link_libraries(my_GUI Qt5::Svg)
# target_link_libraries(my_library Qt5::Widgets) # GUI -- let my_library have access to Qt stuff # target_link_libraries(my_library Qt5::Widgets) # GUI -- let my_library have access to Qt stuff
# target_link_libraries(my_GUI my_library) # target_link_libraries(my_GUI my_library)
target_link_libraries(my_GUI ${catkin_LIBRARIES}) target_link_libraries(my_GUI ${catkin_LIBRARIES})
############# #############
## Install ## ## Install ##
############# #############
......
...@@ -16,6 +16,8 @@ CONFIG += c++11 ...@@ -16,6 +16,8 @@ CONFIG += c++11
RESOURCES = CrazyFlyGUI.qrc RESOURCES = CrazyFlyGUI.qrc
QT+= svg
SOURCES += \ SOURCES += \
src/cornergrabber.cpp \ src/cornergrabber.cpp \
...@@ -27,7 +29,8 @@ SOURCES += \ ...@@ -27,7 +29,8 @@ SOURCES += \
src/myGraphicsScene.cpp \ src/myGraphicsScene.cpp \
src/myGraphicsView.cpp \ src/myGraphicsView.cpp \
src/tablePiece.cpp \ src/tablePiece.cpp \
src/marker.cpp src/marker.cpp \
src/crazyFly.cpp
HEADERS += \ HEADERS += \
include/cornergrabber.h \ include/cornergrabber.h \
...@@ -39,7 +42,8 @@ HEADERS += \ ...@@ -39,7 +42,8 @@ HEADERS += \
include/myGraphicsView.h \ include/myGraphicsView.h \
include/tablePiece.h \ include/tablePiece.h \
include/globalDefinitions.h \ include/globalDefinitions.h \
include/marker.h include/marker.h \
include/crazyFly.h
FORMS += \ FORMS += \
src/mainguiwindow.ui src/mainguiwindow.ui
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.2, 2017-05-11T12:29:20. --> <!-- Written by QtCreator 4.0.2, 2017-05-11T18:09:24. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
......
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource> <qresource>
<file>images/drone.png</file> <file>images/drone.png</file>
<file>images/drone.svg</file>
<file>images/drone_fixed.svg</file>
</qresource> </qresource>
</RCC> </RCC>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"><path d="M4689,4986.9c-254.7-46-528.5-157-741-300.6c-126.4-86.2-375.3-331.3-469.1-463.4c-677.8-951.6-333.2-2284.3,723.8-2795.5c97.7-45.9,241.3-101.5,319.8-120.6c136-36.4,143.6-40.2,139.8-90c-13.4-174.2-248.9-495.9-448.1-616.6C4105,535.1,3879.1,447,3861.8,462.4c-3.8,5.7-30.6,84.2-55.5,174.2c-26.8,90-70.8,214.5-97.7,275.7c-176.2,398.3-589.7,796.5-1001.4,965c-262.3,107.2-367.6,124.5-731.4,122.5c-308.3,0-348.5-3.8-507.4-53.6C342.5,1601.6-212.8,380,281.2-665.4c109.1-229.8,216.4-379.1,404-561c172.3-164.7,266.2-233.6,457.6-327.4c942.1-472.9,2085.2-82.3,2546.6,871.2c46,97.7,101.5,241.3,120.6,319.8c36.4,137.9,40.2,143.6,91.9,139.8c30.6-1.9,126.4-38.3,210.6-82.3c116.8-57.4,183.8-107.2,271.9-201c116.8-122.5,239.3-340.8,264.2-465.3c11.5-55.5,7.7-59.4-70.8-80.4c-352.3-88.1-630-237.4-878.9-472.9c-271.9-256.6-446.1-543.8-540-888.4c-38.3-139.8-44-203-42.1-495.9c0-308.3,3.8-348.5,53.6-505.5c203-664.4,691.2-1133.5,1367.1-1317.3c220.2-59.3,656.8-59.3,892.3,0c203,51.7,486.4,180,651,298.7c141.7,101.5,379.1,346.6,472.9,490.2c553.4,838.7,365.7,1947.3-428.9,2548.6c-183.8,139.8-442.3,266.1-645.3,319.7c-137.9,36.4-143.6,40.2-139.8,91.9c1.9,30.6,38.3,126.4,82.3,210.6c57.5,116.8,107.2,183.8,199.2,271.9C5746-384,5966.2-259.5,6086.8-236.5c59.4,11.5,61.3,9.6,82.3-70.8c93.8-377.2,241.3-639.5,507.4-909.5c270-271.9,522.7-419.3,880.8-517c109.2-28.7,197.2-36.4,469.1-34.5c308.3,0,348.5,3.8,505.5,53.6c296.8,90,557.2,239.3,773.6,440.4c593.6,555.3,762.1,1438,417.4,2167.5c-109.1,229.8-178,327.4-354.2,513.1c-237.4,245.1-480.6,396.4-798.4,495.9c-748.7,237.4-1581.6-30.6-2058.4-662.5c-139.8-183.8-266.2-442.3-319.8-645.3c-36.4-137.9-40.2-143.6-91.9-139.8c-30.6,1.9-126.4,38.3-210.6,82.3c-116.8,57.5-183.8,107.2-271.9,201.1c-116.8,122.5-239.3,340.8-264.2,465.3c-11.5,55.5-7.7,59.4,70.8,80.4c45.9,11.5,126.4,34.5,180,51.7c499.7,160.8,944,570.6,1148.9,1056.9c114.9,273.8,134,379.1,132.1,748.7c0,308.3-3.8,348.5-53.6,505.5C6544.4,4586.7,5633,5157.3,4689,4986.9z M5403.2,4663.3c180-46,490.2-203,616.6-314c384.9-331.3,570.6-729.5,570.6-1217.8c0-584-302.5-1102.9-806.1-1386.3c-114.9-63.2-327.4-143.6-442.3-164.7c-63.2-11.5-72.8-9.6-80.4,30.6c-38.3,178.1-88.1,754.4-88.1,1034v166.6l74.7,74.7c160.8,160.8,143.6,392.5-40.2,528.5c-53.6,40.2-210.6,65.1-291,44c-68.9-17.2-183.8-124.5-214.5-197.2c-57.4-134-9.6-329.3,97.7-400.2c46-30.6,47.9-38.3,47.9-235.5c0-317.9-63.2-982.3-95.7-1037.8c-19.1-28.7-271.9,40.2-427,118.7c-901.9,451.9-1168,1585.4-562.9,2382c113,147.4,294.9,310.2,461.5,409.8c120.6,72.8,373.4,164.7,528.5,191.5C4895.8,4716.9,5252,4701.6,5403.2,4663.3z M2406.6,1659.1c178.1-49.8,446.1-189.6,585.9-306.4c245.1-201.1,453.8-526.6,526.6-823.3c24.9-101.5,26.8-134,9.6-145.5c-51.7-30.6-744.8-93.8-1058.9-95.7h-166.6l-72.8,76.6c-132.1,137.9-319.8,147.4-467.2,24.9c-76.6-65.1-113-151.3-113-264.2c0-252.8,270-413.6,497.8-296.8c42.1,21.1,90,59.4,107.2,86.2c30.6,46,38.3,47.9,235.5,47.9c317.9,0,982.3-63.2,1037.8-95.7c15.3-9.6,9.6-55.5-19.2-160.8c-135.9-492.1-518.9-899.9-1003.3-1066.5c-698.9-241.3-1468.6,30.6-1859.2,658.7C365.5-249.9,331,314.9,557,797.4c206.8,440.4,584,750.6,1053.1,869.3C1793.9,1714.6,2226.6,1708.9,2406.6,1659.1z M8386.4,1638C9114,1465.7,9638.7,759.1,9590.8,16.2c-13.4-216.4-59.4-390.6-147.5-580.2c-91.9-197.2-157-291-308.3-444.2c-306.4-310.2-681.6-465.3-1122-465.3c-612.7,0-1158.4,340.8-1422.7,886.5c-91.9,191.5-151.3,411.7-116.8,434.7c51.7,30.6,746.8,93.8,1060.8,95.7c166.6,0,170.4-1.9,220.2-59.3c59.3-70.8,180-132.1,262.3-132.1c88.1,0,208.7,65.1,268.1,141.7c55.5,74.7,82.4,212.5,59.3,306.4c-17.2,68.9-124.5,183.8-197.2,214.5c-134,57.4-329.4,9.6-400.2-97.7c-30.6-45.9-38.3-47.9-235.5-47.9c-317.8,0-980.3,61.3-1035.9,95.7c-32.5,19.2,19.1,216.4,107.2,400.2c227.9,484.4,679.7,821.4,1204.4,901.8C7934.5,1687.8,8231.3,1674.4,8386.4,1638z M4742.6-1381.6c24.9-111.1,67-562.9,78.5-863.6l13.4-333.2L4756-2653c-141.7-134-153.2-321.7-28.7-469.1c65.1-76.6,151.3-113,264.2-113c252.8,0,413.6,270,296.8,497.8c-21.1,42.1-59.3,90-86.2,107.2c-45.9,30.6-47.9,38.3-47.9,245.1c0,323.6,61.3,968.9,95.7,1026.3c19.2,32.6,216.4-19.2,400.2-107.2c687.4-323.6,1045.4-1066.5,871.2-1807.5c-44.1-187.6-197.2-486.4-327.4-639.5c-203-243.2-497.8-428.9-806.1-513.2c-201-53.6-585.9-57.4-779.3-7.6c-386.8,101.5-733.3,346.6-942.1,668.2c-195.3,298.7-262.3,549.5-250.8,932.5c9.6,287.2,51.7,446.1,180,691.2c185.7,352.3,559.1,652.9,947.8,764C4706.2-1329.9,4731.1-1331.8,4742.6-1381.6z"/><path d="M5638.7,4200c-13.4-3.8-24.9-32.5-24.9-59.3c0-40.2,26.8-72.8,109.2-137.9c199.1-157,344.7-394.4,388.7-631.9c34.5-180,46-214.5,82.4-237.4c107.2-68.9,132.1,157,46,407.8c-84.3,241.3-227.9,446.1-421.3,597.4C5730.6,4209.5,5692.4,4222.9,5638.7,4200z"/><path d="M5416.6,3853.4c-19.1-19.2-32.6-44-32.6-53.6c0-9.6,51.7-67,114.9-128.3c130.2-124.5,201.1-250.8,235.5-419.3c26.8-128.3,67-174.2,124.5-137.9c80.4,51.7,26.8,321.7-105.3,520.8c-68.9,103.4-235.5,252.8-281.5,252.8C5458.7,3887.9,5433.9,3872.5,5416.6,3853.4z"/><path d="M4158.6,3125.8c-44-34.5-44-40.2-21.1-158.9c34.5-176.1,105.3-310.2,235.5-450c120.6-128.3,187.6-162.8,235.5-122.5c51.7,44,30.6,95.7-82.3,201.1c-122.5,113-208.7,271.9-229.8,425.1C4279.2,3135.4,4223.7,3177.5,4158.6,3125.8z"/><path d="M3739.3,3087.5c-23-44.1,17.2-279.6,72.8-427c82.3-216.4,325.5-520.8,476.8-599.3c49.8-24.9,61.3-24.9,97.7,0c65.1,46,47.9,91.9-65.1,180c-206.8,158.9-352.3,400.2-409.8,679.7c-17.2,84.2-38.3,164.7-46,178.1C3842.7,3133.4,3760.4,3127.7,3739.3,3087.5z"/><path d="M1801.6,1377.6c-310.2-42.1-591.7-203-811.9-459.5c-86.2-101.5-105.3-162.8-63.2-204.9c42.1-42.1,72.8-23,241.2,147.4c139.8,143.6,193.4,183.8,329.3,248.9c107.2,51.7,214.5,86.2,312.1,101.5c111.1,17.2,157,34.5,170.4,59.3C2023.7,1354.6,1950.9,1396.7,1801.6,1377.6z"/><path d="M1767.1,965.9c-162.8-44-319.8-137.9-432.7-260.4c-105.3-114.9-124.5-160.8-82.3-203c46-46,101.5-23,193.4,82.3c105.3,118.7,273.8,212.5,432.7,237.4c130.2,21.1,172.3,78.5,105.3,143.6C1947.1,1002.3,1903,1002.3,1767.1,965.9z"/><path d="M2527.2-387.8c-135.9-135.9-243.2-195.3-419.3-231.7c-126.4-24.9-164.7-63.2-128.3-130.2c38.3-74.7,308.3-19.2,497.8,101.5c120.6,78.5,264.2,237.4,264.2,296.8c0,38.3-46,84.2-84.2,84.2C2651.7-267.2,2592.4-320.8,2527.2-387.8z"/><path d="M2826-644.4c-201-220.2-430.8-340.8-720-379.1c-101.5-13.4-135.9-49.8-109.1-118.7c21.1-57.5,109.1-57.5,312.1-5.7c233.6,59.4,398.3,157,591.7,346.6c153.2,151.3,168.5,174.2,162.8,231.7c-3.8,51.7-15.3,63.2-53.6,68.9C2971.5-496.9,2933.2-527.6,2826-644.4z"/><path d="M7787.1,1369.9c-189.6-34.5-335.1-93.8-497.8-203c-139.8-93.8-292.9-247-344.7-344.7c-23-42.1-23-55.5,1.9-91.9c46-65.1,90-47.9,195.3,82.3c168.5,210.6,442.3,363.8,723.8,404c111.1,17.2,141.7,36.4,141.7,97.6c0,36.4-53.6,90-80.4,82.3C7923,1396.7,7861.8,1383.3,7787.1,1369.9z"/><path d="M7806.2,969.8c-191.5-47.9-371.5-160.8-486.4-306.4c-63.2-78.5-72.7-124.5-36.3-160.8c44-44,95.7-21.1,197.2,88.1c113,122.5,271.9,208.7,425.1,229.8c111,17.2,155.1,70.8,109.1,134C7982.4,1002.3,7946,1004.2,7806.2,969.8z"/><path d="M8556.8-382.1c-124.5-130.2-250.9-201-419.3-235.5c-128.3-26.8-174.2-67-137.9-122.5c17.2-26.8,47.9-34.5,137.9-32.5c160.8,1.9,371.5,103.4,511.2,245.1c120.6,124.5,141.7,172.3,93.8,224c-17.2,19.2-42.1,36.4-53.6,36.4C8677.5-267.2,8618.1-318.9,8556.8-382.1z"/><path d="M8888.1-608c-166.6-208.7-430.8-360-716.1-405.9c-122.5-19.2-164.7-44-164.7-95.7c0-93.8,174.2-97.6,425.1-11.5c195.3,68.9,331.2,155.1,497.8,319.8c151.2,151.3,191.5,224,149.3,275.7C9033.6-470.1,8978.1-493.1,8888.1-608z"/><path d="M5633-1814.3c-36.4-11.5-57.4-42.1-57.4-82.3c0-17.2,51.7-70.8,114.9-120.6c206.8-162.8,356.1-419.3,404-693.2c13.4-72.8,32.6-143.6,42.1-155.1c26.8-36.4,105.3-30.6,126.4,9.6c23,44-17.2,279.6-74.7,430.8C6082.9-2147.5,5746-1776,5633-1814.3z"/><path d="M5387.9-2166.6c-44.1-44-23-95.7,82.3-191.5c118.7-107.2,214.5-283.4,235.5-427c17.2-118.7,72.8-162.8,137.9-109.2c44.1,34.5,44.1,40.2,21.1,158.9c-36.4,183.8-109.1,317.9-250.8,463.4C5489.4-2145.5,5435.8-2118.7,5387.9-2166.6z"/><path d="M4120.3-2900c-59.4-72.8,32.6-382.9,164.7-557.2c61.3-78.5,210.6-199.1,248.9-199.1c15.3,0,40.2,23,57.4,49.8c32.5,47.9,32.5,47.9-86.2,160.8c-128.3,124.5-222.1,291-243.2,438.5c-7.7,47.9-21.1,99.6-30.6,113C4204.6-2861.7,4149-2865.5,4120.3-2900z"/><path d="M3718.2-2919.1c-57.4-68.9,28.7-421.2,157-637.6c76.6-132.1,338.9-400.2,405.9-417.4c105.3-24.9,149.4,95.7,55.5,155.1c-235.5,155.1-413.6,446.1-463.4,754.4c-11.5,67-28.7,132.1-42.1,147.4C3802.5-2882.7,3748.9-2882.7,3718.2-2919.1z"/></g></g>
</svg>
\ No newline at end of file
#ifndef CRAZYFLY_H
#define CRAZYFLY_H
#include "globalDefinitions.h"
#include <QGraphicsSvgItem>
#include <QSvgRenderer>
#define DRONE_HEIGHT 100 * FROM_MILIMETERS_TO_UNITS
#define DRONE_WIDTH 100 * FROM_MILIMETERS_TO_UNITS
class crazyFly : public QGraphicsSvgItem
{
public:
explicit crazyFly(QPointF position, QGraphicsItem * parent = 0);
~crazyFly();
QRectF boundingRect() const;
void paint(QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget);
private:
qreal m_width;
qreal m_height;
};
#endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <QGridLayout> #include <QGridLayout>
#include <QGraphicsRectItem> #include <QGraphicsRectItem>
#ifdef CATKIN_MAKE #ifdef CATKIN_MAKE
#include "rosNodeThread.h" #include "rosNodeThread.h"
#include "d_fall_pps/UnlabeledMarker.h" #include "d_fall_pps/UnlabeledMarker.h"
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
#include "globalDefinitions.h" #include "globalDefinitions.h"
#include "marker.h" // temporal, just to check #include "marker.h" // temporal, just to check
#include "crazyFly.h"
namespace Ui { namespace Ui {
class MainGUIWindow; class MainGUIWindow;
...@@ -108,7 +109,8 @@ private: ...@@ -108,7 +109,8 @@ private:
void _init(); void _init();
std::vector<Marker*> markers_vector; std::vector<Marker*> markers_vector;
QGraphicsPixmapItem* drone_image;
crazyFly* crazyFly_1;
#ifdef CATKIN_MAKE #ifdef CATKIN_MAKE
rosNodeThread* _rosNodeThread; rosNodeThread* _rosNodeThread;
......
#include "crazyFly.h"
#include <QPen>
#include <QBrush>
crazyFly::crazyFly(QPointF position, QGraphicsItem * parent)
: QGraphicsSvgItem(":/images/drone_fixed.svg")
{
m_width = DRONE_WIDTH;
m_height = DRONE_HEIGHT;
this->setPos(position);
}
crazyFly::~crazyFly()
{
}
QRectF crazyFly::boundingRect() const
{
// return QRectF(-original_width/2, -original_height/2, original_width, original_height);
return QRectF(-m_width/2, -m_height/2, m_width, m_height);
}
void crazyFly::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
this->renderer()->render(painter,this->boundingRect());
}
...@@ -70,10 +70,22 @@ void MainGUIWindow::_init() ...@@ -70,10 +70,22 @@ void MainGUIWindow::_init()
ui->graphicsView->setScene(scene); ui->graphicsView->setScene(scene);
QPixmap pixmap(":/images/drone.png"); // QPixmap pixmap(":/images/drone.png");
drone_image = new QGraphicsPixmapItem(pixmap); // drone_image = new QGraphicsPixmapItem(pixmap);
drone_image->setPos(0,0); // drone_image->setPos(-200,200);
scene->addItem(drone_image);
// drone_image_svg->setTransformOriginPoint(b_rect.width()/2, b_rect.height()/2);
// // drone_image_svg->setScale(0.25);
// drone_image_svg->setRotation(20);
// scene->addItem(drone_image_svg);
// scene->addItem(drone_image);
crazyFly_1 = new crazyFly(QPointF(50,50));
// crazyFly_1->setRotation(45);
// crazyFly_1->setPos(0,0);
scene->addItem(crazyFly_1);
QObject::connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), scene, SLOT(removeCrazyFlyZone(int))); QObject::connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), scene, SLOT(removeCrazyFlyZone(int)));
QObject::connect(scene, SIGNAL(numCrazyFlyZonesChanged(int)), this, SLOT(set_tabs(int))); QObject::connect(scene, SIGNAL(numCrazyFlyZonesChanged(int)), this, SLOT(set_tabs(int)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment