• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WebTab类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WebTab的典型用法代码示例。如果您正苦于以下问题:C++ WebTab类的具体用法?C++ WebTab怎么用?C++ WebTab使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WebTab类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: currentTab

void MainWindow::fileSaveAs()
{
    WebTab *w = currentTab();
    KUrl srcUrl = w->url();
    
    // First, try with suggested file name...
    QString name = w->page()->suggestedFileName();

    // Second, with KUrl fileName...
    if (name.isEmpty())
    {
        name = srcUrl.fileName();
    }
    
    // Last chance...
    if(name.isEmpty())
    {
        name = srcUrl.host() + QString(".html");
    }
    
    const QString destUrl = KFileDialog::getSaveFileName(name, QString(), this);
    if (destUrl.isEmpty()) 
        return;
    
    KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite);
    job->addMetaData("MaxCacheSize", "0");  // Don't store in http cache.
    job->addMetaData("cache", "cache");     // Use entry from cache if available.
    job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:29,代码来源:mainwindow.cpp


示例2: reverseTraverse

void TabTreeView::addMenuActions(QMenu *menu, const QModelIndex &index) const
{
    if (!m_haveTreeModel) {
        return;
    }

    menu->addSeparator();
    QMenu *m = menu->addMenu(tr("Tab Tree"));

    if (index.isValid() && model()->rowCount(index) > 0) {
        QPersistentModelIndex pindex = index;
        m->addAction(tr("Close Tree"), this, [=]() {
            QVector<WebTab*> tabs;
            reverseTraverse(pindex, [&](const QModelIndex &index) {
                WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
                if (tab) {
                    tabs.append(tab);
                }
            });
            for (WebTab *tab : qAsConst(tabs)) {
                tab->closeTab();
            }
        });
    }

    m->addSeparator();
    m->addAction(tr("Expand All"), this, &TabTreeView::expandAll);
    m->addAction(tr("Collapse All"), this, &TabTreeView::collapseAll);
}
开发者ID:Martii,项目名称:qupzilla,代码行数:29,代码来源:tabtreeview.cpp


示例3: updatePinnedTabCloseButton

void TabBar::updatePinnedTabCloseButton(int index)
{
    if (!validIndex(index)) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, closeButtonPosition()));

    bool pinned = webTab && webTab->isPinned();

    if (pinned) {
        if (button) {
            button->hide();
        }
    }
    else {
        if (button) {
            button->show();
        }
        else {
            showCloseButton(index);
        }
    }
}
开发者ID:solodyagin,项目名称:qupzilla,代码行数:25,代码来源:tabbar.cpp


示例4: pinTab

void TabBar::pinTab()
{
    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));

    if (webTab) {
        webTab->togglePinned();
    }
}
开发者ID:593in,项目名称:qupzilla,代码行数:8,代码来源:tabbar.cpp


示例5: tabAt

void TabBar::contextMenuEvent(QContextMenuEvent* event)
{
    int index = tabAt(event->pos());
    m_clickedTab = index;

    QMenu menu;
    menu.addAction(IconProvider::newTabIcon(), tr("&New tab"), m_window, SLOT(addTab()));
    menu.addSeparator();
    if (index != -1) {
        WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
        if (!webTab) {
            return;
        }

        if (m_window->weView(m_clickedTab)->isLoading()) {
            menu.addAction(QIcon::fromTheme(QSL("process-stop")), tr("&Stop Tab"), this, SLOT(stopTab()));
        }
        else {
            menu.addAction(QIcon::fromTheme(QSL("view-refresh")), tr("&Reload Tab"), this, SLOT(reloadTab()));
        }

        menu.addAction(QIcon::fromTheme("tab-duplicate"), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));

        if (count() > 1 && !webTab->isPinned()) {
            menu.addAction(QIcon::fromTheme("tab-detach"), tr("D&etach Tab"), this, SLOT(detachTab()));
        }

        menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
        menu.addAction(webTab->isMuted() ? tr("Un&mute Tab") : tr("&Mute Tab"), this, SLOT(muteTab()));
#endif
        menu.addSeparator();
        menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
        menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
        menu.addSeparator();
        menu.addAction(tr("Close Ot&her Tabs"), this, SLOT(closeAllButCurrent()));
        menu.addAction(QIcon::fromTheme("window-close"), tr("Cl&ose"), this, SLOT(closeTab()));
        menu.addSeparator();
    }
    else {
        menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
    }

    m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(m_tabWidget->canRestoreTab());

    // Prevent choosing first option with double rightclick
    const QPoint pos = event->globalPos();
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);

    m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(true);
}
开发者ID:gnikandrov,项目名称:qupzilla,代码行数:58,代码来源:tabbar.cpp


