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. Is that possbile to change the border color & style of frame box
Forum Updated to NodeBB v4.3 + New Features

Is that possbile to change the border color & style of frame box

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 6.4k 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.
  • F Offline
    F Offline
    fifth
    wrote on last edited by
    #1

    I've built a custom QScrollArea-based widget, and set its frame shape to BOX and some line width.
    Now I'm intended to change the border color and border style (maybe dashed, dotted, etc) of that frame box, how to get that?
    The four borders may get different line width or style individually. You can image that it's quite like CSS box concept.

    I tried to override paintEvent() in scrollarea widget, however it never got called. Only paintEvent of content widget of scrollarea was working. I guessed the reason was that content widget covered over scrollarea widget, so there was no paint event received by scrollarea widget.

    Thanks.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BlackDante
      wrote on last edited by
      #2

      this would help you "Style Sheet":http://doc.qt.nokia.com/4.7/stylesheet.html

      sorry for my broken english :)

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fifth
        wrote on last edited by
        #3

        I'm afraid that I'm not going to use style sheet. The style sheet programming way is not quite comfortable in my case, I built everything dynamically. Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.

        [quote author="BlackDante" date="1294912567"]this would help you "Style Sheet":http://doc.qt.nokia.com/4.7/stylesheet.html[/quote]

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          try to change your rules when using Qt! Just trust ;)

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

            [quote author="fifth" date="1294912043"]I've built a custom QScrollArea-based widget, and set its frame shape to BOX and some line width.
            Now I'm intended to change the border color and border style (maybe dashed, dotted, etc) of that frame box, how to get that?
            The four borders may get different line width or style individually. You can image that it's quite like CSS box concept.[/quote]

            Then you have to implement custom painting for your QFrame base, or go with stylesheets.

            [quote]Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.[/quote]

            This is simply wrong. Just use the right selectors.

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            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
              #6

              [quote author="fifth" date="1294913184"]I'm afraid that I'm not going to use style sheet. The style sheet programming way is not quite comfortable in my case, I built everything dynamically. Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.
              [/quote]

              can u elaborate why and which rules would get broken? I use stylesheets and find them very convenient to use and very neat :)

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fifth
                wrote on last edited by
                #7

                Actually I'm on using Qt to implement a rendering engine of a lightweight browser. It's unlikely to mix up these 2 style sheets.

                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