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. Spinbox StyleSheet Margin create background shift :S

Spinbox StyleSheet Margin create background shift :S

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.7k 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.
  • K Offline
    K Offline
    Kytrix
    wrote on last edited by
    #1

    Hi,

    I add the following stylesheets rules with qtdesigner:

    @QWidget{
    margin-top: 5px;
    }

    QDoubleSpinBox, QSpinBox {
    background : white;
    }
    @
    and I get the following result:
    !http://mk1.ti1ca.com/1luwflth.jpg(QSpinbox margin background shift)!

    the margin shift down the background(by 5pixels) and I don't know why.
    It does on QSpinbox and QDoubleSpinBox, but not on QWidget, QLineEdit ...

    This is a bug ? or I misunderstand something ?

    thanks to help :)

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      I've seen this too.
      Are you using any layout and if so, can you check whats the top margin value in the layout?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        The point is a different :-)

        with

        @
        QWidget{
        margin-top: 5px;
        }
        @

        you define a general margin for all widgets, as all widgets are derived from QWidget.
        The background of a widget is painted inside the margins, so it will be moved down by 5 pixel.

        Perhaps a TextEdit (I think the bottom most widget is a text edit) resets this....

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kytrix
          wrote on last edited by
          #4

          If I made a rule for my #item only, or QSpinBox, it does the same :/

          I'm using QT 4.6.2

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

            [quote author="Gerolf" date="1297332205"]
            @
            QWidget{
            margin-top: 5px;
            }
            @
            [/quote]

            ok to an existing form that i was working on, I just added these 2 spin boxes and the stylesheet. They came up properly. But another graphicsview that was in a different frame ended up with a background offset. How would you explain that since I had not set background for the graphicsview?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kytrix
              wrote on last edited by
              #6

              It does exactly the same with a new frame.
              !http://dk9.ti1ca.com/get/141.194.10.62/gui1p48e/form-spinbox.png(form spinbox)!

              and here is the code:
              @#_spin1{
              margin-top:5px;
              }
              #_spin2{
              margin-bottom:5px;
              }
              #_spin3{
              margin-left:5px;
              }
              #_spin4{
              margin-right:5px;
              }@

              You can also see a display bug in the down-arrow backgroud texture (kind of backgroud-repeat) .. but i didn't use so big spinbox :D

              In my case, my controls are paired label + spinbox in a form layout, so I put a margin on the label and it works.

              1 Reply Last reply
              0
              • ? This user is from outside of this forum
                ? This user is from outside of this forum
                Guest
                wrote on last edited by
                #7

                Hi Kytrix,
                One workaround would be to use a container (frame) and apply a layout to it. The layout can be set margins. The margins in stylesheet can go. That should probably help ... chk it out.
                I think you can log a bug for this "here":http://bugreports.qt.nokia.com

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Kytrix
                  wrote on last edited by
                  #8

                  Yes I have already a Layout, but i don't want to use it margins because I made show/hide on some of my QSpinbox, ands margins stays for hidden widget (not with margin by CSS on widget).
                  (I can put another layout for each line, but I could not get the same with for all my spinboxs ... theys are in a formlayout with labels)

                  Thanks for the help, my workaround works too :)

                  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