class Ui::MainWindow' has no member named 'webView'
-
Need to compile below:
pro.file QT += core gui QT += webkitwidgets QT += webkit greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = SeleniumFactory TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QUrl> #include <QWebFrame> #include <QWebElement> #include <QtWebKitWidgets/QWebView> #include <iostream> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_urlLineEdit_returnPressed(); void on_toggleButton_released(); void on_genButton_released(); void on_webView_selectionChanged(); void on_backButton_clicked(); private: Ui::MainWindow *ui; bool collect; }; #endif // MAINWINDOW_H mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); ui->webView->load(QUrl("http://www.google.com")); ui->webView->show(); collect = false; } MainWindow::~MainWindow(){ delete ui; } /** * @brief MainWindow::on_urlLineEdit_returnPressed * - A URL has been inputed and will now load webpage */ void MainWindow::on_urlLineEdit_returnPressed(){ QUrl url(ui->urlLineEdit->text()); std::cout << "URL: " << ui->urlLineEdit->text().toStdString() << std::endl; ui->webView->load(url); ui->webView->show(); } /** * @brief MainWindow::on_toggleButton_released - Upon click * sets "collect" variable to true/false -- Start/Stop. * If collect is true, collect every object targeted/user input, * in order to produce selenium code. */ void MainWindow::on_toggleButton_released(){ collect = !collect; if(collect){ ui->toggleButton->setText("Stop"); }else{ ui->toggleButton->setText("Start"); } } // Back button for browser void MainWindow::on_backButton_clicked(){ ui->webView->back(); } // Generate Code upon release void MainWindow::on_genButton_released(){ // Nothing yet } void MainWindow::on_webView_selectionChanged(){ if(ui->webView->page()->hasSelection()){ // Log Focus } } main.cpp #include <QUrl> #include <QtWebKitWidgets/QWebView> #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); ui->webView->load(QUrl("http://www.google.com")); ui->webView->show(); }issues:
in constructor MainWindow::MainWindow(QWidget*)
'class Ui::MainWindow' has no member named 'webView'
'class Ui::MainWindow' has no member named 'webView'Qt Creator 3.3.0 (opensource)
Based on Qt 5.4.0 (MSVC 2010, 32 bit) -
Hi @icebergenergy,
Is there any particular reason for using such an old Qt creator version?
Hard to tell why it doesn’t work…
Cheers
Axel -
Need to compile below:
pro.file QT += core gui QT += webkitwidgets QT += webkit greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = SeleniumFactory TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QUrl> #include <QWebFrame> #include <QWebElement> #include <QtWebKitWidgets/QWebView> #include <iostream> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_urlLineEdit_returnPressed(); void on_toggleButton_released(); void on_genButton_released(); void on_webView_selectionChanged(); void on_backButton_clicked(); private: Ui::MainWindow *ui; bool collect; }; #endif // MAINWINDOW_H mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); ui->webView->load(QUrl("http://www.google.com")); ui->webView->show(); collect = false; } MainWindow::~MainWindow(){ delete ui; } /** * @brief MainWindow::on_urlLineEdit_returnPressed * - A URL has been inputed and will now load webpage */ void MainWindow::on_urlLineEdit_returnPressed(){ QUrl url(ui->urlLineEdit->text()); std::cout << "URL: " << ui->urlLineEdit->text().toStdString() << std::endl; ui->webView->load(url); ui->webView->show(); } /** * @brief MainWindow::on_toggleButton_released - Upon click * sets "collect" variable to true/false -- Start/Stop. * If collect is true, collect every object targeted/user input, * in order to produce selenium code. */ void MainWindow::on_toggleButton_released(){ collect = !collect; if(collect){ ui->toggleButton->setText("Stop"); }else{ ui->toggleButton->setText("Start"); } } // Back button for browser void MainWindow::on_backButton_clicked(){ ui->webView->back(); } // Generate Code upon release void MainWindow::on_genButton_released(){ // Nothing yet } void MainWindow::on_webView_selectionChanged(){ if(ui->webView->page()->hasSelection()){ // Log Focus } } main.cpp #include <QUrl> #include <QtWebKitWidgets/QWebView> #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); ui->webView->load(QUrl("http://www.google.com")); ui->webView->show(); }issues:
in constructor MainWindow::MainWindow(QWidget*)
'class Ui::MainWindow' has no member named 'webView'
'class Ui::MainWindow' has no member named 'webView'Qt Creator 3.3.0 (opensource)
Based on Qt 5.4.0 (MSVC 2010, 32 bit)@icebergenergy said in class Ui::MainWindow' has no member named 'webView':
class Ui::MainWindow' has no member named 'webView'
Check in the Designer that the object name of your QWebView is really "webView"
-
my current project build with 3rd parties libraries, it was long long way, so now I'm really concerned to update
@Axel-Spoerl said in class Ui::MainWindow' has no member named 'webView':
Hi @icebergenergy,
Is there any particular reason for using such an old Qt creator version?
Hard to tell why it doesn’t work…
Cheers
Axel@mpergand what is designer?
-
my current project build with 3rd parties libraries, it was long long way, so now I'm really concerned to update
@Axel-Spoerl said in class Ui::MainWindow' has no member named 'webView':
Hi @icebergenergy,
Is there any particular reason for using such an old Qt creator version?
Hard to tell why it doesn’t work…
Cheers
Axel@mpergand what is designer?
@icebergenergy said in class Ui::MainWindow' has no member named 'webView':
what is designer?
It is the graphical UI designer in QtCreator.
Ui::MainWindow indicates that you're using the designer to create the UI. -
Hallo Karl-Heinz,
ohne es ganz genau zu wissen: Listen sind in Python integrierte Typen, daher gibt's die QList nicht.
Du kannst das Ergebnis vonself.w.katTWKategorien.selectedItems()einer Variablen zuweisen und bekommst mit
myList[0]das erste Element (wenn es ein solches gibt).
LG
Axel