mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Unify look of frames in 3d View using stylesheets
This commit is contained in:
parent
a6dda48606
commit
7f926a5a4d
@ -27,8 +27,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSimpleHistogramWidget::RiuSimpleHistogramWidget(QWidget * parent /*= 0*/, Qt::WindowFlags f /*= 0*/):
|
||||
QWidget(parent, f)
|
||||
RiuSimpleHistogramWidget::RiuSimpleHistogramWidget(const QString& objectName, QWidget * parent /*= 0*/, Qt::WindowFlags f /*= 0*/)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
m_minPercentile = HUGE_VAL;
|
||||
m_maxPercentile = HUGE_VAL;
|
||||
@ -41,6 +41,8 @@ QWidget(parent, f)
|
||||
m_height = 0;
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
|
||||
setObjectName(objectName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -48,7 +50,7 @@ QWidget(parent, f)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSimpleHistogramWidget::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
QPainter painter(this);
|
||||
this->draw(&painter, 0, 0, this->width()-1, this->height()-1);
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,14 @@ class QStringList;
|
||||
class RiuSimpleHistogramWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
RiuSimpleHistogramWidget( QWidget * parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
RiuSimpleHistogramWidget(const QString& objectName, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
|
||||
void setHistogramData(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setPercentiles(double pmin, double pmax);
|
||||
void setMean(double mean) {m_mean = mean;}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
private:
|
||||
void draw(QPainter *painter,int x, int y, int width, int height );
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "cafOverlayScaleLegend.h"
|
||||
#include "cafTitledOverlayFrame.h"
|
||||
#include "cafQStyledProgressBar.h"
|
||||
#include "cafStyleSheetTools.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfFont.h"
|
||||
@ -142,7 +143,7 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||
m_showAnimProgress = false;
|
||||
|
||||
// Histogram
|
||||
m_histogramWidget = new RiuSimpleHistogramWidget();
|
||||
m_histogramWidget = new RiuSimpleHistogramWidget("HistogramWidget");
|
||||
m_showHistogram = false;
|
||||
|
||||
m_viewerCommands = new RiuViewerCommands(this);
|
||||
@ -1102,7 +1103,7 @@ void RiuViewer::updateTextAndTickMarkColorForOverlayItems()
|
||||
|
||||
updateAxisCrossTextColor();
|
||||
|
||||
updateOverlayItemsPalette();
|
||||
updateOverlayItemsStyle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1118,14 +1119,14 @@ void RiuViewer::updateAxisCrossTextColor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::updateOverlayItemsPalette()
|
||||
void RiuViewer::updateOverlayItemsStyle()
|
||||
{
|
||||
QColor backgroundColor;
|
||||
QColor backgroundFrameColor;
|
||||
QColor contrastColor;
|
||||
{
|
||||
cvf::Color4f cvf_backgroundColor = mainCamera()->viewport()->clearColor();
|
||||
cvf_backgroundColor.a() = 0.8f;
|
||||
cvf_backgroundColor.a() = 0.65f;
|
||||
|
||||
cvf::Color4f cvf_backgroundFrameColor =
|
||||
cvf::Color4f(RiaColorTools::computeOffsetColor(cvf_backgroundColor.toColor3f(), 0.3f), 0.9f);
|
||||
@ -1150,12 +1151,14 @@ void RiuViewer::updateOverlayItemsPalette()
|
||||
p.setColor(QPalette::Dark, backgroundFrameColor);
|
||||
p.setColor(QPalette::Mid, backgroundFrameColor);
|
||||
|
||||
m_infoLabel->setPalette(p);
|
||||
m_histogramWidget->setPalette(p);
|
||||
m_infoLabel->setStyleSheet(caf::StyleSheetTools::createFrameStyleSheet("QLabel", "InfoLabel", contrastColor, backgroundColor, backgroundFrameColor));
|
||||
m_histogramWidget->setStyleSheet(caf::StyleSheetTools::createFrameStyleSheet("", "HistogramWidget", contrastColor, backgroundColor, backgroundFrameColor));
|
||||
|
||||
m_versionInfoLabel->setPalette(p);
|
||||
m_zScaleLabel->setPalette(p);
|
||||
|
||||
QColor progressColor(Qt::green); progressColor.setAlphaF(0.8f);
|
||||
backgroundColor.setAlphaF(0.8f);
|
||||
m_animationProgress->setTextBackgroundAndProgressColor(contrastColor, backgroundColor, backgroundFrameColor, progressColor);
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ private:
|
||||
cvf::Color3f computeContrastColor() const;
|
||||
|
||||
void updateAxisCrossTextColor();
|
||||
void updateOverlayItemsPalette();
|
||||
void updateOverlayItemsStyle();
|
||||
|
||||
void paintOverlayItems(QPainter* painter) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user