Results 1 to 13 of 13

Thread: How to structure a QML project

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to structure a QML project

    Quote Originally Posted by KeineAhnung View Post
    The only thing I did not get to work is the text animation. My plan was to create a signal within clock signal tick(clock.time) and "connect" it within the countdown page by using onTick: {} but this gives me the error : "Cannot assign to non-existent property "onTick"".
    Using timers for animations in QtQuick is not a proper approach. You have a bunch of types inheriting Animation to do animations.

    So how can I send a signal from one file to another?
    You don't send signals from somwhere to somewhere else. You just emit a signal and if anyone is interested in it, he can connect to that signal.

    All signal examples I found were only within one page. Or how else could I start and stop my text animation?
    The declarative approach would be to come up with a statement that states when the animation is running, e.g.:
    javascript Code:
    1. NumberAnimation {
    2. // ...
    3. running: clock.cycles > 0
    4. // ...
    5. }
    To copy to clipboard, switch view to plain text mode 

    By the way, from what I see you can get rid of the whole ticker of yours and do everything you do there in a declarative manner instead of imperative statements. The hardest part in learning QML is to make yourself stop thinking imperatively and start thinking declaratively.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Apr 2014
    Posts
    116
    Thanks
    8
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to structure a QML project

    Hi wysota,

    first of all thanks a lot for your help. You put me on the right path!
    By the way, from what I see you can get rid of the whole ticker of yours and do everything you do there in a declarative manner instead of imperative statements.
    Is this also true if I want to us the property time on several pages? Say I have to labels in two qml files. Within the app the user shall be able to switch between the pages and always the the time.


    You don't send signals from somewhere to somewhere else. You just emit a signal and if anyone is interested in it, he can connect to that signal.
    This exactly what I did not manage. How do I connect to a signal? onSignalName in another qml file always gives me an error.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to structure a QML project

    Quote Originally Posted by KeineAhnung View Post
    Is this also true if I want to us the property time on several pages? Say I have to labels in two qml files. Within the app the user shall be able to switch between the pages and always the the time.
    I'd start by explaining what are your intentions for having the "time" property in the first place. I think that the sole existance of this property is your main problem. Regardless if this property is physically global or not, you are treating it as one which in my opinion is a misdesign.

    This exactly what I did not manage. How do I connect to a signal? onSignalName in another qml file always gives me an error.
    There is a number of approaches, one of them being to use the Connections element.

    javascript Code:
    1. Connections {
    2. target: someOtherElement
    3.  
    4. onSignalHandler: { ... }
    5. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. MSVC Project generated using qmake - turn off flat structure
    By Piskvorkar in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2013, 23:25
  2. Replies: 12
    Last Post: 26th June 2011, 11:26
  3. Replies: 0
    Last Post: 28th May 2010, 06:50
  4. Project structure with qtestlib
    By matteonardi in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2010, 08:01
  5. Project structure with Qt designer
    By lmax in forum Newbie
    Replies: 1
    Last Post: 12th June 2008, 01:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.