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. Extending QML - Styling design principles?
Forum Updated to NodeBB v4.3 + New Features

Extending QML - Styling design principles?

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 3 Posters 2.1k Views 1 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.
  • O Offline
    O Offline
    ooooooooo
    wrote on last edited by
    #1

    Hi!

    I am developing some custom widgets, and want to make the elements styleable in the same way many QML widgets are. I'm a little confused about what styling is exactly for, based on reading the documentation and source code.

    First, not all QML widgets are styled. Is the plan to style them all? Is there a principle which defines what is/will be styled, and what isn't?

    Second, styles in most cases define purely visual (non-interactive) units. In at least one case (CalendarStyle) it also defines interactions (with event handlers). Is the plan for QML for all styles to take in both interactive and visual elements of a widget? Or is Calendar an exception? A page listing the styles separates them into "Styling views" and "Styling controls" (http://qt-project.org/doc/qt-5/qtquickcontrolsstyles-index.html) - does this provide a clue as to the future direction?

    Third, if visual and control elements are to be part of styles, what is left in the widget itself? The data model perhaps?

    Fourth, a style may itself contain other styled elements. How might the styling of elements embedded in style be changed?

    Fifth, is it intended that the styling convention is extended to custom QML components? Some useful infrastructure for styling is private in QML. Might this be made public in the future? What is the plan for using the style convention in custom components in QML - will it be better supported in the future?

    All rather philosophical questions that can probably only be answered by the QML designers... I hope there are one or two about!

    Cheers,
    Ben.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      What event handlers for CalendarStyle are you referring to? I can't seem to find any in the doc.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ooooooooo
        wrote on last edited by
        #3

        I'm looking at the source code for that. There are event handlers dealing with clicks on the days, amongst other things. You can't "style" those, they're just implemented there, for example:
        https://qt.gitorious.org/qt/qtquickcontrols/source/d6b0dac2d2859e4f1c6f8bd0e147d16f43343784:src/controls/Styles/Base/CalendarStyle.qml#L575

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Scorp1us
          wrote on last edited by
          #4

          Well the resultant control will be a composite control. For the most part the sub-controls should be styled appropriately, or can be set to an existing style. Only if you want to deviate from a style would you have have to worry about styling.

          1 Reply Last reply
          0
          • O Offline
            O Offline
            ooooooooo
            wrote on last edited by
            #5

            The custom widgets I'm making are not entirely composed of stylable controls. Some are just a collection of text, graphics, and canvases into a new kind of widget.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Scorp1us
              wrote on last edited by
              #6

              Text: QLabel
              Graphics... Outta Luck.
              Canvases... Outta Luck.

              I would say get acquainted with QPalette and use the system colors where appropriate.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                t3685
                wrote on last edited by
                #7

                Aren't you just supposed to set the public properties which determine the visuals of the calendar? The event handlers are there for the Calendar to "work", but we as users should only worry about the visuals.

                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