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. How to set color for margin?
QtWS25 Last Chance

How to set color for margin?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 10.5k Views
  • 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.
  • N Offline
    N Offline
    nen777w
    wrote on 18 Apr 2013, 21:01 last edited by
    #1

    How I can setup color for margin?
    In my class (that inherited from QScrollArea) I set up margin on the following manner:
    setViewportMargins(0,3,0,0); //ONLY top margin
    I want use it for show to user the "active" ScrollArea.
    I know about the "border: " but it's not suitable.

    Thanks.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 18 Apr 2013, 22:13 last edited by
      #2

      There's no "margin-color" sort of property in CSS. Margin is just the space between the parent border and child border so it lies inside the parent but outside of the child. As such what you would call the color of margin is nothing else than a color of the parent widget.
      So to have what you want just set the background-color of the QScrollArea to one color, and the background-color of the content widget to another.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nen777w
        wrote on 19 Apr 2013, 11:40 last edited by
        #3

        Thanks, I tried to do that but it's look very ugly :-(
        !ftp://RSDN:RSDN@nen777w.no-ip.org/Qt/margin_color.jpg(margin_color)!

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 19 Apr 2013, 11:49 last edited by
          #4

          Sorry, can't see the image from this ftp address. Can you post it on something like imageshack?

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nen777w
            wrote on 19 Apr 2013, 12:03 last edited by
            #5

            Sorry.
            Here:
            !http://img221.imageshack.us/img221/1777/margincolor.jpg(margin color)!

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on 19 Apr 2013, 13:25 last edited by
              #6

              I'm not sure I understand, but instead of giving the background one solid green color you can set a background-image like so:
              @
              background-image: url(green_image_1px_by_3px.png);
              background-position: left top;
              background-repeat: repeat-x;
              @

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dvillalobos
                wrote on 19 Apr 2013, 14:10 last edited by
                #7

                Hi Chris Kawa,

                I just want to say thanks for the idea.

                Regards

                David

                1 Reply Last reply
                0

                5/7

                19 Apr 2013, 12:03

                • Login

                • Login or register to search.
                5 out of 7
                • First post
                  5/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved