Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.0 RC2
-
None
Description
QSlider does not repaint on macOS Monterey.
Steps to reproduce:
- Sample: put QSlider and QPlainTextEdit on a dialog, and connect signals of them, so that they show same value and update each others.
- On macOS 12 Monterey, drag slider, text edit shows correct value
- now change value in text edit, but slider won't repaint (though internally the value is correct in NSSlider)
Notes:
- Only an issue on Mac os 21 Monterey (I got Beta so far)
- Do not set any stylesheet to the slider, so that Qt user cocoa native API to paint
- If I applied customized stylesheet, then Qt paints the slider value correctly, therefore it seems to be something related to cocoa api.
My Sample code:
#include <QApplication> #include <QDialog> #include <QSlider> #include <QPlainTextEdit> #include <QSpacerItem> #include <QGridLayout> #include <iostream> int main(int argc, char **argv) { QApplication app(argc, argv); QDialog dlg; // Create slider with value range 0-100 auto * slider = new QSlider(Qt::Horizontal, &dlg); slider->setMinimum(0); slider->setMaximum(100); slider->setValue(50); // Create text edit which display/sets the slider value auto * edit = new QPlainTextEdit(&dlg); // Layout auto * grid = new QGridLayout; grid->addWidget(edit, 0, 0); grid->addWidget(slider, 1, 0); dlg.setLayout(grid); // slider signal handling, update value to edit dlg.connect(slider, &QSlider::valueChanged, [edit](int value){ std::cout << "onSliderValueChanged: " << value << std::endl; edit->blockSignals(true); edit->setPlainText(std::to_string(value).c_str()); edit->blockSignals(false); }); // edit signal handling, update value to slider dlg.connect(edit, &QPlainTextEdit::textChanged, [edit, slider](){ int v = 0; try { v = std::stoi(edit->toPlainText().toStdString()); } catch (...) {} std::cout << "onEditEditingFinished(): " << v << std::endl; slider->blockSignals(true); slider->setValue(v); slider->blockSignals(false); }); dlg.show(); return app.exec(); }
The screenshot when issue occurs (on Monterey), the slider range 0-100, I changed text to 75, but slider never repaints.