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. Using a palette to set the color of a labels text in QtDesigner
Forum Updated to NodeBB v4.3 + New Features

Using a palette to set the color of a labels text in QtDesigner

Scheduled Pinned Locked Moved General and Desktop
17 Posts 3 Posters 12.2k 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.
  • D Offline
    D Offline
    daviddoria
    wrote on last edited by
    #1

    In QtDesigner, I have a label. In the property editor, I clicked on "change palette" next to the "palette" property. Then I changed the "Text" active color to green. When I close the dialog, the text is still black. What am I missing here? I know you can also use css to color the text, but I'd like to do it via a palette if possible.

    Any suggestions?

    Thanks,

    David

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

      Hmm.. It looks very strange. Screenshot with explanation in a what way do you doing it?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        daviddoria
        wrote on last edited by
        #3

        Here is a screenshot. I have set this color, then closed the dialog and opened it again (so it has already been "applied"):

        !http://daviddoria.com/Uploads/designer.jpg(designer)!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Styles are not required to actually use the palette. It might be your style ignores the palette. Does the same happen in previews using other styles?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            daviddoria
            wrote on last edited by
            #5

            How do I change styles in Designer?

            It is worth noting that other widgets (like a LineEdit) do change text color correctly using the same approach.

            Also, I find it strange that there is no Label in the collection of widgets in the "Preview" section of the Edit Palette, but there is almost every other standard widget?

            Thanks,

            David

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              What happens if you click Tools -> Form Editor -> Preview in... -> (one of the other styles) ?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                daviddoria
                wrote on last edited by
                #7

                Nope, with all styles the text is still black. Does it work for you?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  You are right: it does not, and that is strange.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    daviddoria
                    wrote on last edited by
                    #9

                    Andre - so what should I do? haha

                    Do you think this is an actual bug that I should report?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      Perhaps you should, yes. When you do, please refer to this topic in your report, and report back with a link to the report in this topic.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        daviddoria
                        wrote on last edited by
                        #11

                        Designer didn't seem to be an option to report bugs, so I posted it under Creator: https://bugreports.qt-project.org/browse/QTCREATORBUG-7638

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andre
                          wrote on last edited by
                          #12

                          Are you sure it is a creator bug, and not an issue with Qt itself?

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            daviddoria
                            wrote on last edited by
                            #13

                            Oh, no, maybe it is a Qt thing, since it doesn't show up correctly at run time either. I guess I was assuming it was just not getting set properly. It didn't look like I could list the bug in two categories - maybe I'll leave it here for a few days and move it if it doesn't get any attention?

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              andre
                              wrote on last edited by
                              #14

                              If it doesn't show correctly at runtime either, then it is a Qt issue. The fact that QtCreator doesn't show the change is just a result of that. After all, QtCreator is build on Qt as well. :-)

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andre
                                wrote on last edited by
                                #15

                                As per comment in the bugreport by Volker:
                                The palette does work, but the role to use is the WindowText (top one in Designer).

                                No clue why I missed that before.

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  daviddoria
                                  wrote on last edited by
                                  #16

                                  Interesting... that did work. What is the difference between Text and WindowText?

                                  Also, is there a reason that almost every basic widget is represented in the Edit Palette -> Preview Window except QLabel?

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    andre
                                    wrote on last edited by
                                    #17

                                    Now, that is a Qt Creator issue :-)

                                    I guess it is because the labels of the checkboxes behave the same anyway?

                                    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