Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Mouse Click location/field on a website



  • Hi all

    I have opened a website URL inside my program, and was wondering if there was a way of capturing where on the site the mouse has been clicked, in order to ID and then fill in that field.

    Any ideas?

    Thanks

    James



  • @James-Sprinks said in Mouse Click location/field on a website:

    opened a website URL inside my program

    How? what widget are you using?



  • I am using a QWidget that has been changed to a QWebEngineView class (called 'screen' in the code below):

    ainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        timer = new QTimer(this);
        view = new QWebEngineView(this);
        connect(ui->web, SIGNAL(clicked(bool)),this,SLOT(webclick()));
        connect(ui->scrape, SIGNAL(clicked(bool)), this, SLOT(scrape()));
    
        connect(timer,SIGNAL(timeout()), this, SLOT(scrape()));
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::webclick()
    {
        QUrl site("http://www.google.co.uk");
        ui->screen->load(site);
    }
    
    

Log in to reply