Example #1
0
// Convert a tab to an external window
void MHTabWidget::DetachTab(int index, QPoint & dropPoint)
{
    Q_UNUSED(dropPoint);
    // Create the window
    MHDetachedWindow* detachedWidget = new MHDetachedWindow(parentWidget(), this);
    detachedWidget->setWindowModality(Qt::NonModal);

    // Find Widget and connect
    connect(detachedWidget, SIGNAL(OnClose(QWidget*)), this, SLOT(AttachTab(QWidget*)));

    detachedWidget->setWindowTitle(tabText(index));
    detachedWidget->setWindowIcon(tabIcon(index));

    // Remove from tab bar
    QWidget* tearOffWidget = widget(index);
    tearOffWidget->setParent(detachedWidget);

    // Add it to the windows list
    m_Windows.append(tearOffWidget);

    // Make first active
    if(count() > 0)
        setCurrentIndex(0);

    // Create and show
    detachedWidget->setCentralWidget(tearOffWidget);

    // Needs to be done explicitly
    tearOffWidget->showNormal();
    QRect screenGeometry = QApplication::desktop()->screenGeometry();
    int w = 640;
    int h = 480;
    int x = (screenGeometry.width() - w) / 2;
    int y = (screenGeometry.height() - h) / 2;
    detachedWidget->showNormal();
    detachedWidget->setGeometry(x, y, w, h);
    detachedWidget->showNormal();
}
Example #2
0
void AdvancedTabBar::tabLayoutChange()
{
    d->list->setIconSize(iconSize());

    while (count() < d->list->count()) {
        delete d->list->takeItem(0);
    }
    if (count() == -1) return;

    while (count() > d->list->count()) {
        d->list->addItem(QString());
    }

    for (int i = 0; i < count(); i++) {
        QListWidgetItem * item = d->list->item(i);
        item->setText(tabText(i));
        item->setIcon(tabIcon(i));
        item->setToolTip(tabToolTip(i));
        item->setWhatsThis(tabWhatsThis(i));
    }

    d->list->setCurrentRow(currentIndex());
}
Example #3
0
QString ScriptableProxyHelper::tabIcon(const QString &tabName)
{
    INVOKE(tabIcon(tabName));
    return getIconNameForTabName(tabName);
}
Example #4
0
        return;

    QWidget *widget = this->widget(index);
    if (WebView *tab = qobject_cast<WebView*>(widget))
        tab->reload();
}

void TabWidget::moveTab(int fromIndex, int toIndex)
{
#if QT_VERSION < 0x040500
    disconnect(this, SIGNAL(currentChanged(int)),
               this, SLOT(currentChanged(int)));

    QWidget *tabWidget = widget(fromIndex);
    QWidget *lineEdit = m_lineEdits->widget(fromIndex);
    QIcon icon = tabIcon(fromIndex);
    QString text = tabText(fromIndex);
    QVariant data = m_tabBar->tabData(fromIndex);
    removeTab(fromIndex);
    m_lineEdits->removeWidget(lineEdit);
    insertTab(toIndex, tabWidget, icon, text);
    m_lineEdits->insertWidget(toIndex, lineEdit);
    m_tabBar->setTabData(toIndex, data);
    connect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));
    setCurrentIndex(toIndex);
#else
    QWidget *lineEdit = m_lineEdits->widget(fromIndex);
    m_lineEdits->removeWidget(lineEdit);
    m_lineEdits->insertWidget(toIndex, lineEdit);
#endif
void YaTabBarBase::drawTab(QPainter* painter, int index, const QRect& tabRect)
{
	QStyleOptionTabV2 tab = getStyleOption(index);
	if (!(tab.state & QStyle::State_Enabled)) {
		tab.palette.setCurrentColorGroup(QPalette::Disabled);
	}

	// Don't bother drawing a tab if the entire tab is outside of the visible tab bar.
	if (tabRect.right() < 0 ||
	    tabRect.left() > width() ||
	    tabRect.bottom() < 0 ||
	    tabRect.top() > height() ||
	    tabRect.width() < 3)
	{
		return;
	}

	bool isCurrent = index == currentIndex();
	bool isHovered = tabHovered(index);
	bool isHighlighted = tabData(index).toBool();

	QColor backgroundColor = this->tabBackgroundColor();
	if (isCurrent) {
#ifndef WIDGET_PLUGIN
		backgroundColor = Ya::VisualUtil::editAreaColor();
#else
		backgroundColor = Qt::white;
#endif
	}
	else if (isHovered) {
#ifndef WIDGET_PLUGIN
		backgroundColor = Ya::VisualUtil::tabHighlightColor();
#else
		backgroundColor = Qt::gray;
#endif
	}
	else if (isHighlighted) {
		backgroundColor = highlightColor();
	}

	if (backgroundColor.isValid()) {
		painter->fillRect(tabRect, backgroundColor);
	}

	painter->save();
#ifndef WIDGET_PLUGIN
	painter->setPen(Ya::VisualUtil::rosterTabBorderColor());
#endif

	bool drawLeftLine  = tabRect.left() != rect().left();
	bool drawRightLine = true; // tabRect.right() != rect().right() || rect().width() < maximumWidth();

	switch (shape()) {
	case YaTabBarBase::RoundedSouth:
	case YaTabBarBase::TriangularSouth:
		if (isMultiLine())
			drawRightLine = tabRect.right() + 1 < maximumWidth();

		if (!isCurrent || isMultiLine())
			painter->drawLine(tabRect.topLeft(), tabRect.topRight());

		if (isCurrent) {
			if (drawLeftLine && !isMultiLine())
				painter->drawLine(tabRect.topLeft(), tabRect.bottomLeft());
			if (drawRightLine)
				painter->drawLine(tabRect.topRight(), tabRect.bottomRight());
		}
		else {
			if (isHovered || isMultiLine()) {
				if (currentIndex() != (index - 1) && !isMultiLine())
					if (drawLeftLine)
						painter->drawLine(tabRect.topLeft(), tabRect.bottomLeft());
				if (currentIndex() != (index + 1) || isMultiLine())
					if (drawRightLine)
						painter->drawLine(tabRect.topRight(), tabRect.bottomRight());
			}
		}
		break;
	default:
		Q_ASSERT(false);
		break;
	}

	painter->restore();

	tabIcon(index).paint(painter, tabIconRect(index));

	QRect textRect = tabTextRect(index);
	QString text = tabText(index);

	if (drawTabNumbers_ && index < 10) {
		int numberToDraw = index + 1;
		if (numberToDraw > 9) {
			numberToDraw = 0;
		}

		painter->save();
		painter->setPen(Qt::gray);
		QString numberToDrawText = QString::number(numberToDraw) + " ";
		painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, numberToDrawText);
		textRect.adjust(fontMetrics().width(numberToDrawText), 0, 0, 0);
		painter->restore();
	}

	painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, text);
#ifndef WIDGET_PLUGIN
	if (textWidth(text) > textRect.width() && backgroundColor.isValid()) {
		Ya::VisualUtil::drawTextFadeOut(painter, textRect.adjusted(1, 0, 1, 0), backgroundColor, 15);
	}
