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. When I pass the code to Windows the icons are black and white
Forum Updated to NodeBB v4.3 + New Features

When I pass the code to Windows the icons are black and white

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 6 Posters 1.4k Views 3 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.
  • serkan_trS Offline
    serkan_trS Offline
    serkan_tr
    wrote on last edited by serkan_tr
    #1

    I designed the screen using Qt in Linux. And the codes worked without any problems. I built the same system in Windows environment but this time the system did not work as I expected, the icons turned black and white and the buttons did not work properly, what is the reason for this?

    this code

    Screenshot of the application in Linux environment:
    ec080c71-02ad-46c8-a281-30d7b63204ca-image.png

    Screenshot of the application linux environment:
    image.png

    (In Linux environment the buttons work properly, the button I press only appears bright, but in Windows this feature does not work properly.)

    Thank you for your answers

    Pl45m4P artwawA 2 Replies Last reply
    0
    • serkan_trS Offline
      serkan_trS Offline
      serkan_tr
      wrote on last edited by
      #11

      I didn't fully understand the problem but I solved it. Because button usage works differently in Windows and Linux for some reason (maybe because of the Qt version)

      This is the code that works in Linux

      This is the code that works in Windows

      1 Reply Last reply
      0
      • serkan_trS serkan_tr

        I designed the screen using Qt in Linux. And the codes worked without any problems. I built the same system in Windows environment but this time the system did not work as I expected, the icons turned black and white and the buttons did not work properly, what is the reason for this?

        this code

        Screenshot of the application in Linux environment:
        ec080c71-02ad-46c8-a281-30d7b63204ca-image.png

        Screenshot of the application linux environment:
        image.png

        (In Linux environment the buttons work properly, the button I press only appears bright, but in Windows this feature does not work properly.)

        Thank you for your answers

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #2

        @serkan_tr said in When I pass the code to Windows the icons are black and white:

        what is the reason for this?

        Seems like the icons couldn't be found...
        Check if your paths are correct.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        0
        • serkan_trS Offline
          serkan_trS Offline
          serkan_tr
          wrote on last edited by
          #3

          @Pl45m4 shapes were formed. The shapes have no colors If the path was wrong then the shapes would not have formed.

          JonBJ 1 Reply Last reply
          0
          • serkan_trS serkan_tr

            I designed the screen using Qt in Linux. And the codes worked without any problems. I built the same system in Windows environment but this time the system did not work as I expected, the icons turned black and white and the buttons did not work properly, what is the reason for this?

            this code

            Screenshot of the application in Linux environment:
            ec080c71-02ad-46c8-a281-30d7b63204ca-image.png

            Screenshot of the application linux environment:
            image.png

            (In Linux environment the buttons work properly, the button I press only appears bright, but in Windows this feature does not work properly.)

            Thank you for your answers

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by
            #4

            @serkan_tr said in When I pass the code to Windows the icons are black and white:

            Put those icons in the resource file, then you can reference them with an identical path on every platform.

            For more information please re-read.

            Kind Regards,
            Artur

            serkan_trS 1 Reply Last reply
            2
            • serkan_trS Offline
              serkan_trS Offline
              serkan_tr
              wrote on last edited by
              #5

              image.png

              This part works correctly in Linux but not in Windows. The signal slot mechanism is not triggered in this part.

              JonBJ 1 Reply Last reply
              0
              • artwawA artwaw

                @serkan_tr said in When I pass the code to Windows the icons are black and white:

                Put those icons in the resource file, then you can reference them with an identical path on every platform.

                serkan_trS Offline
                serkan_trS Offline
                serkan_tr
                wrote on last edited by
                #6

                @artwaw Location of icons in the file. this image

                artwawA 1 Reply Last reply
                0
                • serkan_trS serkan_tr

                  image.png

                  This part works correctly in Linux but not in Windows. The signal slot mechanism is not triggered in this part.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #7

                  @serkan_tr said in When I pass the code to Windows the icons are black and white:

                  This part works correctly in Linux but not in Windows. The signal slot mechanism is not triggered in this part.

                  You post in General and Desktop, for Qt widget programs, but your screenshot is clearly QML. So which are you using?

                  Although I know nothing about QML, you have chosen to specify external files (rather than resource files) by path and have used a relative path, right? So what makes you think the ../..... will reference the same file/directory under both OSes? Assuming QML treats them as relative to the current directory (does it?) what is that when you run the QML application on each platform and why do you assume they will be the same?

                  You might consider earlier suggestion:
                  @artwaw said in When I pass the code to Windows the icons are black and white:

                  Put those icons in the resource file, then you can reference them with an identical path on every platform.

                  I have no idea what "The signal slot mechanism is not triggered in this part" has to do with anything.

                  1 Reply Last reply
                  2
                  • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
                  • Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    ... so put the images into a Qt resource file to make sure they are found.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    1
                    • serkan_trS serkan_tr

                      @Pl45m4 shapes were formed. The shapes have no colors If the path was wrong then the shapes would not have formed.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #9

                      @serkan_tr said in When I pass the code to Windows the icons are black and white:

                      @Pl45m4 shapes were formed. The shapes have no colors If the path was wrong then the shapes would not have formed.

                      UPDATE
                      Yes, I see what you mean.

                      First do either of:

                      • Change to Qt resources. Does that make any difference?
                      • Change your existing paths to deliberately-non-existing, like rubbish/assets/..., so you are sure it is wrong. Does that make any difference?

                      If these produce same result, i.e. correct shapes but black & white, then it does indeed seem you have some trouble correctly rendering colored icons on the platform. I don't know why that should be. Check the properties of the .png files, do you have to install anything like a PNG library to make things work? Maybe try, say, a .jpg or .gif for one of them and see how that renders?

                      1 Reply Last reply
                      2
                      • serkan_trS serkan_tr

                        @artwaw Location of icons in the file. this image

                        artwawA Offline
                        artwawA Offline
                        artwaw
                        wrote on last edited by
                        #10

                        @serkan_tr it's not the in the Qt resource file so location might change depending on OS.

                        This: "../assets/icons/home.png" is not a uniform path across the operating systems. An effect of which you just experience.

                        For more information please re-read.

                        Kind Regards,
                        Artur

                        1 Reply Last reply
                        0
                        • serkan_trS Offline
                          serkan_trS Offline
                          serkan_tr
                          wrote on last edited by
                          #11

                          I didn't fully understand the problem but I solved it. Because button usage works differently in Windows and Linux for some reason (maybe because of the Qt version)

                          This is the code that works in Linux

                          This is the code that works in Windows

                          1 Reply Last reply
                          0
                          • serkan_trS serkan_tr has marked this topic as solved on
                          • GrecKoG Offline
                            GrecKoG Offline
                            GrecKo
                            Qt Champions 2018
                            wrote on last edited by
                            #12

                            In some Qt Quick Controls styles the icon are rendered in monochrome. Linux has a different default style than window.

                            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