Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt vs. WPF
Forum Updated to NodeBB v4.3 + New Features

Qt vs. WPF

Scheduled Pinned Locked Moved General and Desktop
25 Posts 4 Posters 35.4k Views 2 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.
  • S Offline
    S Offline
    Satmosc
    wrote on last edited by
    #16

    Thanks you very much... yes I will do it. Actually the reason I did it is that it is just a few line of code and nothing so serious.
    Something that I am looking to find is Static Resources or Qt model called Global Variables.
    How Can I define a Gradient ( including its stops) as a global Variables !!?
    thanks .

    M.Hatami
    To the Rationalism

    1 Reply Last reply
    0
    • AlicemirrorA Offline
      AlicemirrorA Offline
      Alicemirror
      wrote on last edited by
      #17

      I think that a way is to define a property, then set the gradient with the property value. See the gradient doc on how to set values.

      Properties can be part of the object definition, then you set them externally when the object is used and instantiated by the program

      Enrico Miglino (aka Alicemirror)
      Balearic Dynamics
      Islas Baleares, Ibiza (Spain)
      www.balearicdynamics.com

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Satmosc
        wrote on last edited by
        #18

        Thank you very much.... I already defined it as a property but I am a bit lazy and I was unable to access it from an other File.
        I made an other QML file and inside that QML File I did :
        GlobalVariables.qml
        ///
        @import Qt 4.7

        Item {
        property Gradient titleBar_grdnt1: Gradient {
        GradientStop {
        position: 0
        color: '#e0e1e8' }
        GradientStop {
        position: 0.5
        color: '#E0E1E8' }
        GradientStop {
        position: 0.9
        color: '#d8dae1' }
        }
        }
        @

        and inside main .QML file I used import "qmldir" (the directory containing that file)
        then I tried to access that property from the main file but
        using GlobalVariables.titleBar_grdnt1 the compiler says it cannot find GlobalVariables !!!! even the file is visible !!!
        So , I think as a beginner I am doing it in a wrong way ....
        What should I use inside the GlobalVariables.QML file ,,, Item or .... ?
        How to instantiate the GlobalVariables ? like C++ ?? using new ? but it failed !!!!:(

        I am searching the Forum and Documents , that is too hard to find the answer....
        Qml really seek a better documantation....
        thanks again for your answer sir.

        M.Hatami
        To the Rationalism

        1 Reply Last reply
        0
        • AlicemirrorA Offline
          AlicemirrorA Offline
          Alicemirror
          wrote on last edited by
          #19

          You should

          Please take a look to the code of the project I am working on at https://projects.forum.nokia.com/rchobbystream

          In main you should import the files in the format

          @import "elements_dir" 1.0 as Name@

          Where Name should be a name starting with the Caps. elements_dir should contain a separate qml file for every item you create, with the initial Caps.

          Your iten in the qml file should have an id: to reference the object from the parent and inside the object components (the qml file).

          Then, in the main.qml file, you can instantiate the object using

          @Name.Object {
          id: myid
          }
          @
          So, the child properties can be used in the main.qml file.

          Enrico Miglino (aka Alicemirror)
          Balearic Dynamics
          Islas Baleares, Ibiza (Spain)
          www.balearicdynamics.com

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Satmosc
            wrote on last edited by
            #20

            oh my god... you rock.... this is exactly what I was looking for and it made me happy that it is possible to have a resource in QML ....
            Thank you 1000 times.... still 2 Questions :

            1. Where did you learn it ? ( i want to know where to study and follow QML and its future features.)

            2. how can we explain it ! ? Static Resource or dynamic !? I mean the resource could be changed during runtime ? also , they will be used as a static variable in memory or they will be just assigned as soon as we use them ?

            3. in the code 1
              import "elements_dir" 1.0 as Name
              What is the meaning of 1.0 ? !! version ?

            by the way thank you again

            M.Hatami
            To the Rationalism

            1 Reply Last reply
            0
            • AlicemirrorA Offline
              AlicemirrorA Offline
              Alicemirror
              wrote on last edited by
              #21

              It's strange eh? 1.0 or the number you desire stay for "version number"
              To be honest, I have no idea where this will be used by the program but is a symbolic abstraction needed.

              I understood QML writing programs in QML / Qt-Quick etc.
              But it's a long story...

              Regarding your point 2, you define a sort of global that is not quite a "variable", it's a property.
              As a matter of fact, what you create in qml are very well structured classes so you define a property in a child class, then this property is immediately created with the internal event and state managers (if you need you can use or not).
              Thus, the property is inherited and become part of the object itself.

              In the sources, you create the object with their definitions, elements, sub-objects, properties
              then in the parent you can manage them. Simple.

              No?

              Enrico Miglino (aka Alicemirror)
              Balearic Dynamics
              Islas Baleares, Ibiza (Spain)
              www.balearicdynamics.com

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Satmosc
                wrote on last edited by
                #22

                Actually , when the puzzle is solved , it looks simple... but before that it was hard to imagine it.
                hey man. you are clever professional and so good man , because you try to help a newbie like me who is a headache for an expert like you. thank you again.

                regarding 1.0 , use or not it is working , may be it is version of the imported Qt files (QtQuick 1.0)
                http://doc.qt.nokia.com/4.7-snapshot/qdeclarativemodules.html

                Thanks again

                M.Hatami
                To the Rationalism

                1 Reply Last reply
                0
                • AlicemirrorA Offline
                  AlicemirrorA Offline
                  Alicemirror
                  wrote on last edited by
                  #23

                  Mah, it is possible you are right, I have no idea and I had no time to investigate on this 1.0 clause... If you are sure I take it for right.

                  Expertisement (if any) doesn't agree with assumption and arrogance. Then, as you me too I'm using intensively knowledge of other good people that are helping me.

                  SO, go ahead and place this project on the area, update it frequently with git, it's very simple, and ask. The works that can happen is that no-one answer :)

                  Take me updated on the develop.

                  Enrico Miglino (aka Alicemirror)
                  Balearic Dynamics
                  Islas Baleares, Ibiza (Spain)
                  www.balearicdynamics.com

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Satmosc
                    wrote on last edited by
                    #24

                    Dear AliceMirror,
                    I am so glad to be in touch with you . I just started to put my project on public to share and update , specially with you.
                    With best wishes...

                    M.Hatami
                    To the Rationalism

                    1 Reply Last reply
                    0
                    • AlicemirrorA Offline
                      AlicemirrorA Offline
                      Alicemirror
                      wrote on last edited by
                      #25

                      Thank you.

                      Just an advice: after you setup the project on public, I can be a follower as a registered user and get code and modify documents you have already wrote. Then another registered user can ask to you to be a contributor and if you accept him, he became part of the development team for that project.
                      In the admin area, set as you needs the permissions on the related groups so followers, visitors and contributors can have the right authorizations.
                      Then, last but not least, add the right licens to the project (at the end of the "categorization" page).

                      Enrico Miglino (aka Alicemirror)
                      Balearic Dynamics
                      Islas Baleares, Ibiza (Spain)
                      www.balearicdynamics.com

                      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