示例6: isCurrent

bool TabbedWebView::isCurrent()
{
    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabWidget->currentIndex()));
    if (!webTab) {
        return false;
    }

    return (webTab->view() == this);
}
开发者ID:Shadowmeph,项目名称:QupZilla,代码行数:9,代码来源:tabbedwebview.cpp


示例7: bookmarkTab

void TabBar::bookmarkTab()
{
    TabbedWebView* view = m_window->weView(m_clickedTab);
    if (!view) {
        return;
    }

    WebTab* tab = view->webTab();

    m_window->addBookmark(tab->url(), tab->title());
}
开发者ID:593in,项目名称:qupzilla,代码行数:11,代码来源:tabbar.cpp


示例8: bookmarkTab

void TabBar::bookmarkTab()
{
    TabbedWebView* view = p_QupZilla->weView(m_clickedTab);
    if (!view) {
        return;
    }

    WebTab* tab = view->webTab();

    p_QupZilla->addBookmark(tab->url(), tab->title(), tab->icon());
}
开发者ID:ff2000,项目名称:qupzilla,代码行数:11,代码来源:tabbar.cpp


示例9: tabAt

void TabBar::contextMenuRequested(const QPoint &position)
{
    int index = tabAt(position);
    m_clickedTab = index;

    QMenu menu;
    menu.addAction(QIcon(":/icons/menu/new-tab.png"), tr("&New tab"), p_QupZilla, SLOT(addTab()));
    menu.addSeparator();
    if (index != -1) {
        WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
        if (!webTab) {
            return;
        }
        if (p_QupZilla->weView(m_clickedTab)->isLoading()) {
            menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab()));
        }
        else {
            menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload Tab"), this, SLOT(reloadTab()));
        }

        menu.addAction(tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
        menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
        menu.addSeparator();
        menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
        menu.addAction(tr("Bookmark &All Tabs"), p_QupZilla, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        QAction* action = p_QupZilla->actionRestoreTab();
        action->setEnabled(m_tabWidget->canRestoreTab());
        menu.addAction(action);
        menu.addSeparator();
        menu.addAction(tr("Close Ot&her Tabs"), this, SLOT(closeAllButCurrent()));
        menu.addAction(QIcon::fromTheme("window-close"), tr("Cl&ose"), this, SLOT(closeTab()));
        menu.addSeparator();
    }
    else {
        menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("Bookmark &All Ta&bs"), p_QupZilla, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        QAction* action = menu.addAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), m_tabWidget, SLOT(restoreClosedTab()));
        action->setEnabled(m_tabWidget->canRestoreTab());
    }

    // Prevent choosing first option with double rightclick
    const QPoint &pos = mapToGlobal(position);
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);

    p_QupZilla->actionRestoreTab()->setEnabled(true);
}
开发者ID:ff2000,项目名称:qupzilla,代码行数:50,代码来源:tabbar.cpp


示例10: expandAll

void TabTreeView::initView()
{
    // Restore expanded state
    expandAll();
    QModelIndex index = model()->index(0, 0);
    while (index.isValid()) {
        WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
        if (tab) {
            setExpanded(index, tab->sessionData().value(m_expandedSessionKey, true).toBool());
        }
        index = indexBelow(index);
    }

    m_initializing = false;
}
开发者ID:Martii,项目名称:qupzilla,代码行数:15,代码来源:tabtreeview.cpp


示例11: updateCloseButton

void TabBar::updateCloseButton(int index)
{
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));
    if (!button) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    if (webTab && webTab->isPinned()) {
        button->hide();
    }
    else {
        button->show();
    }
}
开发者ID:JoseAngelMuyoz,项目名称:QupZilla,代码行数:15,代码来源:tabbar.cpp


示例12: showCloseButton