#endif

	if (isMultiLine()) {
		QPixmap shadow(tabShadow(isCurrent));
		QRect r(tabRect);
		r.setHeight(shadow.height());
		painter->drawTiledPixmap(r, shadow);
	}
}
Example #6
0
// Swap two tab indices
void MHTabWidget::MoveTab(int fromIndex, int toIndex)
{
    removeTab(fromIndex);
    insertTab(toIndex, widget(fromIndex), tabIcon(fromIndex), tabText(fromIndex));
    setCurrentIndex(toIndex);
}
Example #7
0
	void M11TabBar::paintEvent(QPaintEvent*)
	{
		QStyleOptionTab tabOverlap;
		tabOverlap.shape = shape();
		int overlap = style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, &tabOverlap, this);
		QWidget *theParent = parentWidget();
		QStyleOptionTabBarBase optTabBase;
		optTabBase.init(this);
		optTabBase.shape = shape();
		if (theParent && overlap > 0) {
			QRect rect;
			switch (tabOverlap.shape) {
			case M11TabBar::RoundedNorth:
			case M11TabBar::TriangularNorth:
				rect.setRect(0, height() - overlap, width(), overlap);
				break;
			case M11TabBar::RoundedSouth:
			case M11TabBar::TriangularSouth:
				rect.setRect(0, 0, width(), overlap);
				break;
			case M11TabBar::RoundedEast:
			case M11TabBar::TriangularEast:
				rect.setRect(0, 0, overlap, height());
				break;
			case M11TabBar::RoundedWest:
			case M11TabBar::TriangularWest:
				rect.setRect(width() - overlap, 0, overlap, height());
				break;
			}
			optTabBase.rect = rect;
		}

		QStylePainter p(this);
		p.fillRect(rect(), Utils::instance().gradientTopToBottom(rect()));
		QPen pen = p.pen();

		int selected = -1;
		int cut = -1;
		bool rtl = optTabBase.direction == Qt::RightToLeft;
		bool verticalTabs = (shape() == M11TabBar::RoundedWest || shape() == M11TabBar::RoundedEast
		                     || shape() == M11TabBar::TriangularWest
		                     || shape() == M11TabBar::TriangularEast);
		QStyleOptionTab cutTab;
		QStyleOptionTab selectedTab;
		for (int i = 0; i < count(); ++i) {
			QStyleOptionTabV2 tab = getStyleOption(i);
			if (!(tab.state & QStyle::State_Enabled)) {
				tab.palette.setCurrentColorGroup(QPalette::Disabled);
			}
			// If this tab is partially obscured, make a note of it so that we can pass the information
			// along when we draw the tear.
			if ((!verticalTabs && (!rtl && tab.rect.left() < 0) ||
			     (rtl && tab.rect.right() > width())) ||
			    (verticalTabs && tab.rect.top() < 0)) {
				cut = i;
				cutTab = tab;
			}
			// Don't bother drawing a tab if the entire tab is outside of the visible tab bar.
			if ((!verticalTabs && (tab.rect.right() < 0 || tab.rect.left() > width()))
			    || (verticalTabs && (tab.rect.bottom() < 0 || tab.rect.top() > height())))
				continue;

			optTabBase.tabBarRect |= tab.rect;
			if (i == currentIndex()) {
				selected = i;
				selectedTab = tab;
				optTabBase.selectedTabRect = tab.rect;
			}

			QIcon icon = tabIcon(i);
			QSize iconSize = icon.actualSize(QSize(tab.rect.height(), tab.rect.height()));
			int iconMargin = (tab.rect.height() - iconSize.height()) / 2;
			QRect iconRect(tab.rect.left() + iconMargin, tab.rect.top(), iconSize.width(), tab.rect.height());
			QString text = tabText(i);
			QRect textRect(
			    tab.rect.left() + iconMargin + iconSize.width(),
			    tab.rect.top(),
			    tab.rect.width() - iconSize.width(),
			    tab.rect.height()
			);

			p.fillRect(
			    tab.rect,
			    i == currentIndex() ?
			    Utils::instance().palette().base() :
			    tab.rect.contains(mapFromGlobal(QCursor::pos())) ?
			    Utils::instance().palette().light() : Utils::instance().gradientTopToBottom(tab.rect)
			);

			p.setPen(Utils::instance().palette().dark().color());

			switch (shape()) { // override the widget's border to make it consistent over inactive tabs
			case M11TabBar::RoundedNorth:
			case M11TabBar::TriangularNorth:
				if (i == currentIndex()) {
					p.drawRect(tab.rect.adjusted(0, 0, -1, 0));
				}
				else {
					p.drawLine(tab.rect.bottomLeft(), tab.rect.bottomRight());
				}
				break;
			case M11TabBar::RoundedSouth:
			case M11TabBar::TriangularSouth:
				if (i == currentIndex()) {
					p.drawRect(tab.rect.adjusted(0, -1, -1, -1));
				}
				else {
					p.drawLine(tab.rect.topLeft(), tab.rect.topRight());
				}
				break;
			case M11TabBar::RoundedEast:
			case M11TabBar::TriangularEast:
				if (i == currentIndex()) {
					p.drawRect(tab.rect.adjusted(-1, 0, -1, -1));
				}
				else {
					p.drawLine(tab.rect.topLeft(), tab.rect.bottomLeft());
				}
				break;
			case M11TabBar::RoundedWest:
			case M11TabBar::TriangularWest:
				if (i == currentIndex()) {
					p.drawRect(tab.rect.adjusted(0, 0, 0, -1));
				}
				else {
					p.drawLine(tab.rect.topRight(), tab.rect.bottomRight());
				}
				break;
			default:
				Q_ASSERT(false);
				break;
			}

			p.setPen(m_tabLabelColors.contains(i) ? m_tabLabelColors.value(i).color() : pen);

			QString textToDraw = fontMetrics().elidedText(
			                         text,
			                         elideMode(),
			                         1 + (
			                             verticalTabs ? tabRect(i).height() : tabRect(i).width()
			                         ) - style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &tab, this),
			                         Qt::TextShowMnemonic
			                     );

			p.drawItemPixmap(iconRect, Qt::AlignCenter, icon.pixmap(iconSize));

			p.drawItemText(
			    textRect,
			    Qt::AlignLeft | Qt::AlignVCenter,
			    QPalette(),
			    tab.state & QStyle::State_Enabled,
			    textToDraw
			);

			p.setPen(pen);
		}

		if (!drawBase()) {
			p.setBackgroundMode(Qt::TransparentMode);
		}
		else {
			// p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase);
		}

		// Only draw the tear indicator if necessary. Most of the time we don't need too.
		if (cut >= 0) {
			cutTab.rect = rect();
			cutTab.rect = style()->subElementRect(QStyle::SE_TabBarTearIndicator, &cutTab, this);
			p.drawPrimitive(QStyle::PE_IndicatorTabTear, cutTab);
		}

		// p.setPen(Qt::black);
		// p.drawRect(rect());
	}
