void WebTab::pinTab(int index) { TabWidget* tabWidget = p_QupZilla->tabWidget(); if (!tabWidget) { return; } if (m_pinned) { //Unpin tab m_pinned = false; tabWidget->setTabText(index, m_view.data()->title()); tabWidget->getTabBar()->updateCloseButton(index); } else { // Pin tab m_pinned = true; tabWidget->setCurrentIndex(0); // <<-- those 2 lines fixes tabWidget->getTabBar()->moveTab(index, 0); // | weird behavior with bad tabWidget->setTabText(0, ""); // | tabwidget update if we tabWidget->setCurrentIndex(0); // <<-- are moving current tab tabWidget->getTabBar()->updateCloseButton(0); } }
void NavigationBar::loadHistoryItemInNewTab(const QWebHistoryItem &item) { TabWidget* tabWidget = m_window->tabWidget(); int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex()); QWebHistory* history = m_window->weView(tabIndex)->page()->history(); history->goToItem(item); if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { tabWidget->setCurrentIndex(tabIndex); } }
void LocationCompleter::switchToTab(BrowserWindow* window, int tab) { Q_ASSERT(window); Q_ASSERT(tab >= 0); TabWidget* tabWidget = window->tabWidget(); if (window->isActiveWindow() || tabWidget->currentIndex() != tab) { tabWidget->setCurrentIndex(tab); window->show(); window->activateWindow(); window->raise(); } else { tabWidget->webTab()->setFocus(); } }
void SessionManager::openSession(ServerEntry *serverEntry) { // Add ServerEntry to the list. if (!sessions.contains(serverEntry)) { sessions.insert(serverEntry); TabWidget *tabWidget = TabWidget::getInstance(); GameEntry gameEntry = GameManager::getGame(serverEntry->getGameType()); GameWidget *gameWidget = SessionManager::getGameWidget(serverEntry); int index = tabWidget->addTab(gameWidget, QIcon(gameEntry.getIcon()), serverEntry->getName()); tabWidget->setTabToolTip(index, QString("%1:%2").arg(serverEntry->getHost()).arg(serverEntry->getPort())); tabWidget->setCurrentIndex(index); emit (onSessionOpened()); } else { qDebug() << tr("Already connected to this server."); } }
void NavigationBar::goAtHistoryIndexInNewTab(int index) { if (QAction* action = qobject_cast<QAction*>(sender())) { index = action->data().toInt(); } if (index == -1) { return; } TabWidget* tabWidget = p_QupZilla->tabWidget(); int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex()); QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history(); history->goToItem(history->itemAt(index)); if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { tabWidget->setCurrentIndex(tabIndex); } }
void LocationCompleter::switchToTab(BrowserWindow* window, int tab) { Q_ASSERT(window); Q_ASSERT(tab >= 0); closePopup(); // Clear locationbar emit clearCompletion(); TabWidget* tabWidget = window->tabWidget(); if (window->isActiveWindow() || tabWidget->currentIndex() != tab) { tabWidget->setCurrentIndex(tab); window->show(); window->activateWindow(); window->raise(); } else { window->weView()->setFocus(); } }