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. Problem with displaying proper graphics with qt creator
Forum Updated to NodeBB v4.3 + New Features

Problem with displaying proper graphics with qt creator

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 368 Views
  • 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.
  • A Offline
    A Offline
    ARKDev2021
    wrote on 21 May 2021, 17:42 last edited by
    #1

    Background: I'm new to qt. After installing it I had a problem with form editor~ "qt emulation layer crashed". I tried all the ways that were provided over the net, but at that time nothing worked. however mysteriously the next day it started working.

    Problem: the form editor does not show the image (icon) that it is supposed to show. however the output that occurs when i run it is the correct one.

    form editor:

    enter image description here

    output:
    enter image description here

    the output is working fine as this is exactly what i want. but the form editor seems to misbehave a bit. Qt creator only shows an error upon executing main.qml (the output runs perfectly fine though)

    Error: QML Image: Cannot open: qrc:/qtquickplugin/images/template_image.png

    Code:

    import QtQuick 2.15
    import QtQuick.Controls 2.15
    import QtGraphicalEffects 1.15

    Button{
    id: btntoggle

    // CUSTOM PROPERTIES
    property url btnIconSource: "../../images/svg_images/menu_icon.svg"
    property color btnColorDefault: "#1c1d20"
    property color btnColorMouseOver: "#23272E"
    property color btnClicked: "#00a1f1"

    QtObject{
    id: internal

    // PROPERTY TO CHANGE COLOR
    property var dynamicColor: if(btntoggle.down){
                                   btntoggle.down ? btnClicked : btnColorDefault
                               }else{
                                   btntoggle.hovered ? btnColorMouseOver: btnColorDefault
                               }
    

    }

    implicitWidth: 70
    implicitHeight: 60

    background: Rectangle{
    id:bgbtn
    color: internal.dynamicColor

    Image {
        id: iconBtn
        source: btnIconSource
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        height: 25
        width: 25
        fillMode: Image.PreserveAspectFit
    }
    
    ColorOverlay{
        anchors.fill: iconBtn
        source: iconBtn
        color: "#ffffff"
        antialiasing: false
    }
    

    }
    }

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qtprogrammer123
      wrote on 22 May 2021, 18:42 last edited by
      #2

      Hi,
      did you added image to qml.qrc file?

      Mam moc jak Harry Potter, w zębach mogę przenieść hotel.

      A 2 Replies Last reply 23 May 2021, 11:41
      0
      • Q qtprogrammer123
        22 May 2021, 18:42

        Hi,
        did you added image to qml.qrc file?

        A Offline
        A Offline
        ARKDev2021
        wrote on 23 May 2021, 11:41 last edited by ARKDev2021
        #3

        @qtprogrammer123 Hi!
        no I did not as it was not shown in the videos I was watching on the YouTube.

        1 Reply Last reply
        0
        • Q qtprogrammer123
          22 May 2021, 18:42

          Hi,
          did you added image to qml.qrc file?

          A Offline
          A Offline
          ARKDev2021
          wrote on 23 May 2021, 12:16 last edited by
          #4

          @qtprogrammer123 Though I have just noticed that the same error occurs in the editor of the youtuber too. But his works fine regardless of the error.

          1 Reply Last reply
          0

          1/4

          21 May 2021, 17:42

          • Login

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