Example #8
0
void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
{
    if (!validIndex(tabIndex)) {
        qWarning("invalid index");
        return;
    }
    painter->save();

    QRect rect = tabRect(tabIndex);
    bool selected = (tabIndex == m_currentIndex);
    bool enabled = isTabEnabled(tabIndex);

    if (selected) {
        //jassuncao:if (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
        if(true) {
          // background color of a fancy tab that is active
          painter->fillRect(rect.adjusted(0, 0, 0, -1), QColor(0x90,0x90,0x90,0xFF));
        } else {
            //background
            painter->save();
            QLinearGradient grad(rect.topLeft(), rect.topRight());
            grad.setColorAt(0, QColor(255, 255, 255, 140));
            grad.setColorAt(1, QColor(255, 255, 255, 210));
            painter->fillRect(rect.adjusted(0, 0, 0, -1), grad);
            painter->restore();

            //shadows
            painter->setPen(QColor(0, 0, 0, 110));
            painter->drawLine(rect.topLeft() + QPoint(1,-1), rect.topRight() - QPoint(0,1));
            painter->drawLine(rect.bottomLeft(), rect.bottomRight());
            painter->setPen(QColor(0, 0, 0, 40));
            painter->drawLine(rect.topLeft(), rect.bottomLeft());

            //highlights
            painter->setPen(QColor(255, 255, 255, 50));
            painter->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0,2));
            painter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0,1));
            painter->setPen(QColor(255, 255, 255, 40));
            painter->drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight());
            painter->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1));
            painter->drawLine(rect.bottomLeft() + QPoint(0,-1), rect.bottomRight()-QPoint(0,1));
        }
    }

    QString tabText(this->tabText(tabIndex));
    QRect tabTextRect(rect);
    const bool drawIcon = rect.height() > 36;
    QRect tabIconRect(tabTextRect);
    tabTextRect.translate(0, drawIcon ? -2 : 1);
    QFont boldFont(painter->font());
    //jassuncao boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
    boldFont.setPointSizeF(8);
    boldFont.setBold(true);
    painter->setFont(boldFont);
    painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110));
    const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap;


#if defined(Q_OS_MAC)
    bool isMacHost = true;
#else
    bool isMacHost = false;
#endif

    if (!isMacHost && !selected && enabled) {
        painter->save();
        int fader = int(m_tabs[tabIndex]->fader());
        //jassuncaoif (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
        if(true) {
            //QColor c = creatorTheme()->color(Theme::BackgroundColorHover);
            QColor c(0x51,0x51,0x51,0xFF);
            c.setAlpha(int(255 * fader/40.0)); // FIXME: hardcoded end value 40
            painter->fillRect(rect, c);
        } else {
            QLinearGradient grad(rect.topLeft(), rect.topRight());
            grad.setColorAt(0, Qt::transparent);
            grad.setColorAt(0.5, QColor(255, 255, 255, fader));
            grad.setColorAt(1, Qt::transparent);
            painter->fillRect(rect, grad);
            painter->setPen(QPen(grad, 1.0));
            painter->drawLine(rect.topLeft(), rect.topRight());
            painter->drawLine(rect.bottomLeft(), rect.bottomRight());
        }
        painter->restore();
    }

    if (!enabled)
        painter->setOpacity(0.7);

    if (drawIcon) {
        int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
        tabIconRect.adjust(0, 4, 0, -textHeight);
        //jassuncao StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled);
        drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled);
    }

    painter->setOpacity(1.0); //FIXME: was 0.7 before?
    /*jassuncao
    if (enabled) {
        painter->setPen(selected
          ? creatorTheme()->color(Theme::FancyTabWidgetEnabledSelectedTextColor)
          : creatorTheme()->color(Theme::FancyTabWidgetEnabledUnselectedTextColor));
    } else {
        painter->setPen(selected
          ? creatorTheme()->color(Theme::FancyTabWidgetDisabledSelectedTextColor)
          : creatorTheme()->color(Theme::FancyTabWidgetDisabledUnselectedTextColor));
    }
    */
    if (enabled) {
        painter->setPen(selected
          ? QColor(0x3C,0x3C,0x3C,0xFF)
          : QColor(0xFF,0xFF,0xFF,0xFF));
    } else {
        painter->setPen(selected
          ? QColor(0xFF,0xFF,0xFF,0xFF)
          : QColor(0xFF,0xFF,0xFF,0x78));
    }
    painter->translate(0, -1);
    painter->drawText(tabTextRect, textFlags, tabText);

    painter->restore();
}
void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
{
    if (!validIndex(tabIndex)) {
        qWarning("invalid index");
        return;
    }
    painter->save();

    QRect rect = tabRect(tabIndex);
    bool selected = (tabIndex == m_currentIndex);
    bool enabled = isTabEnabled(tabIndex);

    if (selected) {
        //background
        painter->save();
        QLinearGradient grad(rect.topLeft(), rect.topRight());
        grad.setColorAt(0, QColor(255, 255, 255, 140));
        grad.setColorAt(1, QColor(255, 255, 255, 210));
        painter->fillRect(rect.adjusted(0, 0, 0, -1), grad);
        painter->restore();

        //shadows
        painter->setPen(QColor(0, 0, 0, 110));
        painter->drawLine(rect.topLeft() + QPoint(1,-1), rect.topRight() - QPoint(0,1));
        painter->drawLine(rect.bottomLeft(), rect.bottomRight());
        painter->setPen(QColor(0, 0, 0, 40));
        painter->drawLine(rect.topLeft(), rect.bottomLeft());

        //highlights
        painter->setPen(QColor(255, 255, 255, 50));
        painter->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0,2));
        painter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0,1));
        painter->setPen(QColor(255, 255, 255, 40));
        painter->drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight());
        painter->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1));
        painter->drawLine(rect.bottomLeft() + QPoint(0,-1), rect.bottomRight()-QPoint(0,1));
    }

    QString tabText(this->tabText(tabIndex));
    QRect tabTextRect(tabRect(tabIndex));
    QRect tabIconRect(tabTextRect);
    tabTextRect.translate(0, -2);
    QFont boldFont(painter->font());
    boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
    boldFont.setBold(true);
    painter->setFont(boldFont);
    painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110));
    int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::TextWordWrap;
    if (enabled) {
        painter->drawText(tabTextRect, textFlags, tabText);
        painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor());
    } else {
        painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(255, 255, 255, 120));
    }
