forked from qt-creator/qt-creator
Fix close icon for right side navigation panes
If there is only one view, it should show the "close to the right" icon, not "close to the left". Change-Id: Ifb7c4261cb74e35310dc3d634720d9daa20df3f1 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -312,6 +312,15 @@ void NavigationWidget::resizeEvent(QResizeEvent *re)
|
|||||||
MiniSplitter::resizeEvent(re);
|
MiniSplitter::resizeEvent(re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QIcon closeIconForSide(Side side, int itemCount)
|
||||||
|
{
|
||||||
|
if (itemCount > 1)
|
||||||
|
return Utils::Icons::CLOSE_SPLIT_TOP.icon();
|
||||||
|
return side == Side::Left
|
||||||
|
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
||||||
|
: Utils::Icons::CLOSE_SPLIT_RIGHT.icon();
|
||||||
|
}
|
||||||
|
|
||||||
Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int factoryIndex)
|
Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int factoryIndex)
|
||||||
{
|
{
|
||||||
for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) {
|
for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) {
|
||||||
@@ -331,9 +340,7 @@ Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int
|
|||||||
insertWidget(position, nsw);
|
insertWidget(position, nsw);
|
||||||
|
|
||||||
d->m_subWidgets.insert(position, nsw);
|
d->m_subWidgets.insert(position, nsw);
|
||||||
d->m_subWidgets.at(0)->setCloseIcon(d->m_subWidgets.size() == 1
|
d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size()));
|
||||||
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
|
||||||
: Utils::Icons::CLOSE_SPLIT_TOP.icon());
|
|
||||||
NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position});
|
NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position});
|
||||||
return nsw;
|
return nsw;
|
||||||
}
|
}
|
||||||
@@ -386,10 +393,8 @@ void NavigationWidget::closeSubWidget()
|
|||||||
subWidget->hide();
|
subWidget->hide();
|
||||||
subWidget->deleteLater();
|
subWidget->deleteLater();
|
||||||
// update close button of top item
|
// update close button of top item
|
||||||
if (d->m_subWidgets.size() == 1)
|
if (!d->m_subWidgets.isEmpty())
|
||||||
d->m_subWidgets.at(0)->setCloseIcon(d->m_subWidgets.size() == 1
|
d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size()));
|
||||||
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
|
||||||
: Utils::Icons::CLOSE_SPLIT_TOP.icon());
|
|
||||||
} else {
|
} else {
|
||||||
setShown(false);
|
setShown(false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user