Question

How do I connect QSlider to QWebView's setTextSizeMultiplier in Qt? I want to web's text to get smaller or larger depending on the slider's value when it changes.

This is how I'm trying to do it, but not getting anywhere: thesliderbar is QSlider and vweb is QWebView

connect(thesliderbar,SIGNAL(valueChanged(int)),ui->vweb,SLOT(setTextSizeMultiplier(int)));
Était-ce utile?

La solution

http://doc.qt.io/qt-5/qwebview.html for here you can see that setTextSizeMultiplier it is not a slot so you can not connect/compile...

EDIT1: also function signature is different. You are using int as a parameter but it is a qreal...

Make a slot in your class, connect to it and update the text multiplier from there.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top