Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting the URL when a new tab is made
Qt 6.11 is out! See what's new in the release blog

Setting the URL when a new tab is made

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 540 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello everyone,

    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:

    @void mainView::newTab()
    {
    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:

    @void mainView::newTab()
    {
    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) :
    QWidget(parent),
    mainView_object_pointer(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!

    Thanks!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved