Changeset View
Changeset View
Standalone View
Standalone View
app/tabbar.cpp
Context not available. | |||||
115 | m_newTabButton->setStyleSheet(m_skin->tabBarNewTabButtonStyleSheet()); | 115 | m_newTabButton->setStyleSheet(m_skin->tabBarNewTabButtonStyleSheet()); | ||
---|---|---|---|---|---|
116 | m_closeTabButton->setStyleSheet(m_skin->tabBarCloseTabButtonStyleSheet()); | 116 | m_closeTabButton->setStyleSheet(m_skin->tabBarCloseTabButtonStyleSheet()); | ||
117 | 117 | | |||
118 | m_newTabButton->move( m_skin->tabBarNewTabButtonPosition().x(), m_skin->tabBarNewTabButtonPosition().y()); | 118 | moveNewTabButton(); | ||
119 | m_closeTabButton->move(width() - m_skin->tabBarCloseTabButtonPosition().x(), m_skin->tabBarCloseTabButtonPosition().y()); | 119 | m_closeTabButton->move(width() - m_skin->tabBarCloseTabButtonPosition().x(), m_skin->tabBarCloseTabButtonPosition().y()); | ||
120 | | ||||
121 | repaint(); | 120 | repaint(); | ||
122 | } | 121 | } | ||
123 | 122 | | |||
Context not available. | |||||
395 | 394 | | |||
396 | void TabBar::resizeEvent(QResizeEvent* event) | 395 | void TabBar::resizeEvent(QResizeEvent* event) | ||
397 | { | 396 | { | ||
398 | m_newTabButton->move(m_skin->tabBarNewTabButtonPosition().x(), m_skin->tabBarNewTabButtonPosition().y()); | 397 | moveNewTabButton(); | ||
399 | m_closeTabButton->move(width() - m_skin->tabBarCloseTabButtonPosition().x(), m_skin->tabBarCloseTabButtonPosition().y()); | 398 | m_closeTabButton->move(width() - m_skin->tabBarCloseTabButtonPosition().x(), m_skin->tabBarCloseTabButtonPosition().y()); | ||
400 | | ||||
401 | QWidget::resizeEvent(event); | 399 | QWidget::resizeEvent(event); | ||
402 | } | 400 | } | ||
403 | 401 | | |||
402 | void TabBar::moveNewTabButton() | ||||
403 | { | ||||
404 | int newTabButtonX = m_skin->tabBarNewTabButtonPosition().x(); | ||||
405 | if (m_skin->tabBarNewTabButtonIsAtEndOfTabs()) { | ||||
406 | newTabButtonX += m_tabWidths.last(); | ||||
407 | } | ||||
408 | m_newTabButton->move(newTabButtonX, m_skin->tabBarNewTabButtonPosition().y()); | ||||
409 | } | ||||
410 | | ||||
404 | void TabBar::paintEvent(QPaintEvent*) | 411 | void TabBar::paintEvent(QPaintEvent*) | ||
405 | { | 412 | { | ||
406 | QPainter painter(this); | 413 | QPainter painter(this); | ||
Context not available. | |||||
415 | 422 | | |||
416 | for (int index = 0; index < m_tabs.count(); ++index) | 423 | for (int index = 0; index < m_tabs.count(); ++index) | ||
417 | { | 424 | { | ||
418 | x = drawButton(x, y, index, painter); | 425 | x = drawTab(x, y, index, painter); | ||
419 | m_tabWidths << x; | 426 | m_tabWidths << x; | ||
420 | } | 427 | } | ||
421 | 428 | | |||
Context not available. | |||||
446 | painter.drawTiledPixmap(0, 0, width(), height(), backgroundImage); | 453 | painter.drawTiledPixmap(0, 0, width(), height(), backgroundImage); | ||
447 | 454 | | |||
448 | painter.end(); | 455 | painter.end(); | ||
456 | | ||||
457 | if (m_skin->tabBarNewTabButtonIsAtEndOfTabs()) { | ||||
458 | moveNewTabButton(); | ||||
459 | } | ||||
449 | } | 460 | } | ||
450 | 461 | | |||
451 | int TabBar::drawButton(int x, int y, int index, QPainter& painter) | 462 | int TabBar::drawTab(int x, int y, int index, QPainter& painter) | ||
452 | { | 463 | { | ||
453 | QString title; | 464 | QString title; | ||
454 | int sessionId; | 465 | int sessionId; | ||
Context not available. | |||||
476 | x += m_skin->tabBarSeparatorImage().width(); | 487 | x += m_skin->tabBarSeparatorImage().width(); | ||
477 | } | 488 | } | ||
478 | 489 | | |||
479 | if (selected) font.setBold(true); | 490 | if (selected) font.setBold(m_skin->tabBarSelectedTextBold()); | ||
480 | else font.setBold(false); | 491 | else font.setBold(false); | ||
481 | 492 | | |||
482 | painter.setFont(font); | 493 | painter.setFont(font); | ||
Context not available. | |||||
990 | painter.initFrom(this); | 1001 | painter.initFrom(this); | ||
991 | painter.setPen(m_skin->tabBarTextColor()); | 1002 | painter.setPen(m_skin->tabBarTextColor()); | ||
992 | 1003 | | |||
993 | drawButton(0, 0, index, painter); | 1004 | drawTab(0, 0, index, painter); | ||
994 | painter.end(); | 1005 | painter.end(); | ||
995 | 1006 | | |||
996 | QMimeData* mimeData = new QMimeData; | 1007 | QMimeData* mimeData = new QMimeData; | ||
Context not available. |