Skip to content
  • 0 Votes
    10 Posts
    971 Views
    SGaistS
    @Pl45m4 nope, I understood ;-) I wanted to know why additional letter was needed since it's not how QSyntaxHighlighter works as you correctly explained.
  • Find color of QRect

    Unsolved General and Desktop color beginner rectangle qrect
    6
    0 Votes
    6 Posts
    1k Views
    Kent-DorfmanK
    haven't looked because I had no reason to use it, but some graphics APIs have a ValueOfPixel() function to get the attributes of an on-screen pixel. Seems of limited use though, since it is assumed that if you put down a pixel in the first place then you should know how you rendered it. FWIW, if your QPainter is rendering to a pixmap/bitmap then you should be able to get the rendered value from that backing.
  • 0 Votes
    2 Posts
    477 Views
    SGaistS
    Hi, I would start by checking if there where any changes to the style classes between the two releases. Also, since you are using 5.15.8, it means you have a commercial license and thus can contact the Qt Company for support.
  • How to get current theme color ?

    Unsolved QML and Qt Quick theme color qml
    5
    1 Votes
    5 Posts
    3k Views
    RokeJulianLockhartR
    @SeeLook, is it accessible from outside QML?
  • 0 Votes
    9 Posts
    4k Views
    jeanmilostJ
    For info I found also another alternative: ... import QtQuick.Controls 2.12 import QtQuick.Controls.Material.impl 2.12 ... ProgressBar { ... id: pbProgress contentItem: ProgressBarImpl { implicitHeight: pbProgress.height anchors.fill: parent anchors.margins: 0 scale: pbProgress.mirrored ? -1 : 1 progress: pbProgress.position indeterminate: pbProgress.visible && pbProgress.indeterminate color: "#5014ad" } ... }
  • 0 Votes
    4 Posts
    4k Views
    JonBJ
    @pauledd You mean the background color "overspill" to right & bottom? I don't know but you might play with border-... or padding-... (I'm thinking margin- does not use background color, but I might be wrong) having a width/transparency/grey....
  • 0 Votes
    4 Posts
    1k Views
    J.HilkJ
    @MasterBLB said in QGroupBox title with two different colors (left half black, right half orange): WTF, why I can't mark @mrjj 's post as correct answer?? Sadly, until we update to a newer version of the forum software, that option is not available for every user. I'll set it as the correct answer for you.
  • 0 Votes
    4 Posts
    2k Views
    M
    @Shrinidhi-Upadhyaya Thank you that was exactly what i was after
  • 0 Votes
    6 Posts
    3k Views
    Chris KawaC
    Yeah, that looks ok. I wasn't suggesting to remove the flush permanently, just to see that the system background is drawing when you don't flush. Btw. Keep in mind that the system color can change at any time so if you want to be 100% correct you should either get it every time you render or handle the WM_SYSCOLORCHANGE and WM_THEMECHANGED messages.
  • 0 Votes
    6 Posts
    4k Views
    E
    @tansgumus said in Button backgound non-existent property!: Component.onCompleted: { // WORKS! // button.background.color = "red" // WRONG background = Rectangle { color: "red" } } Because Component.onCompleted is a javascript function and you can use only js syntax inside it. Rectangle { color: "red" } is QML specific syntax, js doesn't understand it. You can create a component dynamically (see the QML docs) by giving the component as a string to Qt.createQmlObject(). If you use button.background.color = "red" in Component.onCompleted it retains all other properties of the backround; I have found it to be a convenient way to change only one or two properties without messing others. Using other approaches, i.e. defining the whole component either dynamically or declaratively, overwrites everything which may or may not be desirable.
  • How to change QPushButton icon color

    Solved General and Desktop qpushbutton qicon qstylesheet color
    13
    0 Votes
    13 Posts
    40k Views
    mrjjM
    @OlivierDuguay Super ! So it was possible via the options. (variantmap) Seems like pretty nice library.
  • Tag html on QString not applied when contains "\n"

    Solved General and Desktop qstring color html
    2
    0 Votes
    2 Posts
    1k Views
    SeeLookS
    Then use "<br>" instead of "\n"
  • Element color in custom style

    Solved General and Desktop style qproxystyl qstyle painter color
    3
    0 Votes
    3 Posts
    2k Views
    gabodevG
    @mrjj Thank you very much! I have researched and been able to do what I was looking for. Here's what I did: def drawPrimitive(self, element, opt, painter, widget): if element == QStyle.PE_PanelButtonTool: pressed = (opt.state & STATE_SUNKEN | opt.state & STATE_ON) color = QColor("#323232") if pressed: color = QColor("#222222") elif opt.state & STATE_ENABLED and opt.state & STATE_MOUSEOVER: color = QColor("#4e4e4e") painter.fillRect(opt.rect, color) elif element == QStyle.PE_IndicatorArrowDown or \ element == QStyle.PE_IndicatorArrowUp: r = opt.rect size = min(r.height(), r.width()) image = QImage(size, size, QImage.Format_ARGB32_Premultiplied) image.fill(Qt.transparent) image_painter = QPainter(image) image_painter.setPen(QColor("#bdbfc0")) image_painter.setBrush(QColor("#bdbfc0")) polygon = QPolygon() polygon.append(QPoint(0, r.width() * 0.5)) if element == QStyle.PE_IndicatorArrowDown: polygon.append(QPoint(size, size * 0.6)) polygon.append(QPoint(size / 2, size * 0.1)) else: polygon.append(QPoint(size, size * 0.5)) polygon.append(QPoint(size / 2, size * 0.9)) image_painter.drawPolygon(polygon) image_painter.end() pixmap = QPixmap.fromImage(image) painter.drawPixmap(r.x() + (r.width() - size) / 2, r.y() + (r.height() - size) / 2, pixmap) else: QProxyStyle.drawPrimitive(self, element, opt, painter, widget) Regards!
  • Qt Console Application - Print colored text

    Unsolved General and Desktop print color console
    12
    0 Votes
    12 Posts
    13k Views
    A
    Yes, the code you have there uses VT100 Escape Codes (note that \033 is the octal representation of character 27=escape. You could also use the hexadecimal \x1b instead), see http://en.wikipedia.org/wiki/ANSI_escape_code These require a terminal emulator that supports VT100, which almost all linux terminal emulators do. Windows Command Prompt doesn't support them by default, but at the bottom of https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences there is some code that shows how to turn that on (it's only a few lines of additional code that you only need to run once at the beginning - I would put it into an #ifdef __WIN32 #endif for platform independence.) I haven't actually tried that though and I'm not sure on which versions of windows it works. Regarding python: python doesn't natively support VT100 either, but the colorama package https://pypi.org/project/colorama/ enables them (to my knowledge, it replaces the print or write methods with something that extracts the escape codes and does the manipulations via calls to kernel32.dll methods).
  • Unable to assign QJSValue to QColor

    Unsolved QML and Qt Quick qcolor color qjsvalue c++ qml
    2
    0 Votes
    2 Posts
    4k Views
    p3c0P
    Hi @Mark81, As per the docs: Values must be simple constants; either strings (quoted and optionally within a call to QT_TR_NOOP), boolean values (true, false), numbers, or enumeration values (such as AlignText.AlignHCenter). So IMO a QColor cannot be assigned to the role myColor. And this in turn causes problem in the delegate.
  • 0 Votes
    3 Posts
    2k Views
    Q
    Thank you! Just perfect! :D
  • Change color while the button is pressed

    Unsolved General and Desktop color button c++
    3
    0 Votes
    3 Posts
    14k Views
    D
    @mandruk1331 Hi, yourButton->setStyleSheet("QPushButton:pressed { background-color: red }");
  • How to color when drawing QFrame as a line

    Solved General and Desktop qframe stylesheet color
    4
    0 Votes
    4 Posts
    4k Views
    mrjjM
    @Jakob well if FrameShadow is not plain it does nothing so first i though it didn't work either.
  • 0 Votes
    10 Posts
    6k Views
    L
    @SGaist Argh everything's too confusing. I think I'll just leave it for now haha
  • QFrame::setBackgroundRole not working?

    Solved General and Desktop background color qpalette
    2
    0 Votes
    2 Posts
    2k Views
    A
    Ok, I just realized that I was asking for QPalette::Window of the widget itself, not the application. Nothing wrong with being stupid.