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?
Forum Updated to NodeBB v4.3 + New Features

How to set color for margin?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 11.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.
  • N Offline
    N Offline
    nen777w
    wrote on 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
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 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 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
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 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 last edited by
            #5

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

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on 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 last edited by
                #7

                Hi Chris Kawa,

                I just want to say thanks for the idea.

                Regards

                David

                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