void TabBar::showCloseButton(int index)
{
    if (!validIndex(index)) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, closeButtonPosition()));

    if (button || (webTab && webTab->isPinned())) {
        return;
    }

    insertCloseButton(index);
}
开发者ID:solodyagin,项目名称:qupzilla,代码行数:15,代码来源:tabbar.cpp


示例13: showCloseButton

void TabBar::showCloseButton(int index)
{

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    if (webTab && webTab->isPinned()) {
        return;
    }

    CloseButton* button = (CloseButton*)tabButton(index, QTabBar::RightSide);
    if (!button) {
        return;
    }

    button->show();
}
开发者ID:JoseAngelMuyoz,项目名称:QupZilla,代码行数:15,代码来源:tabbar.cpp


示例14: showTabPreview

void TabBar::showTabPreview()
{
    if (m_isFirstTimeOnTab)
        m_isFirstTimeOnTab = false;

    //delete previous tab preview
    delete m_previewPopup.data();
    m_previewPopup.clear();

    MainView *mv = qobject_cast<MainView *>(parent());

    WebTab *indexedTab = mv->webTab(m_currentTabPreviewIndex);
    WebTab *currentTab = mv->webTab(currentIndex());

    // check if view && currentView exist before using them :)
    if (!currentTab || !indexedTab)
        return;

    // no previews during load
    if (indexedTab->isPageLoading())
        return;

    // Make sure the hovered webtab match the current size
    // Only the active one is updated by window resize events
    indexedTab->resize(currentTab->size());

    m_previewPopup = new TabPreviewPopup(indexedTab , this);

    int tabWidth = tabSizeHint(m_currentTabPreviewIndex).width();
    int tabBarWidth = mv->size().width();
    int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - tabWidth) / 2;
    int popupWidth = m_previewPopup.data()->thumbnailSize().width();

    // Center the popup if the tab width is bigger or smaller
    leftIndex += (tabWidth - popupWidth) / 2;

    if (leftIndex < 0)
    {
        leftIndex = 0;
    }
    else if (leftIndex + tabWidth > tabBarWidth)
    {
        leftIndex = tabBarWidth - tabWidth;
    }

    QPoint pos(leftIndex, tabRect(m_currentTabPreviewIndex).y() + tabRect(m_currentTabPreviewIndex).height());
    m_previewPopup.data()->show(mapToGlobal(pos));
}
开发者ID:Arakmar,项目名称:rekonq,代码行数:48,代码来源:tabbar.cpp


示例15: tabSizeHint

QSize TabBar::tabSizeHint(int index) const
{
    QSize size = QTabBar::tabSizeHint(index);
    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    TabBar* tabBar = const_cast <TabBar*>(this);
    tabBar->m_adjustingLastTab = false;

    if (webTab && webTab->isPinned()) {
        size.setWidth(PINNED_TAB_WIDTH);
    }
    else {
        int availableWidth = width() - (PINNED_TAB_WIDTH * m_pinnedTabsCount) - m_tabWidget->buttonListTabs()->width() - m_tabWidget->buttonAddTab()->width();
        int normalTabsCount = count() - m_pinnedTabsCount;
        if (availableWidth >= MAXIMUM_TAB_WIDTH * normalTabsCount) {
            tabBar->m_normalTabWidth = MAXIMUM_TAB_WIDTH;
            size.setWidth(m_normalTabWidth);
        }
        else if (availableWidth < MINIMUM_TAB_WIDTH * normalTabsCount) {
            tabBar->m_normalTabWidth = MINIMUM_TAB_WIDTH;
            size.setWidth(m_normalTabWidth);
        }
        else {
            int maxWidthForTab = availableWidth / normalTabsCount;
            tabBar->m_normalTabWidth = maxWidthForTab;
            //Fill any empty space (we've got from rounding) with last tab
            if (index == count() - 1) {
                tabBar->m_lastTabWidth = (availableWidth - maxWidthForTab * normalTabsCount) + maxWidthForTab;
                tabBar->m_adjustingLastTab = true;
                size.setWidth(m_lastTabWidth);
            }
            else {
                tabBar->m_lastTabWidth = maxWidthForTab;
                size.setWidth(m_lastTabWidth);
            }
        }
    }

    if (index == count() - 1) {
        int xForAddTabButton = (PINNED_TAB_WIDTH * m_pinnedTabsCount) + (count() - m_pinnedTabsCount) * (m_normalTabWidth);
        if (m_adjustingLastTab) {
            xForAddTabButton += m_lastTabWidth - m_normalTabWidth;
        }
        emit tabBar->moveAddTabButton(xForAddTabButton);
    }

    return size;
}
开发者ID:JoseAngelMuyoz,项目名称:QupZilla,代码行数:47,代码来源:tabbar.cpp


