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. [SOLVED] Problem with QPushButton and StyleSheets
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Problem with QPushButton and StyleSheets

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 8.8k 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.
  • E Offline
    E Offline
    Echo89
    wrote on last edited by
    #1

    EDIT: Nevermind, I fixed it, just needed to edit the focusPolicy.

    Here is what I have so far:

    !http://www.imghst.org/uploads/cp6qd01hopg2.png(So far)!

    Well, I have started creating my layout of a music player. Going to be called Echo Music Player, and I've come accross a problem. Whenever I click on the big blue button or any other at that matter, it gets some sort of overlay, orange-ish in color.

    Here is the layout when nothing has been focused on, or clicked:

    !http://www.imghst.org/uploads/xd81l7nzatab.png(Normal)!

    And now in the pressed state (Notice the orange-ish tinge over the button:

    !http://www.imghst.org/uploads/asp08vfgrl6m.png(Pressed)!

    And after I have let go of the mouse and nothing is in "pressed" state:

    !http://www.imghst.org/uploads/mg21y42b2lyi.png(Nothing being pressed)!

    I would really like to remove this orange tinge, it's really annoying.

    Thanks in advance,
    Caelan.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Do you have some code? Maybe you could at least drop a hint as to how you created that layout in the first place?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Echo89
        wrote on last edited by
        #3

        Sorry, I created the layout in Qt Creator, and I used stylesheets to make it look nice.

        But here is the stylesheet:

        @
        QMenuBar {
        background-image: url(:/topbar.png) repeat;
        border-bottom: 1px solid #2C3E5F;
        }

        QMenuBar::item {
        spacing: 3px;
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 5px;
        padding-bottom: 5px;
        background: transparent;
        border-radius: 3px;
        color: #FFF;
        }

        QMenuBar::item:selected {
        background: rgba(255, 255, 255, 100);
        color: rgba(0, 0, 0, 150);
        padding-top: 3px;
        padding-bottom: 3px;
        }

        QSlider {
        background: rgba(255, 255, 255, 50);
        border: 1px solid rgba(255, 255, 255, 100);
        }

        QSlider::handle::horizontal {
        image: url(:/sliderHandle.png);
        height: 20px;
        width: 20px;
        }

        QSlider::sub-page:horizontal {
        background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(100, 149, 237, 255), stop:0.2 rgba(182, 208, 255, 255), stop:0.3 rgba(117, 154, 219, 255), stop:1 rgba(104, 130, 177, 255));
        height: 3px;
        border-radius: 3px;
        border-top: 1px solid rgba(83, 90, 103, 150);
        border-bottom: 1px solid rgba(182, 208, 255, 150);
        border-left: 1px solid rgba(83, 90, 103, 150);
        border-right: 1px solid rgba(83, 90, 103, 150);
        }

        QSlider::add-page:horizontal {
        background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 25), stop:1 rgba(255, 255, 255, 150));
        height: 3px;
        border-radius: 3px;
        border-top: 1px solid rgba(0, 0, 0, 50);
        border-bottom: 1px solid rgba(255, 255, 255, 200);
        border-left: 1px solid rgba(0, 0, 0, 50);
        border-right: 1px solid rgba(0, 0, 0, 50);
        }

        QPushButton {
        background-color: qlineargradient(
        x1:0, y1:0, x2:0, y2:1,
        stop:0 #C5D8FA,
        stop:0.03 #6182BD,
        stop:0.04 #6182BD,
        stop:1 #445A82
        );
        background-image: none;
        border-image: none;
        border: 1px solid #364767;
        }

        QPushButton:pressed {
        background-color: qlineargradient(
        x1:0, y1:0, x2:0, y2:1,
        stop:0 #445A82,
        stop:0.03 #6182BD,
        stop:0.04 #6182BD,
        stop:1 #C5D8FA
        );
        background-image: none;
        border-image: none;
        border: 1px solid #364767;
        }

        QPushButton:default {
        background-color: qlineargradient(
        x1:0, y1:0, x2:0, y2:1,
        stop:0 #C5D8FA,
        stop:0.03 #5289E9,
        stop:0.04 #5289E9,
        stop:1 #4166A6
        );
        background-image: none;
        border-image: none;
        border: 1px solid #364767;
        }
        @

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

          Is the button a button that stays pressed?

          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
          • E Offline
            E Offline
            Echo89
            wrote on last edited by
            #5

            I fixed it anyway.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sam
              wrote on last edited by
              #6

              [quote author="Echo89" date="1355239553"]I fixed it anyway.[/quote]

              Kindly edit your first post and prepend [Solved] to the title.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                Echo89
                wrote on last edited by
                #7

                Will do, Thanks!

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jbates
                  wrote on last edited by
                  #8

                  It would have been nice to know how it was fixed!

                  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