forked from qt-creator/qt-creator
Calculate proper size hint for target Creator.
Task-Number: QTCREATORBUG-4172 Reviewed-by: Robert Loehning
This commit is contained in:
@@ -143,11 +143,14 @@ ProjectExplorer::Project *ProjectListWidget::project() const
|
|||||||
QSize ProjectListWidget::sizeHint() const
|
QSize ProjectListWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
for (int itemPos = 0; itemPos < count(); ++itemPos)
|
int width = 0;
|
||||||
|
for (int itemPos = 0; itemPos < count(); ++itemPos) {
|
||||||
height += item(itemPos)->sizeHint().height();
|
height += item(itemPos)->sizeHint().height();
|
||||||
|
width = qMax(width, item(itemPos)->sizeHint().width());
|
||||||
|
}
|
||||||
|
|
||||||
// We try to keep the height of the popup equal to the actionbar
|
// We try to keep the height of the popup equal to the actionbar
|
||||||
QSize size(QListWidget::sizeHint().width(), height);
|
QSize size(width, height);
|
||||||
static QStatusBar *statusBar = Core::ICore::instance()->statusBar();
|
static QStatusBar *statusBar = Core::ICore::instance()->statusBar();
|
||||||
static QWidget *actionBar = Core::ICore::instance()->mainWindow()->findChild<QWidget*>("actionbar");
|
static QWidget *actionBar = Core::ICore::instance()->mainWindow()->findChild<QWidget*>("actionbar");
|
||||||
Q_ASSERT(actionBar);
|
Q_ASSERT(actionBar);
|
||||||
@@ -525,8 +528,7 @@ void MiniProjectTargetSelector::addTarget(ProjectExplorer::Target *target, bool
|
|||||||
MiniTargetWidget *targetWidget = new MiniTargetWidget(target);
|
MiniTargetWidget *targetWidget = new MiniTargetWidget(target);
|
||||||
connect(targetWidget, SIGNAL(changed()), this, SLOT(updateAction()));
|
connect(targetWidget, SIGNAL(changed()), this, SLOT(updateAction()));
|
||||||
targetWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
targetWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
// width==0 size hint to avoid horizontal scrolling in list widget
|
lwi->setSizeHint(targetWidget->sizeHint());
|
||||||
lwi->setSizeHint(QSize(0, targetWidget->sizeHint().height()));
|
|
||||||
plw->setItemWidget(lwi, targetWidget);
|
plw->setItemWidget(lwi, targetWidget);
|
||||||
|
|
||||||
if (activeTarget)
|
if (activeTarget)
|
||||||
|
Reference in New Issue
Block a user