void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, WidgetStateInfo state) { if (!ready()) return; queueDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight)); for (int i = 0; i < (int)tabs.size(); ++i) { if (i == active) continue; if (r.left + i * tabWidth > r.right || r.left + (i + 1) * tabWidth > r.right) continue; Common::Rect tabRect(r.left + i * tabWidth, r.top, r.left + (i + 1) * tabWidth, r.top + tabHeight); queueDD(kDDTabInactive, tabRect); queueDDText(getTextData(kDDTabInactive), getTextColor(kDDTabInactive), tabRect, tabs[i], false, false, _widgets[kDDTabInactive]->_textAlignH, _widgets[kDDTabInactive]->_textAlignV); } if (active >= 0 && (r.left + active * tabWidth < r.right) && (r.left + (active + 1) * tabWidth < r.right)) { Common::Rect tabRect(r.left + active * tabWidth, r.top, r.left + (active + 1) * tabWidth, r.top + tabHeight); const uint16 tabLeft = active * tabWidth; const uint16 tabRight = MAX(r.right - tabRect.right, 0); queueDD(kDDTabActive, tabRect, (tabLeft << 16) | (tabRight & 0xFFFF)); queueDDText(getTextData(kDDTabActive), getTextColor(kDDTabActive), tabRect, tabs[active], false, false, _widgets[kDDTabActive]->_textAlignH, _widgets[kDDTabActive]->_textAlignV); } }
void MyTabBar::mouseReleaseEvent ( QMouseEvent * event ) { int xx= event->x() - tabRect(currentIndex()).x(); int yy= event->y() - tabRect(currentIndex()).y(); //FIXME : make a best test for detecting click on close icon if(xx>7 && yy>7 && xx<21 && yy<21) { QWidget * oldWidget= ((SearchResultsTabWidget*)parent())->widget(currentIndex()); ((SearchResultsTabWidget*)parent())->removeTab(currentIndex()); delete oldWidget; } }
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)); }
QRect YaTabBarBase::tabIconRect(int index) const { QRect iconRect(tabRect(index)); iconRect.setLeft(iconRect.left() + margin()); iconRect.setWidth(cachedIconSize_.width()); return iconRect; }
HealthGUI::HealthGUI(IrrlichtDevice *device) : GameEntity(device) { //Create the array of healthbars healthbars = new HealthBar*[MAX_HEALTH_BARS]; dimension2d<s32> screenDim = driver->getScreenSize(); //Rectangle at the upper middle of screen rect<s32> tabRect(screenDim.Width/2 - 110, 25, screenDim.Width/2 + 75, 50); //Create a tab that will house the healthbars healthTab = env->addTab(tabRect); //Populate the array for(s32 i=0; i < MAX_HEALTH_BARS; i++) { //Allocate space healthbars[i] = new HealthBar(device); //Set the healthbar as active healthbars[i]->SetActive(true); //Set the position for the healthbar position2d<s32> pos = position2d<s32>( tabRect.UpperLeftCorner.X + (i*20 + healthbars[i]->GetTexture()->getSize().Width), tabRect.UpperLeftCorner.Y); //Add healthbar to the panel of healthbars healthTab->addChild(env->addImage(healthbars[i]->GetTexture(), pos)); } }
void TabBar::showTabPreview(bool delayed) { if (!m_showTabPreviews) { return; } if (delayed) { int index = tabAt(mapFromGlobal(QCursor::pos())); if (index == -1 || QApplication::mouseButtons() != Qt::NoButton) { return; } m_tabPreview->setPreviewIndex(index); m_tabPreviewShowTimer->stop(); } WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabPreview->previewIndex())); if (!webTab) { return; } m_tabPreviewHideTimer->stop(); m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex()); QRect r(tabRect(m_tabPreview->previewIndex())); r.setTopLeft(mapTo(m_window, r.topLeft())); r.setBottomRight(mapTo(m_window, r.bottomRight())); m_tabPreview->showOnRect(r); }
void YaTabWidget::paintEvent(QPaintEvent*) { return; QPainter p(this); #ifndef WIDGET_PLUGIN QRect rect = this->rect().adjusted(0, 0, 0, -50); QRect contentsRect = rect.adjusted(Ya::VisualUtil::windowShadowSize(), Ya::VisualUtil::windowShadowSize(), -Ya::VisualUtil::windowShadowSize(), 0); Ya::VisualUtil::drawWindowTheme(&p, theme(), rect, contentsRect, isActiveWindow()); Ya::VisualUtil::drawAACorners(&p, theme(), rect, contentsRect); #else p.fillRect(rect(), Qt::red); #endif #if 0 if (tabBar()->isVisible()) { QRect r = tabRect(); int y = tabBar()->geometry().top(); p.fillRect(QRect(QPoint(r.left(), y), r.bottomRight()), static_cast<YaTabBarBaseClass*>(tabBar())->tabBackgroundColor()); #ifndef WIDGET_PLUGIN p.setPen(Ya::VisualUtil::rosterTabBorderColor()); #endif p.drawLine(tabBar()->geometry().topLeft(), QPoint(r.right(), y)); } #endif }
void YTTabBar::paintEvent(QPaintEvent *event) { QPainter p(this); for(int i=0; i < count(); ++i) { QRect r = tabRect(i); if(i != count() -1) r.adjust(0,0, -1, 0); if(i == pressedIndex) { p.drawPixmap(r, clickedPix); } else if(i == currentIndex()) { p.drawPixmap(r, selectedPix); } else if(i == hoveredIndex) { p.drawPixmap(r, hoverPix); } else { p.drawPixmap(r, nonSelectedPix); } if(i != count() -1) p.drawPixmap(r.right()+1, r.top(), sepPix.width(), r.height() ,sepPix); p.drawText(r, Qt::AlignCenter ,tabText(i) ); } }
void QtDNDTabBar::dropEvent(QDropEvent* dropEvent) { QtDNDTabBar* sourceTabBar = dynamic_cast<QtDNDTabBar*>(dropEvent->source()); if (sourceTabBar && dropEvent->mimeData() && dropEvent->mimeData()->data("action") == QByteArray("application/tab-detach")) { QtDNDTabBar* source = dynamic_cast<QtDNDTabBar*>(dropEvent->source()); int targetTabIndex = tabAt(dropEvent->pos()); QRect rect = tabRect(targetTabIndex); if (targetTabIndex >= 0 && (dropEvent->pos().x() - rect.left() - rect.width()/2 > 0)) { targetTabIndex++; } QWidget* tab = source->getDragWidget(); assert(tab); QTabWidget* targetTabWidget = dynamic_cast<QTabWidget*>(parentWidget()); QString tabText = source->getDragText(); /* * When you add a widget to an empty QTabWidget, it's automatically made the current widget. * Making the widget the current widget, widget->show() is called for the widget. Directly reacting * to that event, and adding the widget again to the QTabWidget results in undefined behavior. For * example the tab label is shown but the widget is neither has the old nor in the new QTabWidget as * parent. Blocking signals on the QWidget to be added to a QTabWidget prevents this behavior. */ targetTabWidget->setUpdatesEnabled(false); tab->blockSignals(true); targetTabWidget->insertTab(targetTabIndex, tab, tabText); dropEvent->acceptProposedAction(); tab->blockSignals(false); targetTabWidget->setUpdatesEnabled(true); onDropSucceeded(); } }
bool QColorTabBar::eventFilter(QObject *target, QEvent *evt) { if( target == this ) { if( evt->type() == QEvent::HoverMove ) { for( int i=0; i<count(); i++ ) { QMouseEvent* pEvt = (QMouseEvent*)evt; if( tabRect(i).contains(pEvt->pos()) ) { m_nHoverIndex = i; setCursor( Qt::PointingHandCursor ); break; } } update(); } else if( evt->type() == QEvent::HoverLeave ) { m_nHoverIndex = -1; setCursor( Qt::ArrowCursor ); update(); } } return QTabBar::eventFilter(target, evt); }
bool PlaylistTabBar::event(QEvent* e) { switch (e->type()) { case QEvent::ToolTip: { QHelpEvent* he = static_cast<QHelpEvent*>(e); QRect displayed_tab; QSize real_tab; bool is_elided = false; real_tab = tabSizeHint(tabAt(he->pos())); displayed_tab = tabRect(tabAt(he->pos())); // Check whether the tab is elided or not is_elided = displayed_tab.width() < real_tab.width(); if (!is_elided) { // If it's not elided, don't show the tooltip QToolTip::hideText(); } else { QToolTip::showText(he->globalPos(), tabToolTip(tabAt(he->pos()))); } return true; } default: return QTabBar::event(e); } }
/** Redefined to display an editable area. */ void TabBar::mouseDoubleClickEvent(QMouseEvent *event) { int tabIndex = tabAt(event->pos()); int c = currentIndex(); if (-1 < tabIndex && tabIndex < count() && c == tabIndex) { QRect visualRect = tabRect(tabIndex); SettingsPrivate *settings = SettingsPrivate::instance(); if (settings->isRectTabs()) { visualRect.setLeft(visualRect.left() + 1); visualRect.setRight(visualRect.right() - 1); } else { visualRect.setLeft(visualRect.left() + 3 + settings->tabsOverlappingLength() * 1.25 + height() / 2); visualRect.setRight(visualRect.right() - settings->tabsOverlappingLength()); } visualRect.setTop(visualRect.top() + 1); // Disable close buttons in case of unfortunate click for (int t = 0; t < count(); t++) { QWidget *button = tabButton(t, QTabBar::RightSide); if (button && t != tabIndex) { button->setEnabled(false); } } // Feed the QLineEdit with current tab text lineEdit->setText(tabText(tabIndex)); lineEdit->selectAll(); lineEdit->setFocus(); lineEdit->setGeometry(visualRect); lineEdit->setVisible(true); lineEdit->grabMouse(); } QTabBar::mouseDoubleClickEvent(event); }
void TabBar::updateDropMarker(const QPoint& pos) { int idx = tabAt(pos); if(idx == -1) { m_drag_idx = -1; if(m_drag_insert) m_drag_insert->hide(); return; } const int ARROW_SIZE = 32; if(!m_drag_insert) { m_drag_insert = new QLabel(parentWidget()); m_drag_insert->resize(ARROW_SIZE, ARROW_SIZE); m_drag_insert->setAttribute(Qt::WA_TransparentForMouseEvents); m_drag_insert->setPixmap(QIcon(":/icons/arrow-down").pixmap(ARROW_SIZE, ARROW_SIZE)); } QPoint p; QRect rect = tabRect(idx); if(pos.x() - rect.left() >= rect.width()/2) { m_drag_idx = idx+1; p = mapToParent(rect.topRight()); } else { m_drag_idx = idx; p = mapToParent(rect.topLeft()); } m_drag_insert->move(p - QPoint(ARROW_SIZE/2, ARROW_SIZE/2)); m_drag_insert->show(); }
bool QtDNDTabBar::event(QEvent* event) { QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(event); if (mouseEvent) { QWidget* childAtPoint = window()->childAt(mapTo(window(), mouseEvent->pos())); QtDNDTabBar* underMouse = dynamic_cast<QtDNDTabBar*>(childAtPoint); if (!underMouse && childAtPoint) { underMouse = dynamic_cast<QtDNDTabBar*>(childAtPoint->parent()); } if (!underMouse && currentIndex() >= 0) { // detach and drag // stop move event QMouseEvent* finishMoveEvent = new QMouseEvent (QEvent::MouseMove, mouseEvent->pos (), Qt::NoButton, Qt::NoButton, Qt::NoModifier); QTabBar::event(finishMoveEvent); delete finishMoveEvent; finishMoveEvent = NULL; // start drag QDrag* drag = new QDrag(this); QMimeData* mimeData = new QMimeData; // distinguish tab-reordering drops from other ones mimeData->setData("action", "application/tab-detach") ; drag->setMimeData(mimeData); // set drag image QRect rect = tabRect( currentIndex() ); #if QT_VERSION >= 0x050000 QPixmap pixmap = grab(rect); #else QPixmap pixmap = QPixmap::grabWidget(this, rect); #endif QPixmap targetPixmap (pixmap.size ()); QPainter painter (&targetPixmap); painter.setOpacity(0.9); painter.drawPixmap(0,0, pixmap); painter.end (); drag->setPixmap (targetPixmap); drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height())); dragIndex = currentIndex(); dragText = tabText(dragIndex); dragWidget = dynamic_cast<QTabWidget*>(parent())->widget(dragIndex); assert(dragWidget); dynamic_cast<QTabWidget*>(parent())->removeTab(currentIndex()); Qt::DropAction dropAction = drag->exec(); if (dropAction == Qt::IgnoreAction) { // aborted drag, put tab back in place // disable event handling during the insert for the tab to prevent infinite recursion (stack overflow) dragWidget->blockSignals(true); dynamic_cast<QTabWidget*>(parent())->insertTab(dragIndex, dragWidget, dragText); dragWidget->blockSignals(false); } return true; } } return QTabBar::event(event); }
/** * Overriding this allows us to emit signals for double clicks */ void M11TabBar::mouseDoubleClickEvent(QMouseEvent* event) { for (int i = 0; i < count(); i++) { if (tabRect(i).contains(event->pos())) { emit mouseDoubleClickTab(i); } } }
/* * Returns the index of the tab at a position, or -1 if out of bounds. */ int PsiTabBar::findTabUnder(const QPoint &pos) { for (int i = 0; i < count(); i++) { if (tabRect(i).contains(pos)) { return i; } } return -1; }
QStyleOptionTabV2 YaTabBarBase::getStyleOption(int tab) const { QStyleOptionTabV2 opt; opt.init(this); opt.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); opt.rect = tabRect(tab); bool isCurrent = tab == currentIndex(); opt.row = 0; // if (tab == pressedIndex) // opt.state |= QStyle::State_Sunken; if (isCurrent) opt.state |= QStyle::State_Selected; if (isCurrent && hasFocus()) opt.state |= QStyle::State_HasFocus; if (isTabEnabled(tab)) opt.state &= ~QStyle::State_Enabled; if (isActiveWindow()) opt.state |= QStyle::State_Active; // if (opt.rect == hoverRect) // opt.state |= QStyle::State_MouseOver; opt.shape = shape(); opt.text = tabText(tab); if (tabTextColor(tab).isValid()) opt.palette.setColor(foregroundRole(), tabTextColor(tab)); opt.icon = tabIcon(tab); opt.iconSize = opt.icon.actualSize(QSize(32, 32)); // Will get the default value then. int totalTabs = count(); if (tab > 0 && tab - 1 == currentIndex()) opt.selectedPosition = QStyleOptionTab::PreviousIsSelected; else if (tab < totalTabs - 1 && tab + 1 == currentIndex()) opt.selectedPosition = QStyleOptionTab::NextIsSelected; else opt.selectedPosition = QStyleOptionTab::NotAdjacent; if (tab == 0) { if (totalTabs > 1) opt.position = QStyleOptionTab::Beginning; else opt.position = QStyleOptionTab::OnlyOneTab; } else if (tab == totalTabs - 1) { opt.position = QStyleOptionTab::End; } else { opt.position = QStyleOptionTab::Middle; } if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) { if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner)) opt.cornerWidgets |= QStyleOptionTab::LeftCornerWidget; if (tw->cornerWidget(Qt::TopRightCorner) || tw->cornerWidget(Qt::BottomRightCorner)) opt.cornerWidgets |= QStyleOptionTab::RightCornerWidget; } return opt; }
void ModeTabBar::mousePressEvent(QMouseEvent *event) { QPoint pressPos = event->pos(); for(int i = 0; i < count(); ++i) { if(tabRect(i).contains(pressPos) && isTabEnabled(i)) { setCurrentIndex(i); break; } } }
void FancyTabBar::setTabEnabled(int index, bool enable) { Q_ASSERT(index < m_tabs.size()); Q_ASSERT(index >= 0); if (index < m_tabs.size() && index >= 0) { m_tabs[index]->enabled = enable; update(tabRect(index)); } }
/** Redefined to accept D&D from another playlist or the library. */ void TabBar::dragEnterEvent(QDragEnterEvent *event) { int idx = tabAt(event->pos()); if (idx < count() - 1) { _targetRect = tabRect(idx); } else { _targetRect = QRect(); } event->source() ? event->acceptProposedAction() : event->ignore(); }
void TabBar::triggerRename(int index) { renamingIndex_ = index; lineEdit_ = new QLineEdit(this); lineEdit_->setText(tabText(index)); lineEdit_->installEventFilter(this); lineEdit_->setGeometry(tabRect(index)); lineEdit_->setCursorPosition(lineEdit_->text().size()); lineEdit_->setFocus(); lineEdit_->show(); }
void TabBar::showTabPreview() { WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabPreview->previewIndex())); if (!webTab) { return; } m_tabPreviewTimer->stop(); m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex()); m_tabPreview->showOnRect(tabRect(m_tabPreview->previewIndex())); }
void QDockTabBar::paintEvent(QPaintEvent * e) { QTabBar::paintEvent(e); QPainter p(this); QRect rc = tabRect(insertPos_); rc.moveCenter(QPoint(rc.left(), rc.center().y())); p.setBrush(QBrush(QColor(0, 0, 255, 100))); p.setPen(QPen(Qt::blue)); p.drawRect(rc); }
void TabBar::paintEvent(QPaintEvent *) { SettingsPrivate *settings = SettingsPrivate::instance(); QStylePainter p(this); int dist = 0; if (settings->isRectTabs()) { paintRectTabs(p); } else { dist = settings->tabsOverlappingLength(); paintRoundedTabs(p, dist); } // Global bottom frame border int h = tabRect(0).height() - 1; p.setPen(QApplication::palette().mid().color()); if (count() > 1) { if (currentIndex() == 0) { p.drawLine(tabRect(0).right() + 1 + dist, h, rect().right(), h); } else { p.drawLine(rect().left(), h, tabRect(currentIndex()).left(), h); p.drawLine(tabRect(currentIndex()).right() + 1 + dist, h, rect().right(), h); } } else { if (isLeftToRight()) { p.drawLine(tabRect(0).width() + dist, h, rect().right(), h); } else { p.drawLine(rect().left(), h, tabRect(0).left(), h); } } }
void TabBar::mouseMoveEvent(QMouseEvent *event) { if(!(event->buttons() & Qt::LeftButton) || !tabsClosable()) return PlusTabBar::mouseMoveEvent(event); if((event->pos() - m_startDragPos).manhattanLength() < QApplication::startDragDistance()) return PlusTabBar::mouseMoveEvent(event); int idx = tabAt(event->pos()); if(idx == -1) return PlusTabBar::mouseMoveEvent(event); event->accept(); QDrag *drag = new QDrag(this); tabView()->createSplitOverlay(m_id, drag); QStyleOptionTabV3 tab; initStyleOption(&tab, idx); QWidget *tabWidget = ((QTabWidget*)parent())->widget(idx); QPixmap wMap(tabWidget->size()); tabWidget->render(&wMap); if(wMap.width() > 400 || wMap.height() > 400) wMap = wMap.scaled(400, 400, Qt::KeepAspectRatio, sConfig.get(CFG_BOOL_SMOOTH_SCALING) ? Qt::SmoothTransformation : Qt::FastTransformation); QSize size = tabRect(idx).size(); size.rwidth() = std::max(wMap.width(), size.width()); size.rheight() += wMap.height(); QPixmap map(size); map.fill(Qt::transparent); QStylePainter p(&map, this); p.initFrom(this); p.drawItemPixmap(QRect(0, tab.rect.height()-5, wMap.width(), wMap.height()), 0, wMap); tab.rect.moveTopLeft(QPoint(0, 0)); p.drawControl(QStyle::CE_TabBarTab, tab); p.end(); QMimeData *mime = new QMimeData(); mime->setData("data/tabinfo", QString("%1 %2 %3").arg(m_id).arg(idx).arg(tabView()->getWindowId()).toLatin1()); drag->setPixmap(map); drag->setMimeData(mime); drag->exec(); delete drag; }
void PlaylistTabBar::dragMoveEvent(QDragMoveEvent* e) { drag_hover_tab_ = tabAt(e->pos()); if (drag_hover_tab_ != -1) { e->setDropAction(Qt::CopyAction); e->accept(tabRect(drag_hover_tab_)); if (!drag_hover_timer_.isActive()) drag_hover_timer_.start(kDragHoverTimeout, this); } else { drag_hover_timer_.stop(); } }
/** Redefined to accept D&D from another playlist or the library. */ void TabBar::dragMoveEvent(QDragMoveEvent *event) { int idx = tabAt(event->pos()); // Exclude current tab and last one if (idx < count()) { _targetRect = tabRect(idx); } Playlist *playlist = qobject_cast<Playlist*>(event->source()); if (playlist && idx < count()) { _timer->start(); } event->source() ? event->acceptProposedAction() : event->ignore(); }
// Handle hover events for mouse fade ins void FancyTabBar::mouseMoveEvent(QMouseEvent *e) { if (!m_hoverRect.contains(e->pos())) { int newHover = -1; for (int i = 0; i < count(); ++i) { QRect area = tabRect(i); if (area.contains(e->pos())) { newHover = i; break; } } m_hoverControl.stop(); m_hoverIndex = newHover; update(m_hoverRect); m_hoverRect = QRect(); if (m_hoverIndex >= 0) { m_hoverRect = tabRect(m_hoverIndex); m_hoverControl.start(); } } }
// Handle hover events for mouse fade ins void FancyTabBar::mouseMoveEvent(QMouseEvent *e) { int newHover = -1; for (int i = 0; i < count(); ++i) { QRect area = tabRect(i); if (area.contains(e->pos())) { newHover = i; break; } } if (newHover == m_hoverIndex) return; if (validIndex(m_hoverIndex)) m_tabs[m_hoverIndex]->fadeOut(); m_hoverIndex = newHover; if (validIndex(m_hoverIndex)) { m_tabs[m_hoverIndex]->fadeIn(); m_hoverRect = tabRect(m_hoverIndex); } }
void TabBar::showTabPreview() { //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; int w = tabSizeHint(m_currentTabPreviewIndex).width(); int h = w * ((0.0 + currentTab->height()) / currentTab->width()); m_previewPopup = new KPassivePopup(this); m_previewPopup.data()->setFrameShape(QFrame::StyledPanel); m_previewPopup.data()->setFrameShadow(QFrame::Plain); m_previewPopup.data()->setFixedSize(w, h); QLabel *l = new QLabel(); l->setPixmap( WebSnap::renderTabPreview(*indexedTab->page(), w, h) ); m_previewPopup.data()->setView(l); m_previewPopup.data()->layout()->setAlignment(Qt::AlignTop); m_previewPopup.data()->layout()->setMargin(0); QPoint pos(tabRect(m_currentTabPreviewIndex).x() , tabRect(m_currentTabPreviewIndex).y() + tabRect(m_currentTabPreviewIndex).height()); m_previewPopup.data()->show(mapToGlobal(pos)); }