summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qtabbar.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-11-02 16:42:21 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-11-04 14:17:14 +0000
commit765362db78c2508744775f7a4e5bb64085934f55 (patch)
tree015ff0de6c8b2b50e95c0da5b3159431fe5f5e63 /src/widgets/widgets/qtabbar.cpp
parent5c57c66d98554f91ce34df387ffc2da18189cf2c (diff)
QtWidgets: remove use of obsolete QStyleOption*V<N>
They are obsolete since Qt 5.0. Change-Id: I3a1ee314126bd245a3c788ac7af49905ab50945f Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/widgets/qtabbar.cpp')
-rw-r--r--src/widgets/widgets/qtabbar.cpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index f2e98474b3..7ea5455bf7 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -118,10 +118,8 @@ void QTabBarPrivate::updateMacBorderMetrics()
/*!
Initialize \a option with the values from the tab at \a tabIndex. This method
- is useful for subclasses when they need a QStyleOptionTab, QStyleOptionTabV2,
- or QStyleOptionTabV3 but don't want to fill in all the information themselves.
- This function will check the version of the QStyleOptionTab and fill in the
- additional values for a QStyleOptionTabV2 and QStyleOptionTabV3.
+ is useful for subclasses when they need a QStyleOptionTab,
+ but don't want to fill in all the information themselves.
\sa QStyleOption::initFrom(), QTabWidget::initStyleOption()
*/
@@ -158,14 +156,11 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
option->palette.setColor(foregroundRole(), tab.textColor);
option->icon = tab.icon;
- if (QStyleOptionTabV2 *optionV2 = qstyleoption_cast<QStyleOptionTabV2 *>(option))
- optionV2->iconSize = iconSize(); // Will get the default value then.
+ option->iconSize = iconSize(); // Will get the default value then.
- if (QStyleOptionTabV3 *optionV3 = qstyleoption_cast<QStyleOptionTabV3 *>(option)) {
- optionV3->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize();
- optionV3->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize();
- optionV3->documentMode = d->documentMode;
- }
+ option->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize();
+ option->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize();
+ option->documentMode = d->documentMode;
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
@@ -600,7 +595,7 @@ void QTabBarPrivate::layoutTab(int index)
if (!(tab.leftWidget || tab.rightWidget))
return;
- QStyleOptionTabV3 opt;
+ QStyleOptionTab opt;
q->initStyleOption(&opt, index);
if (tab.leftWidget) {
QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q);
@@ -778,7 +773,7 @@ void QTabBar::setShape(Shape shape)
If true then QTabBar draws a base in relation to the styles overlab.
Otherwise only the tabs are drawn.
- \sa QStyle::pixelMetric(), QStyle::PM_TabBarBaseOverlap, QStyleOptionTabBarBaseV2
+ \sa QStyle::pixelMetric(), QStyle::PM_TabBarBaseOverlap, QStyleOptionTabBarBase
*/
void QTabBar::setDrawBase(bool drawBase)
@@ -857,7 +852,7 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text)
++d->currentIndex;
if (d->closeButtonOnTabs) {
- QStyleOptionTabV3 opt;
+ QStyleOptionTab opt;
initStyleOption(&opt, index);
ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
QAbstractButton *closeButton = new CloseButton(this);
@@ -1363,7 +1358,7 @@ QSize QTabBar::tabSizeHint(int index) const
//Note: this must match with the computations in QCommonStylePrivate::tabLayout
Q_D(const QTabBar);
if (const QTabBarPrivate::Tab *tab = d->at(index)) {
- QStyleOptionTabV3 opt;
+ QStyleOptionTab opt;
initStyleOption(&opt, index);
opt.text = d->tabList.at(index).text;
QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize;
@@ -1571,7 +1566,7 @@ void QTabBar::paintEvent(QPaintEvent *)
{
Q_D(QTabBar);
- QStyleOptionTabBarBaseV2 optTabBase;
+ QStyleOptionTabBarBase optTabBase;
QTabBarPrivate::initStyleBaseOption(&optTabBase, this, size());
QStylePainter p(this);
@@ -1593,7 +1588,7 @@ void QTabBar::paintEvent(QPaintEvent *)
p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase);
for (int i = 0; i < d->tabList.count(); ++i) {
- QStyleOptionTabV3 tab;
+ QStyleOptionTab tab;
initStyleOption(&tab, i);
if (d->paintWithOffsets && d->tabList[i].dragOffset != 0) {
if (vertical) {
@@ -1626,7 +1621,7 @@ void QTabBar::paintEvent(QPaintEvent *)
// Draw the selected tab last to get it "on top"
if (selected >= 0) {
- QStyleOptionTabV3 tab;
+ QStyleOptionTab tab;
initStyleOption(&tab, selected);
if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0) {
if (vertical)
@@ -1806,7 +1801,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
d->previousPressedIndex = d->pressedIndex;
#endif
if (d->validIndex(d->pressedIndex)) {
- QStyleOptionTabBarBaseV2 optTabBase;
+ QStyleOptionTabBarBase optTabBase;
optTabBase.init(this);
optTabBase.documentMode = d->documentMode;
if (event->type() == style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this))
@@ -1902,7 +1897,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
event->ignore();
return;
}
- QStyleOptionTabBarBaseV2 optTabBase;
+ QStyleOptionTabBarBase optTabBase;
optTabBase.init(this);
optTabBase.documentMode = d->documentMode;
}
@@ -1922,7 +1917,7 @@ void QTabBarPrivate::setupMovableTab()
QStylePainter p(&grabImage, q);
p.initFrom(q);
- QStyleOptionTabV3 tab;
+ QStyleOptionTab tab;
q->initStyleOption(&tab, pressedIndex);
tab.rect.moveTopLeft(QPoint(taboverlap, 0));
p.drawControl(QStyle::CE_TabBarTab, tab);
@@ -2006,7 +2001,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
int i = d->indexAtPos(event->pos()) == d->pressedIndex ? d->pressedIndex : -1;
d->pressedIndex = -1;
- QStyleOptionTabBarBaseV2 optTabBase;
+ QStyleOptionTabBarBase optTabBase;
optTabBase.initFrom(this);
optTabBase.documentMode = d->documentMode;
if (style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease)