QTabBar - add minimumTabSizeHint as virtual function.
Just implements what the note states (and removes the private function) Change-Id: Ida009e1836ded5816218372edb8c178523242a9e Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
d20efc18ff
commit
cc5ea94c01
@ -427,7 +427,7 @@ void QTabBarPrivate::layoutTabs()
|
||||
tabList[i].maxRect = QRect(x, 0, sz.width(), sz.height());
|
||||
x += sz.width();
|
||||
maxHeight = qMax(maxHeight, sz.height());
|
||||
sz = minimumTabSizeHint(i);
|
||||
sz = q->minimumTabSizeHint(i);
|
||||
tabList[i].minRect = QRect(minx, 0, sz.width(), sz.height());
|
||||
minx += sz.width();
|
||||
tabChain[tabChainIndex].init();
|
||||
@ -452,7 +452,7 @@ void QTabBarPrivate::layoutTabs()
|
||||
tabList[i].maxRect = QRect(0, y, sz.width(), sz.height());
|
||||
y += sz.height();
|
||||
maxWidth = qMax(maxWidth, sz.width());
|
||||
sz = minimumTabSizeHint(i);
|
||||
sz = q->minimumTabSizeHint(i);
|
||||
tabList[i].minRect = QRect(0, miny, sz.width(), sz.height());
|
||||
miny += sz.height();
|
||||
tabChain[tabChainIndex].init();
|
||||
@ -1290,14 +1290,18 @@ static QString computeElidedText(Qt::TextElideMode mode, const QString &text)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QSize QTabBarPrivate::minimumTabSizeHint(int index)
|
||||
/*!
|
||||
Returns the minimum tab size hint for the tab at position \a index.
|
||||
\since Qt 5.0
|
||||
*/
|
||||
|
||||
QSize QTabBar::minimumTabSizeHint(int index) const
|
||||
{
|
||||
Q_Q(QTabBar);
|
||||
// ### Qt 5: make this a protected virtual function in QTabBar
|
||||
Tab &tab = tabList[index];
|
||||
Q_D(const QTabBar);
|
||||
QTabBarPrivate::Tab &tab = const_cast<QTabBarPrivate::Tab&>(d->tabList[index]);
|
||||
QString oldText = tab.text;
|
||||
tab.text = computeElidedText(elideMode, oldText);
|
||||
QSize size = q->tabSizeHint(index);
|
||||
tab.text = computeElidedText(d->elideMode, oldText);
|
||||
QSize size = tabSizeHint(index);
|
||||
tab.text = oldText;
|
||||
return size;
|
||||
}
|
||||
|
@ -178,6 +178,7 @@ Q_SIGNALS:
|
||||
|
||||
protected:
|
||||
virtual QSize tabSizeHint(int index) const;
|
||||
virtual QSize minimumTabSizeHint(int index) const;
|
||||
virtual void tabInserted(int index);
|
||||
virtual void tabRemoved(int index);
|
||||
virtual void tabLayoutChange();
|
||||
|
@ -165,8 +165,6 @@ public:
|
||||
inline bool validIndex(int index) const { return index >= 0 && index < tabList.count(); }
|
||||
void setCurrentNextEnabledIndex(int offset);
|
||||
|
||||
QSize minimumTabSizeHint(int index);
|
||||
|
||||
QToolButton* rightB; // right or bottom
|
||||
QToolButton* leftB; // left or top
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user