Results 1 to 4 of 4

Thread: Is it good or else?

  1. #1
    Join Date
    Jan 2016
    Posts
    13
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Is it good or else?

    make a javascript file for style
    like
    Qt Code:
    1. var colors =
    2. {
    3. applicatonRoot : "transparent",
    4. itemIntro : "green",
    5. rectangleIntro : "#c5dedd"
    6. };
    7.  
    8.  
    9. var widths =
    10. {
    11. applicatonRoot : 770,
    12. itemIntro : 770,
    13. rectangleIntro : "#c5dedd"
    14. };
    To copy to clipboard, switch view to plain text mode 
    and javascript file for all texts
    like
    Qt Code:
    1. var texts =
    2. {
    3. applicatonRoot : "Welcome to my page",
    4. ButtonIntro : "Click"
    5. };
    To copy to clipboard, switch view to plain text mode 

    and javascript file for all functions and so one
    and include it into qml?
    Is it good or some thing else?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Is it good or else?

    The strings should better be in the places where they are used, is this allows to easier disambiguate for translations when necessary.

    For the colors this looks ok, though you probably want to use
    Qt Code:
    1. .pragma libary
    To copy to clipboard, switch view to plain text mode 
    so it only gets loaded once.

    You can also do this with a QML element, either as a global object or as a singleton.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    umnbr (31st January 2016)

  4. #3
    Join Date
    Jan 2016
    Posts
    13
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Is it good or else?

    thank you anda_skoa,
    - i aim to use all varibles in javascript: color, font, width, heigh, x, y, border, image, etc what about memory?
    - i have 30 pages of qml which is better:
    1- add all pages in one qml file seperated with Item
    ApplicationWindow{ Item{ id: intro } Item{ id: page1 } Item{ id: page2 } Item{ id: page30 } }
    and use show and hide etch item.

    2- open intro.qml and hide it and open page1.qml and hide page1.qml etc
    3- open intro.qml and when i click next button load page1.qml into intro.qml
    4- open intro.qml and when i click next button open page1.qml into as dialuog
    5- something else?

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Is it good or else?

    Quote Originally Posted by umnbr View Post
    thank you anda_skoa,
    - i aim to use all varibles in javascript: color, font, width, heigh, x, y, border, image, etc what about memory?
    I am afraid I don't understand what you want to know.

    Quote Originally Posted by umnbr View Post
    - i have 30 pages of qml which is better:
    1- add all pages in one qml file seperated with Item
    ApplicationWindow{ Item{ id: intro } Item{ id: page1 } Item{ id: page2 } Item{ id: page30 } }
    and use show and hide etch item.

    2- open intro.qml and hide it and open page1.qml and hide page1.qml etc
    3- open intro.qml and when i click next button load page1.qml into intro.qml
    4- open intro.qml and when i click next button open page1.qml into as dialuog
    5- something else?
    There is not "best" way since some aspects depend on the requirements.

    For example instantiating everything at startup increases the startup time but makes switching between screens basically instant.
    Loading on demand reduces startup time and memory consumption, but also means switching might not be instant and it is more complicated.

    It also depends on how you are navigating through the screens, e.g. if all are equal or if some are sub screens of another, etc.

    Independent it is usually a good idea to separate different screens into different files, so each screen can potentially be tested stand-alone and it also keeps each file small and easy to read and understand.

    Cheers,
    _

Similar Threads

  1. QTextDocumentWriter / odf any good?
    By Kumosan in forum Qt Programming
    Replies: 1
    Last Post: 5th December 2012, 22:08
  2. is Qt a good choice for S60 SDK 5
    By coco in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 4th May 2010, 20:33
  3. Farewell and good bye!
    By GreyGeek in forum General Discussion
    Replies: 3
    Last Post: 23rd June 2008, 17:06
  4. Good QT book?
    By Bobsinclare666 in forum Newbie
    Replies: 3
    Last Post: 20th January 2008, 18:29
  5. any good books for QT 4.2?
    By neomax in forum General Discussion
    Replies: 7
    Last Post: 4th September 2007, 08:37

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.