示例16: showCloseButton

void TabBar::showCloseButton(int index)
{
    if (!validIndex(index)) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));

    if (button || (webTab && webTab->isPinned())) {
        return;
    }

    QAbstractButton* closeButton = new CloseButton(this);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeTabFromButton()));
    setTabButton(index, QTabBar::RightSide, closeButton);
}
开发者ID:ff2000,项目名称:qupzilla,代码行数:17,代码来源:tabbar.cpp


示例17: kDebug

WebPage *WebPage::createWindow(QWebPage::WebWindowType type)
{
    // added to manage web modal dialogs
    if (type == QWebPage::WebModalDialog)
        kDebug() << "Modal Dialog";

    WebTab *w = 0;
    if (ReKonfig::openTabNoWindow())
    {
        w = rApp->mainWindow()->mainView()->newWebTab(!ReKonfig::openTabsBack());
    }
    else
    {
        w = rApp->newMainWindow()->mainView()->currentWebTab();
    }
    return w->page();
}
开发者ID:wyuka,项目名称:rekonq,代码行数:17,代码来源:webpage.cpp


示例18: pinTab

void TabBar::pinTab()
{
    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
    if (!webTab) {
        return;
    }

    webTab->pinTab(m_clickedTab);

    if (webTab->isPinned()) {
        m_pinnedTabsCount++;
    }
    else {
        m_pinnedTabsCount--;
    }

    // Adjust add tab button in proper position
    tabSizeHint(count() - 1);
}
开发者ID:JoseAngelMuyoz,项目名称:QupZilla,代码行数:19,代码来源:tabbar.cpp


示例19: QTreeView

TabTreeView::TabTreeView(BrowserWindow *window, QWidget *parent)
    : QTreeView(parent)
    , m_window(window)
    , m_expandedSessionKey(QSL("VerticalTabs-expanded"))
{
    setDragEnabled(true);
    setAcceptDrops(true);
    setHeaderHidden(true);
    setUniformRowHeights(true);
    setDropIndicatorShown(true);
    setAllColumnsShowFocus(true);
    setMouseTracking(true);
    setFocusPolicy(Qt::NoFocus);
    setFrameShape(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setIndentation(0);

    m_delegate = new TabTreeDelegate(this);
    setItemDelegate(m_delegate);

    // Move scrollbar to the left
    setLayoutDirection(isRightToLeft() ? Qt::LeftToRight : Qt::RightToLeft);

    // Enable hover to force redrawing close button
    viewport()->setAttribute(Qt::WA_Hover);

    auto saveExpandedState = [this](const QModelIndex &index, bool expanded) {
        if (m_initializing) {
            return;
        }
        WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
        if (tab) {
            tab->setSessionData(m_expandedSessionKey, expanded);
        }
    };
    connect(this, &TabTreeView::expanded, this, std::bind(saveExpandedState, std::placeholders::_1, true));
    connect(this, &TabTreeView::collapsed, this, std::bind(saveExpandedState, std::placeholders::_1, false));
}
开发者ID:Martii,项目名称:qupzilla,代码行数:39,代码来源:tabtreeview.cpp


示例20: pinTab

void TabBar::pinTab()
{
    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
    if (!webTab) {
        return;
    }

    webTab->pinTab(m_clickedTab);

    if (webTab->isPinned()) {
        m_pinnedTabsCount++;
    }
    else {
        m_pinnedTabsCount--;
    }

    // We need to recalculate size of all tabs and repaint tabbar
    // Unfortunately, Qt doesn't offer refresh() function as a public API

    // So we are calling the lightest function that calls d->refresh()
    setElideMode(elideMode());
}
开发者ID:ff2000,项目名称:qupzilla,代码行数:22,代码来源:tabbar.cpp



注:本文中的WebTab类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WebURL类代码示例发布时间:2022-05-31
下一篇:
C++ WebString类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap