C++ (Qt)void MainWidget::currentCharFormatChanged(const QTextCharFormat &format){ QColor color; QBrush brush = format.foreground(); if (brush != Qt::NoBrush) color = brush.color(); else color = // берете цвет из styleSheet