Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qpalette
    Log in to post

    • SOLVED QPalette set QMenubar background is not working
      General and Desktop • qt6 menubar qpalette • • jiajintao  

      4
      0
      Votes
      4
      Posts
      46
      Views

      @SGaist thank your message, i solved it.
    • SOLVED QMessage box buttons size/others have incorrect width after setting style.
      General and Desktop • qss qstyle qstylesheet qpalette fusion • • Dariusz  

      7
      0
      Votes
      7
      Posts
      94
      Views

      I finally got it solved... The fix was: QPushButton { width: 100%; } :- )
    • UNSOLVED Where is QLineEdit's text drawn in QStyle?
      General and Desktop • qstyle qpalette • • CJha  

      3
      0
      Votes
      3
      Posts
      52
      Views

      @mrjj Thanks, it seems like odd behaviour. So, it uses its native palette, i.e. the palette set either directly or inherited from its parent. I am able to change the colour now, but I am using a C-Style cast, and that's why I am not sure if I should do it. Here is my solution: void GuiStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const { if(vars[id].customTheme) { if(element == QStyle::PE_PanelLineEdit) { const QStyleOptionFrame* comboOption = qstyleoption_cast<const QStyleOptionFrame*>(option); QStyleOptionFrame newComboOption = *comboOption; newComboOption.palette.setBrush(QPalette::Base, Qt::red); // I am using C-Style cast to get the widget in a non-const pointer and then it's palette again the same way QLineEdit* lineEditPtr = (QLineEdit*)widget; QPalette pal = (QPalette)lineEditPtr->palette(); pal.setColor(QPalette::Text, Qt::green); lineEditPtr->setPalette(pal); QProxyStyle::drawPrimitive(element, &newComboOption, painter, widget); } } else { QProxyStyle::drawPrimitive(element, option, painter, widget); } }
    • UNSOLVED QPushButton color is different than what I am setting in QPalette
      General and Desktop • qstyle qpalette • • CJha  

      1
      0
      Votes
      1
      Posts
      38
      Views

      No one has replied

    • UNSOLVED How to define push button pressed colour through QPalette in Fusion Style?
      General and Desktop • qpushbutton qpalette • • CJha  

      9
      0
      Votes
      9
      Posts
      183
      Views

      @CJha Since my buttons change icons for different states as well, they are redrawn. If only background color needs to change, reset stylesheet is good enough in your case..
    • UNSOLVED QTreeView::palette().highlight() is not the same color as seen!
      General and Desktop • qtreeview qpalette highlight • • esope  

      4
      0
      Votes
      4
      Posts
      1590
      Views

      Hi, To add to @mrjj, the styles are free to ignore the palette or certain elements of the palette.
    • How can I access the background color from the application stylesheet in my custom widget?
      General and Desktop • stylesheet qpainter qpalette qcolor • • Jakob  

      18
      0
      Votes
      18
      Posts
      8201
      Views

      Please share any bug report you are opening so that other may find them more easily.
    • UNSOLVED How to set a QPalette::Window to a QGraphicsScene?
      General and Desktop • qgraphicsscene qpalette • • Lays147  

      3
      0
      Votes
      3
      Posts
      1122
      Views

      @Lays147 If only you want changed background color for QGraphicsScene, then: scene()->setBackgroundBrush(palette().window());
    • SOLVED QFrame::setBackgroundRole not working?
      General and Desktop • background color qpalette • • applefier  

      2
      0
      Votes
      2
      Posts
      1441
      Views

      Ok, I just realized that I was asking for QPalette::Window of the widget itself, not the application. Nothing wrong with being stupid.
    • Render HTML to QPixmap - QWebFrame render() method with transparent background
      Qt WebKit • qpixmap html pixmap qpalette qwebframe • • NiHoTleHot  

      0
      0
      Votes
      0
      Posts
      774
      Views

      No one has replied

    • Stylesheet doesn't use widget's palette for color?
      General and Desktop • qwidget stylesheet qpalette • • shavera  

      5
      0
      Votes
      5
      Posts
      4084
      Views

      I understand you want to use the palettes but just as a note - you can also style a widget by name and that way override the color. QPushButton#TheWidgetName { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 0)); }
    • [Solved] Dynamically set style.
      General and Desktop • qapplication qstyle qpalette • • tomas.soltys  

      2
      0
      Votes
      2
      Posts
      950
      Views

      OK, I found a solution. Two methods have to be called in reverse order. QStyle *style = QStyleFactory::create(styleName); QApplication::setPalette(style->standardPalette()); QApplication::setStyle(style); And now it works as desired. Tomas
    • Not able to fix my picture file to Wanted resolution
      General and Desktop • qpixmap qgridlayout qpalette • • houmingc  

      3
      0
      Votes
      3
      Posts
      804
      Views

      Did two thing. Using recommended code below, compilation Error appear ->"The program has unexpectedly finished" QImage myImage; myImage.load(":/file/rightp.png"); myImage.scaled(1366,254, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); How to scale stylesheet to 1/4 of mainwindow using below code MainWindow w; w.setStyleSheet("background-image:url(./file/left.png)"); w.show();