МихаилллШілде 14, 2019, 9:08 Т.Ж.
Работа в QML c камерой
Добрый день.
Могу отображать увртинку с камеры на экране.
Но картинка не поворачивается при повороте телефона. Скажите пожалуйста, как ее поворачивать вместе с телефоном.
Также пытаюсь сделать фото при нажатии на единственную кнопку и отобразить это фото на картинке, но не могу сделать это.
Помогите пожалуйста.
Ниже мой код.
qml
import QtQuick 2.12 import QtMultimedia 5.12 Camera1Form { buttonPhoto.onClicked: //photo { imageForPhoto.source= camera } }
ui.qml
import QtQuick 2.12 import QtQuick.Controls 2.12 import QtMultimedia 5.12 Item { width: 400 height: 700 property alias buttonPhoto: buttonPhoto property alias imageForPhoto: imageForPhoto property alias photoPreview: photoPreview property alias camera: camera Camera { id: camera imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash exposure { exposureCompensation: -1.0 exposureMode: Camera.ExposurePortrait } flash.mode: Camera.FlashRedEyeReduction imageCapture { onImageCaptured: { photoPreview.source = preview // Show the preview in an Image } } } VideoOutput { anchors.bottomMargin: 300 source: camera anchors.fill: parent focus : visible // to receive focus and capture key events when visible } Image { id: photoPreview } Image { id: imageForPhoto x: 21 y: 433 width: 219 height: 215 fillMode: Image.PreserveAspectFit source: "qrc:/qtquickplugin/images/template_image.png" } Button { id: buttonPhoto x: 264 y: 507 text: qsTr("Photo") } }
Рекомендуем хостинг TIMEWEB
Стабильный хостинг, на котором располагается социальная сеть EVILEG. Для проектов на Django рекомендуем VDS хостинг.Ол саған ұнайды ма? Әлеуметтік желілерде бөлісіңіз!
Пікірлер
Г
- Геній
- Қыр. 13, 2024, 12:46 Т.Қ.
C++ - Тест 001. Первая программа и типы данных
- Нәтиже:66ұпай,
- Бағалау ұпайлары-1
t
- torgaev_2024
- Қыр. 8, 2024, 6:20 Т.Ж.
C++ - Тест 001. Первая программа и типы данных
- Нәтиже:33ұпай,
- Бағалау ұпайлары-10
Соңғы пікірлер
Linux жүйесінде файлдарды қалай көшіруге болады Задумывались когда-нибудь о том, как мы привыкли доверять свои вещи службам грузоперевозок? Сейчас такие услуги стали неотъемлемой частью нашей жизни, особенно когда речь идет о переездах между …
ВР
Linux жүйесінде файлдарды қалай көшіруге болады Screenshot_20240802-065123.png
Влад РусоковТам. 2, 2024, 1:47 Т.Ж.
QML - Сабақ 016. SQLite деректер қоры және онымен QML Qt-та жұмыс істеу Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
Qt Linux - Сабақ 001. Linux астында Autorun Qt қолданбасы как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
АК
Qt WinAPI - Сабақ 007. Qt ішінде ICMP Ping арқылы жұмыс істеу Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
Анатолий КононенкоАқп. 5, 2024, 1:50 Т.Ж.
Енді форумда талқылаңыз
Evgenii LegotckoiМаусым 24, 2024, 3:11 Т.Қ.
при создании qml проекта Kits есть но недоступны для выбора Поставил Qt Creator 11.0.2. Qt 6.4.3 При создании проекта Qml не могу выбрать Kits, они все недоступны, хотя настроены и при создании обычного Qt Widget приложения их можно выбрать. В чем может …
BlinCTМаусым 25, 2024, 1 Т.Ж.
BlinCTМамыр 5, 2024, 5:46 Т.Ж.
Evgenii LegotckoiМамыр 2, 2024, 2:07 Т.Қ.
Нашел тут код, и в нем сохранение фото выполняет ,похоже, функция
не могли бы вы помочь мне используя этот код доделать фуункцию фотографирования
Вот весь код:
Так можно сохранить картинку.
Осталось узнать как ее сохранять в папку с программой, как зеркалить картинку и как поворачивать камеру вместе с наклоном телефона.
Может быть вы знаете как можно что-нибудь из этого сделать?
Так камера показывает правильно при поворотах телефона.
Осталось узнать как картинки сохранять в папку с программой и как их потом загружать в картинки.