#ifndef Q_WS_MAC
    if (!selected && enabled) {
        painter->save();
        int fader = int(m_tabs[tabIndex]->fader());
        QLinearGradient grad(rect.topLeft(), rect.topRight());
        grad.setColorAt(0, Qt::transparent);
        grad.setColorAt(0.5, QColor(255, 255, 255, fader));
        grad.setColorAt(1, Qt::transparent);
        painter->fillRect(rect, grad);
        painter->setPen(QPen(grad, 1.0));
        painter->drawLine(rect.topLeft(), rect.topRight());
        painter->drawLine(rect.bottomLeft(), rect.bottomRight());
        painter->restore();
    }
#endif

    if (!enabled)
        painter->setOpacity(0.7);

    int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
    tabIconRect.adjust(0, 4, 0, -textHeight);
    StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled);

    painter->translate(0, -1);
    painter->drawText(tabTextRect, textFlags, tabText);
    painter->restore();
}
Example #10
0
	void ModeTabBar::paintEvent(QPaintEvent *event)
	{
		QPainter p(this);
		IconManager *iconManager = IconManager::instance();

		QLinearGradient bgGrad(rect().topLeft(), rect().topRight());
		bgGrad.setColorAt(0.5, palette().color(QPalette::Window));
		bgGrad.setColorAt(1.0, palette().color(QPalette::Midlight));
		p.fillRect(rect(), bgGrad);

		p.setPen(palette().color(QPalette::Shadow));
		p.drawLine(width() - 1, 0, width() - 1, height());

		for(int i = 0; i < count(); ++i) {
			p.save();

			QFont labelFont = font();
			labelFont.setBold(true);
			p.setFont(labelFont);

			QRect rect = tabRect(i);

			int textHeight = p.fontMetrics().boundingRect(QRect(0, 0, width(), height()), 0, tabLabel(i)).height();
			QRect labelRect(QPoint(rect.left() + tabPadding, rect.bottom() - textHeight - tabPadding), QSize(rect.width() - (tabPadding * 2), textHeight));

			int iconSize = rect.height() - textHeight - (3 * tabPadding);
			QRect iconRect(QPoint((rect.width() - iconSize) / 2, rect.top() + tabPadding), QSize(iconSize, iconSize));

			bool isSelected = (i == m_currentIndex);
			bool isEnabled = isTabEnabled(i);
			bool isHovered = (i == m_hoverIndex);

			if(isHovered && isEnabled) {
				p.fillRect(rect.adjusted(0, 0, -1, 0), QColor(0, 0, 0, 24));
			}

			if(isSelected) {
				p.save();

				p.setPen(palette().color(QPalette::Shadow));
				p.drawLine(rect.topLeft(), rect.topRight());
				p.drawLine(rect.bottomLeft(), rect.bottomRight());

				p.fillRect(rect.adjusted(0, 0, -1, 0), QColor(0, 0, 0, 32));
				p.translate(rect.width() - 6, rect.top() + (rect.height() / 2) - 12);

				QPolygon arrowPoly;
				arrowPoly.append(QPoint(7, 0));
				arrowPoly.append(QPoint(7, 24));
				arrowPoly.append(QPoint(0, 12));

				p.translate(0, 1);
				p.setBrush(palette().color(QPalette::Shadow));
				p.setPen(palette().color(QPalette::Shadow));
				p.setRenderHint(QPainter::Antialiasing);
				p.drawPolygon(arrowPoly);

				p.translate(0, -1);
				p.setBrush(palette().color(QPalette::Light));
				p.drawPolygon(arrowPoly);

				p.restore();
			}

			if(!isEnabled)
				p.setOpacity(0.6);

			QIcon icon(iconManager->icon(tabIcon(i)));
			QPixmap pixmap = icon.pixmap(iconSize, iconSize, isEnabled ? QIcon::Normal : QIcon::Disabled);

			p.drawPixmap(iconRect, pixmap);

			p.setPen(palette().color(QPalette::Text));
			p.drawText(labelRect, Qt::AlignCenter, tabLabel(i));
			p.restore();
		}
	}