diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index a222f18b3d..958b7bb867 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -20,6 +20,7 @@ #include "RiuWellLogPlot.h" #include "RiaApplication.h" +#include "RiaPreferences.h" #include "RimContextCommandBuilder.h" #include "RimWellLogPlot.h" @@ -31,6 +32,7 @@ #include "RiuWellLogTrack.h" #include "cafCmdFeatureMenuBuilder.h" +#include "cafQShortenedLabel.h" #include "cafSelectionManager.h" #include "cvfAssert.h" @@ -186,7 +188,6 @@ void RiuWellLogPlot::setDepthZoomAndReplot( double minDepth, double maxDepth ) void RiuWellLogPlot::setPlotTitle( const QString& plotTitle ) { m_plotTitle->setText( plotTitle ); - this->updateChildrenLayout(); } //-------------------------------------------------------------------------------------------------- @@ -260,15 +261,23 @@ void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QLabel* RiuWellLogPlot::createTitleLabel() const +caf::QShortenedLabel* RiuWellLogPlot::createTitleLabel() const { - QLabel* plotTitle = new QLabel( "PLOT TITLE HERE", nullptr ); - QFont font = plotTitle->font(); - font.setPointSize( 14 ); + caf::QShortenedLabel* plotTitle = new caf::QShortenedLabel( nullptr ); + plotTitle->setText( "PLOT TITLE HERE" ); + + RiaApplication* app = RiaApplication::instance(); + + QFont font = plotTitle->font(); + int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() ); + + font.setPointSize( defaultFontSize + 1 ); font.setBold( true ); plotTitle->setFont( font ); plotTitle->setVisible( m_plotDefinition->isPlotTitleVisible() ); plotTitle->setAlignment( Qt::AlignHCenter ); + plotTitle->setWordWrap( true ); + plotTitle->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); return plotTitle; } diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.h b/ApplicationCode/UserInterface/RiuWellLogPlot.h index f704ca8ebb..676db21b54 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.h @@ -36,10 +36,14 @@ class RimWellLogPlot; class RiuWellLogTrack; class QFocusEvent; -class QLabel; class QScrollBar; class QwtLegend; +namespace caf +{ +class QShortenedLabel; +} + //================================================================================================== // // RiuWellLogPlot @@ -74,7 +78,7 @@ protected: void contextMenuEvent( QContextMenuEvent* ) override; void keyPressEvent( QKeyEvent* keyEvent ) override; - QLabel* createTitleLabel() const; + caf::QShortenedLabel* createTitleLabel() const; private: void updateScrollBar( double minDepth, double maxDepth ); @@ -90,7 +94,7 @@ protected: QPointer m_plotLayout; QPointer m_trackFrame; QPointer m_trackLayout; - QPointer m_plotTitle; + QPointer m_plotTitle; QPointer m_scrollBarLayout; QScrollBar* m_scrollBar; QList> m_legends;