How to initiate my own sequence of code when titleChanged event occurs in QWebView in Qt?

StackOverflow https://stackoverflow.com/questions/20439606

Вопрос

I am new to Qt and I have been trying to develop a web browser for desktop. I have got the hang of the GUI designing of my web browser, but I have only started to learn this new language.

My question is: how do I execute my own sequence of code when the titleChanged event of the QWebView occurs?

Seriously speaking, I have no idea how to do this, which is why I cannot post any code. But, can someone please post the code for accomplishing my target. You can assume that I have a class called MainWindow, in which I have added the QWebView from the Qt designer.

If I am unclear then please let me know.

Thank You.

Это было полезно?

Решение

QWebView::titleChanged is a signal, not an event. Go to Qt Designer, open context menu of your QWebView element, choose titleChanged signal. It will create a slot in your MainWindow class.

Using signals and slots is one of the most basic techniques used in Qt. Please read the documentation carefuly.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top