Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Camera element on N8
Qt 6.11 is out! See what's new in the release blog

Camera element on N8

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 4 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mascotti
    wrote on last edited by
    #1

    Hello, I have created a simple QML app for exercising the Camera example taken from http://doc.qt.nokia.com/qtmobility/qml-multimedia.html

    I have added all the relevant header files and Symbian capabilities but it seems the camera doesn't show any content when the application starts on the N8. I can see only a white background. Here is the main.qml file

    @
    import Qt 4.7
    import QtMultimediaKit 1.1

    Camera {
    focus : visible // to receive focus and capture key events when visible

     flashMode: Camera.FlashRedEyeReduction
     whiteBalanceMode: Camera.WhiteBalanceFlash
     exposureCompensation: -1.0
    
     onImageCaptured : {
         photoPreview.source = preview  // Show the preview in an Image element
     }
    

    }
    @

    Do you know please if I have missed any other parameters?
    Thank you

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      Do you have right capability ?

      Chuck

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mascotti
        wrote on last edited by
        #3

        Yes , here is part of my .pro file

        @
        symbian {
        TARGET.CAPABILITY += NetworkServices UserEnvironment NetworkServices Location ReadUserData WriteUserData
        }
        @

        thank you

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mascotti
          wrote on last edited by
          #4

          In this example I can see the viewfinder with a black background but no camera images are displayed. However if I press the capture button then the preview image is filled with the camera's capture image. Also when taking a picture I can see the camera flash working. Any idea from this example why QML Camera element doesn't display the images when not taking a picture?
          Thank you

          @
          import QtQuick 1.0
          import QtMultimediaKit 1.1

          Rectangle {
          id: rotateCam
          state: 'CameraStarted'
          states: [
          State {
          name: "CameraStarted"
          PropertyChanges { target: previewImage; z: -1 }
          PropertyChanges { target: rotateCam; color: "black" }
          PropertyChanges { target: takePhotoButton; buttonText: "Take Image" }
          PropertyChanges { target: camera; captureResolution: Qt.size(camera.width,camera.height)}
          },
          State {
          name: "CapturingPhoto"
          PropertyChanges { target: previewImage; z: -1 }
          PropertyChanges { target: rotateCam; color: "red" }
          PropertyChanges { target: takePhotoButton; buttonText: "Cancel" }
          },
          State {
          name: "ShowingPreview"
          PropertyChanges { target: previewImage; z: 2 }
          PropertyChanges { target: rotateCam; color: "black" }
          PropertyChanges { target: takePhotoButton; buttonText: "Back" }
          }
          ]

          Camera {
              id: camera
              anchors.fill: parent
              anchors.margins: 4
              //focus : visible // to receive focus and capture key events when visible
              flashMode: Camera.FlashRedEyeReduction
              whiteBalanceMode: Camera.WhiteBalanceFlash
              exposureCompensation: -1.0
              onImageCaptured: {
                  console.log("Image captured!")
                  previewImage.source = preview
                  rotateCam.state = 'ShowingPreview'
              }
          
              Image {
                  id: previewImage
                  anchors.fill: parent
                  fillMode: Image.PreserveAspectFit
                  smooth: true
              }
          }
          
          CameraButton {
              id: exitButton
              anchors.right: parent.right
              anchors.top: parent.top
              anchors.margins: 60
              buttonText: "Exit"
              onButtonPressed: Qt.quit()
          }
          
          CameraButton {
              id: takePhotoButton
              anchors.left: parent.left
              anchors.top: parent.top
              anchors.margins: 60
              buttonText: "Take Image"
              onButtonPressed: {
                  if (rotateCam.state == 'CameraStarted') {
                      camera.captureImage()
                  } else if (rotateCam.state == 'ShowingPreview') {
                      rotateCam.state = 'CameraStarted'
                  }
              }
          }
          
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  console.log("Mouse pressed!")
                  if (rotateCam.state == 'CameraStarted')
                      camera.searchAndLock()
                  else if (rotateCam.state == 'ShowingPreview')
                      rotateCam.state = 'CameraStarted'
              }
          }
          

          }

          // End of file

          @

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kibsoft
            wrote on last edited by
            #5

            So, I have the same issue..When I use qml camera I see only black screen (Symbian^1, Nokia 5800).

            http://www.developer.nokia.com/info/sw.nokia.com/id/cc9937ed-9f1f-44b4-981f-38245bf9cae5/Qt_QCamera_Example.html
            This non-qml example works perfectly on my device.

            mascotti, did you find a way to fix this behaviour?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mascotti
              wrote on last edited by
              #6

              Hi,
              the problem in my case was that I was using a QT's version on my device that was older then the one I was using for developing. I suggest you make sure that you are using the same QT mobility version both on the device and QT sdk.

              Hope this help
              Maurizio

              1 Reply Last reply
              0
              • S Offline
                S Offline
                simon-h
                wrote on last edited by
                #7

                I have the same problem on a Symbian^1 phone (Nokia X6). Here is the minimal code for a Qt Quick Application generated from the wizard. I am using Qt 1.1.2 SDK downloaded yesterday (10/07/2011), which uses Qt Mobility 1.1.3 with Qt 4.7.3. I manually installed the two Qt /QtMobility library .sis files that are the SDK start menu group.

                // .pro contains following extra lines
                // symbian:TARGET.CAPABILITY += UserEnvironment
                // CONFIG += mobility
                // MOBILITY += multimedia

                // main.qml contains:
                import QtQuick 1.0
                import QtMultimediaKit 1.1

                Camera {
                }

                Result: viewfinder not appear. However the above works fine for a Symbian^3 build on Nokia N8 - viewfinder does turn on.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  simon-h
                  wrote on last edited by
                  #8

                  Raised bug report http://bugreports.qt.nokia.com/browse/QTMOBILITY-1769
                  Please vote for it if you can repeat it yourself.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved