[SOLVED] Problem with QPushButton and StyleSheets



  • 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.


  • Moderators

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



  • 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;
    }
    @



  • Is the button a button that stays pressed?



  • I fixed it anyway.



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

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



  • Will do, Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.