Updates will be applied - 3:30pm EDT (UTC -400). No downtime expected.

Commit 0844c2ab authored by Alvaro Sanchez's avatar Alvaro Sanchez Committed by Kitware Robot

Merge topic 'fixes-operator-dockwidget-size' into release

5c589a47 Improved DockWidget sizing for certain operators hiding widgets.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !878
parents c571c4db 5c589a47
......@@ -214,6 +214,9 @@ QWidget* qtFileItem::createFileBrowseWidget(int elementIdx)
this->Internals->fileExtCombo->addItem(extractFileTypeName(it->str()));
this->Internals->fileExtensions.push_back(extractFileTypeExtension(it->str()));
}
this->Internals->fileExtCombo->setMinimumContentsLength(8);
this->Internals->fileExtCombo->setSizeAdjustPolicy(
QComboBox::AdjustToMinimumContentsLength);
}
}
}
......@@ -227,7 +230,11 @@ QWidget* qtFileItem::createFileBrowseWidget(int elementIdx)
// As a file input, if the name is too long lets favor
// the file name over the path
if (lineEdit)
{
lineEdit->setAlignment(Qt::AlignRight);
lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
lineEdit->setMinimumWidth(5);
}
else if (fileCombo)
{
fileCombo->lineEdit()->setAlignment(Qt::AlignRight);
......
......@@ -158,9 +158,13 @@ void qtModelOperationWidget::showLogInfo(bool visibilityMode)
QSize qtModelOperationWidget::sizeHint() const
{
if (this->Internals->OperationsLayout->currentWidget())
auto operatorWidget = this->Internals->OperationsLayout->currentWidget();
if (operatorWidget)
{
QSize newSize(this->width(), 0);
// Compute the new width as the operator's widget width plus an offset
// to account for the side margins (~50)
const int operWidth = operatorWidget->width() + 50;
QSize newSize(std::max(operWidth, this->width()), 0);
int height = 20;
for (int i = 0; i < this->Internals->WidgetLayout->count(); ++i)
{
......@@ -294,6 +298,11 @@ bool qtModelOperationWidget::initOperatorUI(const smtk::model::OperatorPtr& brOp
SessionRef bs(brOp->manager(), brOp->session()->sessionId());
this->setSession(bs.session());
QFrame* opParent = new QFrame(this);
// Since the parent widget currently is a QScrollArea, it is necessary
// to ensure the widget provides a suitable sizeHint, so a minimum is set.
// http://doc.qt.io/qt-5/qscrollarea.html#details
opParent->setMinimumSize(500, 0);
opParent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
QVBoxLayout* opLayout = new QVBoxLayout(opParent);
opLayout->setMargin(0);
......
......@@ -46,10 +46,12 @@ void qtOperatorDockWidget::reset()
this->setWindowTitle("Operator Window");
this->hide();
}
QScrollArea* s = dynamic_cast<QScrollArea*>(this->widget());
if (s && s->widget())
auto scroll = qobject_cast<QScrollArea*>(this->widget());
if (scroll && scroll->widget())
{
qtModelOperationWidget* operationWidget = static_cast<qtModelOperationWidget*>(s->widget());
scroll->setWidgetResizable(true);
auto operationWidget = qobject_cast<qtModelOperationWidget*>(scroll->widget());
operationWidget->resetUI();
}
}
......
......@@ -23,7 +23,6 @@
#include <QMessageBox>
#include <QPointer>
#include <QPushButton>
#include <QScrollArea>
#include <QTableWidget>
#include <QVBoxLayout>
#include <memory>
......
......@@ -19,7 +19,6 @@
#include "smtk/extension/qt/qtBaseView.h"
class qtOperatorViewInternals;
class QScrollArea;
namespace smtk
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment