mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
AppFwk: Added a tabbed property view dialog as convenience until we have a "tab" option in the uiOrdering system
This commit is contained in:
parent
ce91cc3cc2
commit
cc2b19cb57
@ -155,6 +155,8 @@ set( PROJECT_FILES
|
|||||||
cafPdmUiPickableLineEditor.cpp
|
cafPdmUiPickableLineEditor.cpp
|
||||||
cafStyleSheetTools.h
|
cafStyleSheetTools.h
|
||||||
cafStyleSheetTools.cpp
|
cafStyleSheetTools.cpp
|
||||||
|
cafPdmUiTabbedPropertyViewDialog.h
|
||||||
|
cafPdmUiTabbedPropertyViewDialog.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
|
117
Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp
Normal file
117
Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
|
||||||
|
#include "cafPdmUiTabbedPropertyViewDialog.h"
|
||||||
|
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmUiPropertyView.h"
|
||||||
|
|
||||||
|
#include <QBoxLayout>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiTabbedPropertyViewDialog::PdmUiTabbedPropertyViewDialog(caf::PdmObject* object,
|
||||||
|
const QStringList& uiConfigNameForTabs,
|
||||||
|
const QString& windowTitle,
|
||||||
|
QWidget* parent)
|
||||||
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
|
||||||
|
{
|
||||||
|
this->setWindowTitle(windowTitle);
|
||||||
|
|
||||||
|
QTabWidget* tabWidget = new QTabWidget;
|
||||||
|
|
||||||
|
for (int i = 0; i < uiConfigNameForTabs.size(); i++)
|
||||||
|
{
|
||||||
|
QHBoxLayout* widgetLayout = new QHBoxLayout;
|
||||||
|
widgetLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
QWidget* containerWidget = new QWidget;
|
||||||
|
containerWidget->setLayout(widgetLayout);
|
||||||
|
|
||||||
|
caf::PdmUiPropertyView* pdmUiPropertyView = new caf::PdmUiPropertyView();
|
||||||
|
pdmUiPropertyView->setUiConfigurationName(uiConfigNameForTabs[i]);
|
||||||
|
|
||||||
|
widgetLayout->addWidget(pdmUiPropertyView);
|
||||||
|
|
||||||
|
tabWidget->addTab(containerWidget, uiConfigNameForTabs[i]);
|
||||||
|
pdmUiPropertyView->showProperties(object);
|
||||||
|
|
||||||
|
m_propertyViewTabs.push_back(pdmUiPropertyView);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVBoxLayout* dialogLayout = new QVBoxLayout;
|
||||||
|
setLayout(dialogLayout);
|
||||||
|
|
||||||
|
dialogLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
|
|
||||||
|
m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
connect(m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
|
dialogLayout->addWidget(m_dialogButtonBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiTabbedPropertyViewDialog::~PdmUiTabbedPropertyViewDialog()
|
||||||
|
{
|
||||||
|
for (auto propView : m_propertyViewTabs)
|
||||||
|
{
|
||||||
|
propView->showProperties(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QSize PdmUiTabbedPropertyViewDialog::minimumSizeHint() const
|
||||||
|
{
|
||||||
|
QSize minSizeHint(0, 0);
|
||||||
|
|
||||||
|
for (auto propView : m_propertyViewTabs)
|
||||||
|
{
|
||||||
|
QSize pageSize = propView->minimumSizeHint();
|
||||||
|
pageSize += QSize(0, 100);
|
||||||
|
|
||||||
|
minSizeHint = minSizeHint.expandedTo(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return minSizeHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QSize PdmUiTabbedPropertyViewDialog::sizeHint() const
|
||||||
|
{
|
||||||
|
QSize maxSizeHint(0, 0);
|
||||||
|
|
||||||
|
for (auto w : m_propertyViewTabs)
|
||||||
|
{
|
||||||
|
QSize pageSize = w->sizeHint();
|
||||||
|
pageSize += QSize(0, 100);
|
||||||
|
|
||||||
|
maxSizeHint = maxSizeHint.expandedTo(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxSizeHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QDialogButtonBox* PdmUiTabbedPropertyViewDialog::dialogButtonBox()
|
||||||
|
{
|
||||||
|
return m_dialogButtonBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
class PdmObject;
|
||||||
|
class PdmUiPropertyView;
|
||||||
|
}
|
||||||
|
|
||||||
|
class QDialogButtonBox;
|
||||||
|
class QWidget;
|
||||||
|
class QString;
|
||||||
|
class QStringList;
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
class PdmUiTabbedPropertyViewDialog : public QDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PdmUiTabbedPropertyViewDialog(caf::PdmObject* object,
|
||||||
|
const QStringList& uiConfigNameForTabs,
|
||||||
|
const QString& windowTitle,
|
||||||
|
QWidget* parent);
|
||||||
|
~PdmUiTabbedPropertyViewDialog() override;
|
||||||
|
|
||||||
|
QDialogButtonBox* dialogButtonBox();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QSize minimumSizeHint() const override;
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<PdmUiPropertyView*> m_propertyViewTabs;
|
||||||
|
QDialogButtonBox* m_dialogButtonBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user