mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2102 Statistics dialog. Adjust text edit height to its contents
This commit is contained in:
parent
30e3622ad4
commit
41db3e8b10
@ -67,6 +67,7 @@ RicGridStatisticsDialog::RicGridStatisticsDialog(QWidget* parent)
|
||||
|
||||
QVBoxLayout* plotLayout = new QVBoxLayout();
|
||||
plotLayout->setSpacing(0);
|
||||
//plotLayout->addStretch();
|
||||
plotLayout->addWidget(m_historgramPlot);
|
||||
plotLayout->addWidget(m_aggregatedPlot);
|
||||
layout->addLayout(plotLayout);
|
||||
@ -102,6 +103,7 @@ void RicGridStatisticsDialog::setInfoText(RimView* view)
|
||||
text = overlayInfo->caseInfoText();
|
||||
text += overlayInfo->resultInfoText(overlayInfo->histogramData());
|
||||
m_textEdit->setText(text);
|
||||
adjustTextEditHeightToContent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +225,15 @@ QwtPlotMarker* RicGridStatisticsDialog::createVerticalPlotMarker(const QColor& c
|
||||
return marker;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::adjustTextEditHeightToContent()
|
||||
{
|
||||
int docHeight = m_textEdit->document()->size().height();
|
||||
m_textEdit->setFixedHeight(docHeight + 10);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
void deletePlotItems(QwtPlot* plot);
|
||||
static void setMarkers(const Rim3dOverlayInfoConfig::HistogramData& histData, QwtPlot* plot);
|
||||
static QwtPlotMarker* createVerticalPlotMarker(const QColor& color, double xValue);
|
||||
void adjustTextEditHeightToContent();
|
||||
|
||||
private slots:
|
||||
void slotDialogFinished();
|
||||
|
@ -592,11 +592,14 @@ void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
||||
{
|
||||
if (m_viewDef)
|
||||
{
|
||||
// Show dialog before setting data due to text edit auto height setting
|
||||
m_gridStatisticsDialog->resize(600, 800);
|
||||
m_gridStatisticsDialog->show();
|
||||
|
||||
m_gridStatisticsDialog->setLabel("Grid statistics");
|
||||
m_gridStatisticsDialog->setInfoText(m_viewDef);
|
||||
m_gridStatisticsDialog->setHistogramData(m_viewDef);
|
||||
m_gridStatisticsDialog->resize(600, 800);
|
||||
m_gridStatisticsDialog->show();
|
||||
|
||||
m_gridStatisticsDialog->raise();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user