QT multi-tag browser (1) and qt tag Browser

Source: Internet
Author: User

QT multi-tag browser (1) and qt tag Browser

I recently used QT to write a simple browser. The original version is 5.7. Instead of QWebView, I used QAxWidget to load ie. The advantage is that the webpage can be opened quickly, but when you click a link in the webpage, windows IE browser will be automatically called, the level is limited, and you do not know how to open it in your own program, the search is fruitless, you have to give up using QAxWidget (please kindly advise !!!), Reduce QT to 5.6 and use QWebView.

(1) Draw the QT Interface

Add 6 qtoolbuttons and a qlineedits, and search for .png in the qtinstallation directory;

Add a QTabWidget and a QWebView. The effect is as follows:

(2) Add a slot function to open a webpage and link the carriage return signal and slot function in the address bar.

Void LXBrowser: goWeb () {QString url = ui. addressLineEdit-> text (); url = "http: //" + url; // you must add http: // to open the webpage... Ui. webView-> load (url);} to be improved );}

(3) connect the linkClicked (const QUrl &) signal and slot functions in QWebView to open a webpage on a new page.

connect(ui.webView, SIGNAL(linkClicked(const QUrl &)), this, SLOT(clickLink(const QUrl &)));
void LXBrowser::clickLink(const QUrl &linkUrl){    QWebView* newWebView = new QWebView();    newWebView->load(linkUrl);    int index = ui.tabWidget->addTab(newWebView, linkUrl.fileName());    ui.tabWidget->setCurrentIndex(index);    ui.addressLineEdit->setText(linkUrl.toString());}

Effect:

A super simple browser is complete, hahaha

Problems:

1. The forward, backward, stop, add to favorites, and history functions have not yet been implemented;

2. title of the new tag;

3. Slow webpage access, especially for websites with iQiYi, Youku, and many other videos or images;

4. You need to add a status bar to display the percentage of the current webpage loaded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.