mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1245 Property Editor : Use size hint displaying preferences
This commit is contained in:
parent
03932f59c3
commit
421dda1042
@ -26,6 +26,7 @@
|
||||
#include <QStringList>
|
||||
#include <QTabWidget>
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -39,9 +40,10 @@ RiuPropertyViewTabWidget::RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObje
|
||||
|
||||
for (int i = 0; i < uiConfigNameForTabs.size(); i++)
|
||||
{
|
||||
// Use a container widget to get some UI space around a PdmUiPropertyView
|
||||
QWidget* containerWidget = new QWidget;
|
||||
QHBoxLayout* widgetLayout = new QHBoxLayout;
|
||||
widgetLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QWidget* containerWidget = new QWidget;
|
||||
containerWidget->setLayout(widgetLayout);
|
||||
|
||||
caf::PdmUiPropertyView* pdmUiPropertyView = new caf::PdmUiPropertyView();
|
||||
@ -60,7 +62,6 @@ RiuPropertyViewTabWidget::RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObje
|
||||
|
||||
dialogLayout->addWidget(tabWidget);
|
||||
|
||||
|
||||
// Buttons
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
@ -79,3 +80,24 @@ RiuPropertyViewTabWidget::~RiuPropertyViewTabWidget()
|
||||
w->showProperties(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuPropertyViewTabWidget::sizeHint() const
|
||||
{
|
||||
QSize maxSizeHint = QDialog::sizeHint();
|
||||
//qDebug() << "dialog size hint : " << maxSizeHint;
|
||||
|
||||
for (auto w : m_pageWidgets)
|
||||
{
|
||||
//qDebug() << "tab size hint" << w->sizeHint();
|
||||
|
||||
QSize pageSize = w->sizeHint();
|
||||
pageSize += QSize(0, 100);
|
||||
|
||||
maxSizeHint = maxSizeHint.expandedTo(pageSize);
|
||||
}
|
||||
|
||||
return maxSizeHint;
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
RiuPropertyViewTabWidget(QWidget* parent, caf::PdmObject* object, const QString& windowTitle, const QStringList& uiConfigNameForTabs);
|
||||
~RiuPropertyViewTabWidget();
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
private:
|
||||
std::vector<caf::PdmUiPropertyView*> m_pageWidgets;
|
||||
};
|
||||
|
@ -174,7 +174,12 @@ PdmObjectHandle* PdmUiPropertyView::currentObject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize PdmUiPropertyView::sizeHint() const
|
||||
{
|
||||
return QSize(200, 200);
|
||||
if (m_placeholder)
|
||||
{
|
||||
return m_placeholder->sizeHint();
|
||||
}
|
||||
|
||||
return QWidget::sizeHint();
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
Loading…
Reference in New Issue
Block a user