Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Setting the URL when a new tab is made
nicky j last edited by
I am having some trouble (like always) with my browser. My browser has a class named mainView and another called browseTab. mainView contains a QTabWidget that contains a browseTab. browseTab contains a QWebView called webView. in my mainView class I have a slot that adds a new tab:
tabWidget->addTab(new browseTab(this), tr("Search"));
the newTab() slot is called from within browseTab, this works fine, but I would like to have another parameter when creating a new browseTab. I would like to be able to specify the URL of the webView inside the browseTab. Something like:
tabWidget->addTab(new browseTab(this, 'URL'), tr("Search"));
This way I can call the newTab slot and create a new tab with a browseTab containing a webView that automatically loads a certain URL.
here is the constructor for browseTab:
@browseTab::browseTab(QWidget *parent) :
And here is where newTab() is called from within browseTab:
@connect(NewTabAction, SIGNAL(triggered()), mainView_object_pointer, SLOT(newTab()));@
I would like it so that I can specify a URL in the connect() function (located in browseTab) and have it create a new tab with a specific URL.
code solutions would be great!