Skip to content

Commit

Permalink
ProjectExplorer: Fix minimum width of mini target selector
Browse files Browse the repository at this point in the history
The kit area widget with the mutable kit aspects (usually the device) was
not properly taken into account.

Change-Id: I0d9d6f3803b6f0f3553b2837e503e029d07d7066
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
  • Loading branch information
ckandeler committed Nov 12, 2024
1 parent 0f979a1 commit 48a4ca7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/plugins/projectexplorer/kitaspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ void KitAspect::setListAspectSpec(ListAspectSpec &&listAspectSpec)
m_listAspectSpec = std::move(listAspectSpec);

m_comboBox = createSubWidget<QComboBox>();
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setEnabled(true);
const auto sortModel = new KitAspectSortModel(this);
sortModel->setSourceModel(m_listAspectSpec->model);
m_comboBox->setModel(sortModel);
Expand Down
10 changes: 6 additions & 4 deletions src/plugins/projectexplorer/miniprojecttargetselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,10 @@ void MiniProjectTargetSelector::doLayout()

m_kitAreaWidget->move(0, 0);

int kitAreaHeight = m_kitAreaWidget->isVisibleTo(this) ? m_kitAreaWidget->sizeHint().height() : 0;
const int kitAreaHeight = m_kitAreaWidget->isVisibleTo(this)
? m_kitAreaWidget->sizeHint().height() : 0;
const int kitAreaWidth = m_kitAreaWidget->isVisibleTo(this)
? m_kitAreaWidget->sizeHint().width() : 0;

// 1. Calculate the summary label height
int summaryLabelY = 1 + kitAreaHeight;
Expand Down Expand Up @@ -900,6 +903,7 @@ void MiniProjectTargetSelector::doLayout()

QRect newGeometry;

const int minWidth = std::max({m_summaryLabel->sizeHint().width(), kitAreaWidth, 250});
if (!onlySummary) {
// list widget height
int maxItemCount = m_projectListWidget->maxCount();
Expand All @@ -920,8 +924,6 @@ void MiniProjectTargetSelector::doLayout()
int listHeight = heightWithoutKitArea + kitAreaHeight - bottomMargin - listY + 1;

// list widget widths
int minWidth = qMax(m_summaryLabel->sizeHint().width(), 250);
minWidth = qMax(minWidth, m_kitAreaWidget->sizeHint().width());
QVector<int> widths = listWidgetWidths(minWidth, Core::ICore::mainWindow()->width() * 0.9);

const int runColumnWidth = widths[RUN] == -1 ? 0 : RunColumnWidth;
Expand Down Expand Up @@ -952,7 +954,7 @@ void MiniProjectTargetSelector::doLayout()
heightWithoutKitArea = qMax(summaryLabelHeight + bottomMargin, alignedWithActionHeight);
m_summaryLabel->resize(m_summaryLabel->sizeHint().width(), heightWithoutKitArea - bottomMargin);
m_kitAreaWidget->resize(m_kitAreaWidget->sizeHint());
newGeometry.setSize({m_summaryLabel->width() + 1, heightWithoutKitArea + kitAreaHeight});
newGeometry.setSize({minWidth + 1, heightWithoutKitArea + kitAreaHeight});
}

newGeometry.translate(statusBar->mapToGlobal(QPoint{0, 0}));
Expand Down

0 comments on commit 48a4ca7

Please sign in to comment.