Added a GUI theme selector in preferences and a new class for handling GUI changes.

Added a new feature for editing style sheets and variable colors and see immediately the result.
Made Qwt plots (and items) stylable.
Added icons, improved styling possibilities of QMinimizePanel, fixed minor bugs in RicThemeColorEditorFeature.
This commit is contained in:
Ruben Manuel Thoms 2020-09-04 17:10:55 +02:00 committed by Gaute Lindkvist
parent 66ec3212c0
commit 87bc6acd65
50 changed files with 3178 additions and 308 deletions

View File

@ -417,6 +417,8 @@ void RiaGuiApplication::initialize()
{
RiaApplication::initialize();
RiuGuiTheme::updateGuiTheme( m_preferences->guiTheme() );
applyGuiPreferences( nullptr );
// Create main windows

View File

@ -384,6 +384,8 @@ RiaPreferences::RiaPreferences( void )
"",
"Defines preferred minimum distance between surface points in XY-plane",
"" );
CAF_PDM_InitFieldNoDefault( &m_guiTheme, "guiTheme", "GUI theme", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@ -595,6 +597,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add( &m_showTestToolbar );
uiOrdering.add( &m_includeFractureDebugInfoFile );
uiOrdering.add( &m_holoLensExportFolder );
uiOrdering.add( &m_guiTheme );
}
uiOrdering.skipRemainingFields( true );
@ -681,6 +684,11 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_pageTopMargin = defaultMarginSize( m_pageSize() );
m_pageBottomMargin = defaultMarginSize( m_pageSize() );
}
if ( changedField == &m_guiTheme )
{
RiuGuiTheme::updateGuiTheme( m_guiTheme() );
}
}
//--------------------------------------------------------------------------------------------------
///
@ -991,6 +999,14 @@ bool RiaPreferences::openExportedPdfInViewer() const
return m_openExportedPdfInViewer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGuiTheme::ThemeEnum RiaPreferences::guiTheme() const
{
return m_guiTheme();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,7 @@
#include "RiaFontCache.h"
#include "RiaGuiApplication.h"
#include "RiaQDateTimeTools.h"
#include "RiuGuiTheme.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
@ -112,6 +113,8 @@ public:
bool showProgressBar() const;
bool openExportedPdfInViewer() const;
RiuGuiTheme::ThemeEnum guiTheme() const;
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
void writePreferencesToApplicationStore();
@ -212,6 +215,8 @@ private:
caf::PdmField<bool> m_showProgressBar;
caf::PdmField<QString> m_gtestFilter;
caf::PdmField<caf::AppEnum<RiuGuiTheme::ThemeEnum>> m_guiTheme;
caf::PdmField<PageSizeEnum> m_pageSize;
caf::PdmField<PageOrientationEnum> m_pageOrientation;
caf::PdmField<double> m_pageLeftMargin;

View File

@ -25,6 +25,8 @@
#include <algorithm>
#include <cmath>
#include <QPalette>
//--------------------------------------------------------------------------------------------------
/// Uses W3.org relative luminance calculation taking into account the different luminance of the different colors
/// https://www.w3.org/TR/WCAG20-TECHS/G18.html
@ -141,6 +143,24 @@ cvf::Color3f RiaColorTools::fromQColorTo3f( QColor color )
return cvf::Color3f( color.redF(), color.greenF(), color.blueF() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RiaColorTools::systemPaletteTextColor()
{
QPalette systemPalette;
return systemPalette.color( QPalette::Text );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTools::systemPaletteTextColor3f()
{
return fromQColorTo3f( systemPaletteTextColor() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -42,6 +42,9 @@ public:
static QColor toQColor( cvf::Color4f color );
static cvf::Color3f fromQColorTo3f( QColor );
static QColor systemPaletteTextColor();
static cvf::Color3f systemPaletteTextColor3f();
static cvf::Color3f
blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 );
static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 );

View File

@ -37,6 +37,11 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiaVersionInfo.h
)
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/RiuThemesDirectory.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiuThemesDirectory.h
)
if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)

View File

@ -90,6 +90,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureModelPlotToFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.h
)
@ -184,6 +185,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureModelPlotToFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.cpp
)

View File

@ -0,0 +1,176 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicThemeColorEditorFeature.h"
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "RiuMainWindow.h"
#include "RiuGuiTheme.h"
#include "RiuQssSyntaxHighlighter.h"
#include "RiuTextEditWithCompletion.h"
#include "cafAppEnum.h"
#include <QAction>
#include <QColorDialog>
#include <QComboBox>
#include <QCompleter>
#include <QGridLayout>
#include <QMessageBox>
#include <QPushButton>
#include <QStringListModel>
CAF_CMD_SOURCE_INIT( RicThemeColorEditorFeature, "RicThemeColorEditorFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicThemeColorEditorFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
{
RiuGuiTheme::ThemeEnum theme = RiaGuiApplication::instance()->preferences()->guiTheme();
QDialog* dialog = new QDialog( RiuMainWindow::instance() );
connect( dialog, &QDialog::close, [this, theme]() { RiuGuiTheme::updateGuiTheme( theme ); } );
dialog->setModal( false );
dialog->setWindowTitle( "Theme Color Editor Dialog" );
QGridLayout* layout = new QGridLayout();
layout->addWidget( new QLabel( "GUI theme" ), 0, 0 );
QComboBox* themeSelector = new QComboBox();
caf::AppEnum<RiuGuiTheme::ThemeEnum> themes;
for ( size_t index = 0; index < themes.size(); index++ )
{
themeSelector->addItem( themes.uiTextFromIndex( index ), QVariant::fromValue( index ) );
if ( static_cast<RiuGuiTheme::ThemeEnum>( index ) == theme )
{
themeSelector->setCurrentIndex( static_cast<int>( index ) );
}
}
layout->addWidget( themeSelector, 0, 1 );
QFrame* line = new QFrame();
line->setFrameShape( QFrame::HLine );
layout->addWidget( line, 1, 0, 1, 2 );
QWidget* widget = new QWidget();
layout->addWidget( widget, 2, 0, 1, 2 );
TextEditWithCompletion* editor = new TextEditWithCompletion();
editor->setAcceptRichText( false );
QCompleter* completer = new QCompleter( RiuMainWindow::instance() );
completer->setModel( RiuGuiTheme::getQssCompletionModel( completer ) );
completer->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
completer->setCaseSensitivity( Qt::CaseInsensitive );
completer->setWrapAround( false );
editor->setCompleter( completer );
QssSyntaxHighligter* highlighter = new QssSyntaxHighligter( editor->document() );
auto generateColorFields = [themeSelector, widget, editor, completer, this]() -> void {
QLayoutItem* item;
if ( widget->layout() )
{
while ( ( item = widget->layout()->takeAt( 0 ) ) != NULL )
{
delete item->widget();
delete item;
}
delete widget->layout();
}
QGridLayout* innerLayout = new QGridLayout();
int row = 0;
int column = 0;
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
QMap<QString, QString> variableValueMap = RiuGuiTheme::getVariableValueMap( theme );
QMap<QString, QString> variableGuiTextMap = RiuGuiTheme::getVariableGuiTextMap( theme );
for ( const QString variableName : variableValueMap.keys() )
{
innerLayout->addWidget( new QLabel( !variableGuiTextMap[variableName].isEmpty() ? variableGuiTextMap[variableName]
: variableName ),
row,
column );
QPushButton* colorBox = new QPushButton( "" );
colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( variableValueMap.value( variableName ) ) );
connect( colorBox,
&QPushButton::clicked,
[this, variableValueMap, variableName, theme, editor, widget, colorBox]() -> void {
QColor color = QColorDialog::getColor( colorBox->palette().color( QPalette::Button ), widget );
colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( color.name() ) );
colorBox->style()->unpolish( colorBox );
colorBox->style()->polish( colorBox );
RiuGuiTheme::changeVariableValue( theme, variableName, color.name() );
editor->setPlainText( RiuGuiTheme::applyVariableValueMapToStyleSheet( theme ) );
} );
innerLayout->addWidget( colorBox, row++, column + 1 );
if ( row == 10 )
{
row = 0;
column += 2;
}
}
widget->setLayout( innerLayout );
};
// A more elegant way, but not supported in old Qt version.
// connect( themeSelector, qOverload<int>( &QComboBox::currentIndexChanged ), [=]() {
connect( themeSelector, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [=]() {
generateColorFields();
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
RiuGuiTheme::updateGuiTheme( static_cast<RiuGuiTheme::ThemeEnum>( theme ) );
editor->setPlainText( RiuGuiTheme::loadStyleSheet( theme ) );
} );
generateColorFields();
RiuGuiTheme::updateGuiTheme( theme );
editor->setPlainText( RiuGuiTheme::loadStyleSheet( theme ) );
line = new QFrame();
line->setFrameShape( QFrame::HLine );
layout->addWidget( line, 3, 0, 1, 2 );
layout->addWidget( editor, 5, 0, 1, 2 );
QPushButton* button = new QPushButton( "Apply style sheet changes" );
layout->addWidget( button, 6, 1 );
connect( button, &QPushButton::clicked, [this, themeSelector, editor, generateColorFields]() {
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
RiuGuiTheme::writeStyleSheetToFile( theme, editor->toPlainText() );
generateColorFields();
} );
dialog->setLayout( layout );
dialog->show();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicThemeColorEditorFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Open Theme Color Editor" );
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicThemeColorEditorFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -141,7 +141,7 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
CAF_PDM_InitField( &m_curveColor, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_curveColor, "Color", RiaColorTools::systemPaletteTextColor3f(), "Color", "", "", "" );
CAF_PDM_InitField( &m_fillColor, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" );
CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "" );
@ -151,7 +151,13 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_fillStyle, "FillStyle", "Area Fill Style", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol", "", "", "" );
CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", cvf::Color3f( cvf::Color3::BLACK ), "Symbol Edge Color", "", "", "" );
CAF_PDM_InitField( &m_symbolEdgeColor,
"SymbolEdgeColor",
RiaColorTools::systemPaletteTextColor3f(),
"Symbol Edge Color",
"",
"",
"" );
CAF_PDM_InitField( &m_symbolSkipPixelDistance,
"SymbolSkipPxDist",
@ -999,8 +1005,8 @@ void RimPlotCurve::setLineThickness( int thickness )
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::resetAppearance()
{
setColor( cvf::Color3f( cvf::Color3::BLACK ) );
setSymbolEdgeColor( cvf::Color3f( cvf::Color3::BLACK ) );
setColor( RiaColorTools::systemPaletteTextColor3f() );
setSymbolEdgeColor( RiaColorTools::systemPaletteTextColor3f() );
setLineThickness( 2 );
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
setSymbol( RiuQwtSymbol::SYMBOL_NONE );

View File

@ -18,9 +18,9 @@
#include "RimEnsembleCurveSet.h"
#include "RiaColorTools.h"
#include "RiaGuiApplication.h"
#include "RiaStatisticsTools.h"
#include "RiuAbstractLegendFrame.h"
#include "SummaryPlotCommands/RicSummaryPlotEditorUi.h"
@ -46,6 +46,7 @@
#include "RimSummaryFilter.h"
#include "RimSummaryPlot.h"
#include "RiuAbstractLegendFrame.h"
#include "RiuCvfOverlayItemWidget.h"
#include "RiuDraggableOverlayFrame.h"
#include "RiuPlotMainWindow.h"
@ -115,7 +116,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum<ColorMode>( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::systemPaletteTextColor3f(), "Color", "", "", "" );
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
@ -1033,7 +1034,6 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
curve->setParentQwtPlotNoReplot( plot->viewer() );
m_curves.push_back( curve );
curve->setColor( m_statistics->color() );
curve->setColor( m_statistics->color() );
auto symbol = statisticsCurveSymbolFromAddress( address );
curve->setSymbol( symbol );

View File

@ -18,8 +18,8 @@
#include "RimEnsembleStatistics.h"
#include "RiaColorTools.h"
#include "RifSummaryReaderInterface.h"
#include "RigStatisticsMath.h"
#include "RimEnsembleCurveSet.h"
@ -46,7 +46,8 @@ RimEnsembleStatistics::RimEnsembleStatistics()
CAF_PDM_InitField( &m_includeIncompleteCurves, "IncludeIncompleteCurves", false, "Include Incomplete Curves", "", "", "" );
CAF_PDM_InitField( &m_warningLabel, "WarningLabel", QString( "Warning: Ensemble time range mismatch" ), "", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::systemPaletteTextColor3f(), "Color", "", "", "" );
m_warningLabel.xmlCapability()->disableIO();
m_warningLabel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );

View File

@ -1,200 +1,212 @@
<RCC>
<qresource prefix="/">
<file>2DMap16x16.png</file>
<file>2DMapProjection16x16.png</file>
<file>2DMaps16x16.png</file>
<file>3DView16x16.png</file>
<file>3DViewGeoMech16x16.png</file>
<file>3DWindow24x24.png</file>
<file>AICDValve16x16.png</file>
<file>Annotations16x16.png</file>
<file>AnalysisPlot16x16.png</file>
<file>AnalysisPlots16x16.png</file>
<file>AnalysisPlotFilter16x16.png</file>
<file>AppLogo48x48.png</file>
<file>Axes16x16.png</file>
<file>BottomAxis16x16.png</file>
<file>Case48x48.png</file>
<file>Case24x24.png</file>
<file>Cases16x16.png</file>
<file>CasingDesign16x16.png</file>
<file>CellFilter_Range.png</file>
<file>CellFilter_Values.png</file>
<file>CellResult.png</file>
<file>Columns1.png</file>
<file>Columns2.png</file>
<file>Columns3.png</file>
<file>Columns4.png</file>
<file>ColumnsUnlimited.png</file>
<file>ComparisonView16x16.png</file>
<file>CompletionsSymbol16x16.png</file>
<file>ControlledView16x16.png</file>
<file>Copy.png</file>
<file>CorrelationCrossPlot16x16.png</file>
<file>CorrelationMatrixPlot16x16.png</file>
<file>CorrelationPlots16x16.png</file>
<file>CorrelationReportPlot16x16.png</file>
<file>CorrelationTornadoPlot16x16.png</file>
<file>CreateGridCaseGroup16x16.png</file>
<file>CrossSection16x16.png</file>
<file>CrossSections16x16.png</file>
<file>CumulativePhaseDist16x16.png</file>
<file>DownViewArrow.png</file>
<file>EastViewArrow.png</file>
<file>EclipseInput48x48.png</file>
<file>EdgeResult_1.png</file>
<file>EditableWell.png</file>
<file>EnsembleCurveSet16x16.png</file>
<file>EnsembleCurveSets16x16.png</file>
<file>Erase.png</file>
<file>ExportCompletionsSymbol16x16.png</file>
<file>FishBoneGroup16x16.png</file>
<file>FishBoneGroupFromFile16x16.png</file>
<file>FishBoneLateralFromFile16x16.png</file>
<file>FishBones16x16.png</file>
<file>FlowCharPlot16x16.png</file>
<file>Folder.png</file>
<file>FormationCollection16x16.png</file>
<file>Formations16x16.png</file>
<file>FractureLayout16x16.png</file>
<file>FractureSymbol16x16.png</file>
<file>FractureTemplate16x16.png</file>
<file>FractureTemplates16x16.png</file>
<file>GeoMechCase24x24.png</file>
<file>GeoMechCase48x48.png</file>
<file>GeoMechCasePropTable24x24.png</file>
<file>GeoMechCaseTime24x24.png</file>
<file>GeoMechCases48x48.png</file>
<file>GridCaseGroup16x16.png</file>
<file>GridModels.png</file>
<file>Histogram16x16.png</file>
<file>Histograms16x16.png</file>
<file>HoloLensConnect24x24.png</file>
<file>HoloLensDisconnect24x24.png</file>
<file>HoloLensSendContinously24x24.png</file>
<file>HoloLensSendOnce24x24.png</file>
<file>ICDValve16x16.png</file>
<file>ICVValve16x16.png</file>
<file>InfoBox16x16.png</file>
<file>IntersectionBox16x16.png</file>
<file>IntersectionXPlane16x16.png</file>
<file>IntersectionYPlane16x16.png</file>
<file>IntersectionZPlane16x16.png</file>
<file>LGR16x16.png</file>
<file>LasFile16x16.png</file>
<file>LeftAxis16x16.png</file>
<file>Legend.png</file>
<file>LinkView16x16.png</file>
<file>LinkView24x24.png</file>
<file>MainGrid16x16.png</file>
<file>MasterView16x16.png</file>
<file>Minus.png</file>
<file>NorthViewArrow.png</file>
<file>MultiPlot16x16.png</file>
<file>ObservedCSVDataFile16x16.png</file>
<file>ObservedDataFile16x16.png</file>
<file>ObservedRFTDataFile16x16.png</file>
<file>ObservedRSMDataFile16x16.png</file>
<file>OctaveScriptFile16x16.png</file>
<file>PagePreview16x16.png</file>
<file>PdfSave.png</file>
<file>Parallel24x24.png</file>
<file>PerforationInterval16x16.png</file>
<file>PerforationIntervals16x16.png</file>
<file>Perspective24x24.png</file>
<file>PlotWindow24x24.png</file>
<file>Plus.png</file>
<file>PolylinesFromFile16x16.png</file>
<file>PythonScriptFile16x16.png</file>
<file>RFTPlot16x16.png</file>
<file>RFTPlots16x16.png</file>
<file>ReachCircle16x16.png</file>
<file>Refresh-32.png</file>
<file>RemoveComparisonView16x16.png</file>
<file>ReplaceCase16x16.png</file>
<file>ReservoirSurface16x16.png</file>
<file>ReservoirSurfaces16x16.png</file>
<file>Rows1.png</file>
<file>Rows2.png</file>
<file>Rows3.png</file>
<file>Rows4.png</file>
<file>RightAxis16x16.png</file>
<file>Ruler24x24.png</file>
<file>RulerPoly24x24.png</file>
<file>Save24x24.png</file>
<file>SaveAs24x24.png</file>
<file>SnapShot.png</file>
<file>SnapShotSave.png</file>
<file>SnapShotSaveViews.png</file>
<file>SouthViewArrow.png</file>
<file>SplitterH.png</file>
<file>SplitterV.png</file>
<file>StepUpDown16x16.png</file>
<file>StepUpDownCorner16x16.png</file>
<file>SummaryCase16x16.png</file>
<file>SummaryCase24x24.png</file>
<file>SummaryCase48x48.png</file>
<file>SummaryCases16x16.png</file>
<file>SummaryCurve16x16.png</file>
<file>SummaryCurveFilter16x16.png</file>
<file>SummaryEnsemble16x16.png</file>
<file>SummaryEnsemble24x24.png</file>
<file>SummaryGroup16x16.png</file>
<file>SummaryPlotLight16x16.png</file>
<file>SummaryPlots16x16.png</file>
<file>SummaryPlotsLight16x16.png</file>
<file>SummaryTemplate16x16.png</file>
<file>SummaryXPlotLight16x16.png</file>
<file>SummaryXPlotsLight16x16.png</file>
<file>Swap.png</file>
<file>TOFAccSatPlot16x16.png</file>
<file>TempLGR16x16.png</file>
<file>TextAnnotation16x16.png</file>
<file>TileWindows24x24.png</file>
<file>ToggleOff16x16.png</file>
<file>ToggleOn16x16.png</file>
<file>ToggleOnOff16x16.png</file>
<file>ToggleOnOthersOff16x16.png</file>
<file>UnLinkView16x16.png</file>
<file>UpViewArrow.png</file>
<file>Well.png</file>
<file>WellAllocLegend16x16.png</file>
<file>WellAllocPie16x16.png</file>
<file>WellAllocPlot16x16.png</file>
<file>WellAllocPlots16x16.png</file>
<file>WellBoreStability16x16.png</file>
<file>WellCF16x16.png</file>
<file>WellCollection.png</file>
<file>WellFlowPlot16x16.png</file>
<file>WellLogCurve16x16.png</file>
<file>WellLogPlot16x16.png</file>
<file>WellLogPlots16x16.png</file>
<file>WellLogTrack16x16.png</file>
<file>WellMeasurement16x16.png</file>
<file>WellTargetPoint16x16.png</file>
<file>WellTargetPointTangent16x16.png</file>
<file>WellTargets.png</file>
<file>WestViewArrow.png</file>
<file>Window16x16.png</file>
<file>ZoomAll16x16.png</file>
<file>calculator.png</file>
<file>chain.png</file>
<file>clipboard.png</file>
<file>disable_lighting_24x24.png</file>
<file>draw_style_WellCellsToRangeFilter_24x24.png</file>
<file>draw_style_faults_24x24.png</file>
<file>draw_style_faults_label_24x24.png</file>
<file>draw_style_lines_24x24.png</file>
<file>draw_style_meshlines_24x24.png</file>
<file>draw_style_surface_24x24.png</file>
<file>draw_style_surface_w_fault_mesh_24x24.png</file>
<file>octave.png</file>
<file>openFolder24x24.png</file>
<file>statistics.png</file>
</qresource>
<qresource prefix="/Shader/">
<file>fs_CellFace.glsl</file>
<file>vs_CellFace.glsl</file>
<file>vs_2dTextureCellFace.glsl</file>
</qresource>
<qresource prefix="/">
<file>2DMap16x16.png</file>
<file>2DMapProjection16x16.png</file>
<file>2DMaps16x16.png</file>
<file>3DView16x16.png</file>
<file>3DViewGeoMech16x16.png</file>
<file>3DWindow24x24.png</file>
<file>AICDValve16x16.png</file>
<file>Annotations16x16.png</file>
<file>AnalysisPlot16x16.png</file>
<file>AnalysisPlots16x16.png</file>
<file>AnalysisPlotFilter16x16.png</file>
<file>AppLogo48x48.png</file>
<file>Axes16x16.png</file>
<file>BottomAxis16x16.png</file>
<file>Cases16x16.png</file>
<file>Case24x24.png</file>
<file>Case48x48.png</file>
<file>CasingDesign16x16.png</file>
<file>CellFilter_Range.png</file>
<file>CellFilter_Values.png</file>
<file>CellResult.png</file>
<file>Columns1.png</file>
<file>Columns2.png</file>
<file>Columns3.png</file>
<file>Columns4.png</file>
<file>ColumnsUnlimited.png</file>
<file>ComparisonView16x16.png</file>
<file>CompletionsSymbol16x16.png</file>
<file>ControlledView16x16.png</file>
<file>Copy.png</file>
<file>CorrelationCrossPlot16x16.png</file>
<file>CorrelationMatrixPlot16x16.png</file>
<file>CorrelationPlots16x16.png</file>
<file>CorrelationReportPlot16x16.png</file>
<file>CorrelationTornadoPlot16x16.png</file>
<file>CreateGridCaseGroup16x16.png</file>
<file>CrossSection16x16.png</file>
<file>CrossSections16x16.png</file>
<file>CumulativePhaseDist16x16.png</file>
<file>DownViewArrow.png</file>
<file>EastViewArrow.png</file>
<file>EclipseInput48x48.png</file>
<file>EdgeResult_1.png</file>
<file>EditableWell.png</file>
<file>EnsembleCurveSet16x16.png</file>
<file>EnsembleCurveSets16x16.png</file>
<file>Erase.png</file>
<file>ExportCompletionsSymbol16x16.png</file>
<file>FishBoneGroup16x16.png</file>
<file>FishBoneGroupFromFile16x16.png</file>
<file>FishBoneLateralFromFile16x16.png</file>
<file>FishBones16x16.png</file>
<file>FlowCharPlot16x16.png</file>
<file>Folder.png</file>
<file>FormationCollection16x16.png</file>
<file>Formations16x16.png</file>
<file>FractureLayout16x16.png</file>
<file>FractureSymbol16x16.png</file>
<file>FractureTemplate16x16.png</file>
<file>FractureTemplates16x16.png</file>
<file>GeoMechCase24x24.png</file>
<file>GeoMechCase48x48.png</file>
<file>GeoMechCasePropTable24x24.png</file>
<file>GeoMechCaseTime24x24.png</file>
<file>GeoMechCases48x48.png</file>
<file>GridCaseGroup16x16.png</file>
<file>GridModels.png</file>
<file>Histogram16x16.png</file>
<file>Histograms16x16.png</file>
<file>HoloLensConnect24x24.png</file>
<file>HoloLensDisconnect24x24.png</file>
<file>HoloLensSendContinously24x24.png</file>
<file>HoloLensSendOnce24x24.png</file>
<file>ICDValve16x16.png</file>
<file>ICVValve16x16.png</file>
<file>InfoBox16x16.png</file>
<file>IntersectionBox16x16.png</file>
<file>IntersectionXPlane16x16.png</file>
<file>IntersectionYPlane16x16.png</file>
<file>IntersectionZPlane16x16.png</file>
<file>LGR16x16.png</file>
<file>LasFile16x16.png</file>
<file>LeftAxis16x16.png</file>
<file>Legend.png</file>
<file>LinkView16x16.png</file>
<file>LinkView24x24.png</file>
<file>MainGrid16x16.png</file>
<file>MasterView16x16.png</file>
<file>Minus.png</file>
<file>NorthViewArrow.png</file>
<file>MultiPlot16x16.png</file>
<file>ObservedCSVDataFile16x16.png</file>
<file>ObservedDataFile16x16.png</file>
<file>ObservedRFTDataFile16x16.png</file>
<file>ObservedRSMDataFile16x16.png</file>
<file>OctaveScriptFile16x16.png</file>
<file>PagePreview16x16.png</file>
<file>PdfSave.png</file>
<file>Parallel24x24.png</file>
<file>PerforationInterval16x16.png</file>
<file>PerforationIntervals16x16.png</file>
<file>Perspective24x24.png</file>
<file>PlotWindow24x24.png</file>
<file>Plus.png</file>
<file>PolylinesFromFile16x16.png</file>
<file>PythonScriptFile16x16.png</file>
<file>RFTPlot16x16.png</file>
<file>RFTPlots16x16.png</file>
<file>ReachCircle16x16.png</file>
<file>Refresh-32.png</file>
<file>RemoveComparisonView16x16.png</file>
<file>ReplaceCase16x16.png</file>
<file>ReservoirSurface16x16.png</file>
<file>ReservoirSurfaces16x16.png</file>
<file>Rows1.png</file>
<file>Rows2.png</file>
<file>Rows3.png</file>
<file>Rows4.png</file>
<file>RightAxis16x16.png</file>
<file>Ruler24x24.png</file>
<file>RulerPoly24x24.png</file>
<file>Save24x24.png</file>
<file>SaveAs24x24.png</file>
<file>SnapShot.png</file>
<file>SnapShotSave.png</file>
<file>SnapShotSaveViews.png</file>
<file>SouthViewArrow.png</file>
<file>SplitterH.png</file>
<file>SplitterV.png</file>
<file>StepUpDown16x16.png</file>
<file>StepUpDownCorner16x16.png</file>
<file>SummaryCase16x16.png</file>
<file>SummaryCase48x48.png</file>
<file>SummaryCases16x16.png</file>
<file>SummaryCurve16x16.png</file>
<file>SummaryCurveFilter16x16.png</file>
<file>SummaryEnsemble16x16.png</file>
<file>SummaryEnsemble24x24.png</file>
<file>SummaryGroup16x16.png</file>
<file>SummaryPlotLight16x16.png</file>
<file>SummaryPlots16x16.png</file>
<file>SummaryPlotsLight16x16.png</file>
<file>SummaryTemplate16x16.png</file>
<file>SummaryXPlotLight16x16.png</file>
<file>SummaryXPlotsLight16x16.png</file>
<file>Swap.png</file>
<file>TOFAccSatPlot16x16.png</file>
<file>TempLGR16x16.png</file>
<file>TextAnnotation16x16.png</file>
<file>TileWindows24x24.png</file>
<file>ToggleOff16x16.png</file>
<file>ToggleOn16x16.png</file>
<file>ToggleOnOff16x16.png</file>
<file>ToggleOnOthersOff16x16.png</file>
<file>UnLinkView16x16.png</file>
<file>UpViewArrow.png</file>
<file>Well.png</file>
<file>WellAllocLegend16x16.png</file>
<file>WellAllocPie16x16.png</file>
<file>WellAllocPlot16x16.png</file>
<file>WellAllocPlots16x16.png</file>
<file>WellBoreStability16x16.png</file>
<file>WellCF16x16.png</file>
<file>WellCollection.png</file>
<file>WellFlowPlot16x16.png</file>
<file>WellLogCurve16x16.png</file>
<file>WellLogPlot16x16.png</file>
<file>WellLogPlots16x16.png</file>
<file>WellLogTrack16x16.png</file>
<file>WellMeasurement16x16.png</file>
<file>WellTargetPoint16x16.png</file>
<file>WellTargetPointTangent16x16.png</file>
<file>WellTargets.png</file>
<file>WestViewArrow.png</file>
<file>Window16x16.png</file>
<file>ZoomAll16x16.png</file>
<file>calculator.png</file>
<file>chain.png</file>
<file>clipboard.png</file>
<file>disable_lighting_24x24.png</file>
<file>draw_style_WellCellsToRangeFilter_24x24.png</file>
<file>draw_style_faults_24x24.png</file>
<file>draw_style_faults_label_24x24.png</file>
<file>draw_style_lines_24x24.png</file>
<file>draw_style_meshlines_24x24.png</file>
<file>draw_style_surface_24x24.png</file>
<file>draw_style_surface_w_fault_mesh_24x24.png</file>
<file>octave.png</file>
<file>openFolder24x24.png</file>
<file>statistics.png</file>
<file>themes/dark.qss</file>
<file>themes/default.qss</file>
<file>themes/light.qss</file>
<file>utility/qss-keywords.txt</file>
<file>themes/dark/close.svg</file>
<file>themes/dark/float.svg</file>
<file>themes/dark/close-hover.svg</file>
<file>themes/dark/float-hover.svg</file>
<file>themes/dark/blank.svg</file>
<file>themes/dark/collapsed.svg</file>
<file>themes/dark/expanded.svg</file>
<file>themes/dark/arrow-down.svg</file>
<file>themes/dark/arrow-up.svg</file>
</qresource>
<qresource prefix="/Shader">
<file>fs_CellFace.glsl</file>
<file>vs_CellFace.glsl</file>
<file>vs_2dTextureCellFace.glsl</file>
</qresource>
</RCC>

View File

@ -0,0 +1,363 @@
$mainBackgroundColor: #24292e; // Main background color
$backgroundColor1: #394046; // Background color layer 1
$backgroundColor2: #464c53; // Background color layer 2
$backgroundColor3: #5a6067; // Background color layer 3
$backgroundColor4: #89939d; // Background color layer 4
$backgroundColor5: #adbac6; // Background color layer 5
$textColor: #e6e7ea; // Main text color
$primaryColor: #018fa3; // Primary color (buttons etc)
$secondaryColor: #e82257; // Secondary color
$tertiaryColor: #ffc50d; // Tertiary color
$quaternaryColor: #36b27e; // Quaternary color
$quinaryColor: #0ce5d5; // Quinary color
$senaryColor: #a54ce5; // Senary color
$borderColor: #394046; // Main border color
$curveColorGas: #2196f3; // Curve color for gas plot
$curveColorOil: #4caf50; // Curve color for oil plot
$markerColor: #e6e7ea; // Marker color
$lineMarkerColor: #eeeeee; // Color of line marker
$plotGridColor: #394046; // Plot grid color
$auxiliaryCurveColor: #000000; // Auxiliary curve color
QwtPlot["*"]::grid["*"] {
color: $backgroundColor2;
}
QwtPlot["*"]::legend {
text-color: $textColor;
}
RiuQwtPlotWidget {
color: $textColor;
}
QwtTextLabel {
color: $textColor;
}
QwtPlot["PvtPlot"]::picker {
text-color: $textColor;
}
QwtPlot["PvtPlot"]::curve["Auxiliary"] {
line-color: #ffffff;
}
QwtPlot["PvtPlot"]::curve["Oil"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["PvtPlot"]::curve["Gas"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRW"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROW"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOW"] {
line-color: $tertiaryColor;
symbol-color: $tertiaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRG"] {
line-color: $quaternaryColor;
symbol-color: $quaternaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROG"] {
line-color: $quinaryColor;
symbol-color: $quinaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOG"] {
line-color: $senaryColor;
symbol-color: $senaryColor;
}
QwtPlot["PvtPlot"]::lineMarker["*"] {
color: $textColor;
}
QwtPlot["PvtPlot"]::pointMarker["*"] {
color: $textColor;
}
QToolBox {
background-color: $mainBackgroundColor;
}
QToolButton {
background-color: $backgroundColor1;
color: $textColor;
border-width : 0px;
padding: 3px;
}
QLabel, QCheckBox {
background-color: transparent;
}
QWidget {
background-color: $mainBackgroundColor;
color: $textColor;
border-color: $borderColor;
}
QProgressBar {
text-align: center;
background-color: $backgroundColor1;
}
QAbstractItemView {
border: 2px solid $borderColor;
border-style: solid;
}
QAbstractItemView::item:hover {
background-color: $primaryColor;
}
QAbstractItemView::item:selected {
background-color: $secondaryColor;
color: $textColor;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(:/themes/dark/collapsed.svg);
width: 12px;
height: 12px;
}
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {
border-image: none;
image: url(:/themes/dark/expanded.svg);
icon-size: 12px;
}
QDockWidget {
background-color: $mainBackgroundColor;
titlebar-close-icon: url(:/themes/dark/blank.svg);
titlebar-normal-icon: url(:/themes/dark/blank.svg);
}
QDockWidget::title {
background-color: $backgroundColor1;
padding: 5px;
}
QDockWidget::close-button, QDockWidget::float-button {
background: transparent;
border: none;
icon-size: 12px;
padding: 0px;
}
QDockWidget::float-button {
image: url(:/themes/dark/float.svg);
}
QDockWidget::close-button {
image: url(:/themes/dark/close.svg);
}
QDockWidget::float-button:hover {
image: url(:/themes/dark/float-hover.svg);
}
QDockWidget::close-button:hover {
image: url(:/themes/dark/close-hover.svg);
}
QToolBar QWidget {
background-color: transparent;
border-color: $borderColor;
}
QMenuBar::item:selected {
background-color: $primaryColor;
color: $textColor;
}
QMenu::item:selected {
background-color: $primaryColor;
color: $textColor;
}
QLineEdit, QComboBox, QSpinBox,
QDoubleSpinBox, QDateEdit, QDateTimeEdit {
background-color: $backgroundColor1;
color: $textColor;
border-color: $borderColor;
border-width : 1.5px;
border-style: solid;
padding: 3px;
}
QToolBar {
background-color: #2e353a;
}
QToolBar QToolButton {
border: none;
}
QToolBar QToolButton:hover {
background-color: $backgroundColor1;
}
QLCDNumber {
color: $textColor;
border-color: $borderColor;
border-width : 1.5px;
border-style: solid;
border-radius: 5px;
}
QPushButton {
color: $textColor;
border-color: $borderColor;
background-color: $backgroundColor1;
border-width: 1.5px;
border-style: solid;
padding: 5px;
font-weight: bold;
}
QTabWidget {
background-color: #535353;
}
QTabWidget::pane {
border-top: 1px solid $backgroundColor3;
background-color: $mainBackgroundColor;
}
QTabBar::tab {
background-color: $backgroundColor1;
border: 1px solid #2C2C2C;
border-bottom: 0px;
border-radius: 1px;
padding: 6px;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background-color: $backgroundColor3;
}
QTabBar::tab:selected {
border-bottom: 0px;
}
QTabBar::tab:!selected {
color: $textColor;
}
/* Scrollbars */
QScrollBar:vertical {
border: 0px;;
background: transparent;
width: 15px;
margin: 0px 0px 0px 0px;
}
QScrollBar:vertical:hover {
background: $backgroundColor2;
}
QScrollBar::handle:vertical {
background: $backgroundColor4;
min-height: 20px;
margin: 3px 3px 3px 3px;
border-radius: 3px;
}
QScrollBar::handle:vertical::hover,
QScrollBar::handle:horizontal::hover {
background: $backgroundColor5;
}
QScrollBar::handle:vertical::pressed,
QScrollBar::handle:horizontal::pressed {
background: white;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical,
QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal {
border: 0px;
height: 0px;
}
QScrollBar::up-arrow:vertical,
QScrollBar::down-arrow:vertical,
QScrollBar::down-arrow:horizontal,
QScrollBar::up-arrow:horizontal {
border: 0px;
background: none;
}
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
background: none;
}
QScrollBar:horizontal {
border: 0px;
background: transparent;
height: 15px;
margin: 0px 0px 0px 0px;
}
QScrollBar:horizontal:hover {
background: $backgroundColor2;
}
QScrollBar::handle:horizontal {
background: $backgroundColor4;
min-width: 20px;
margin: 3px 3px 3px 3px;
border-radius: 3px;
}
QFrame#FramedGroupContent {
background-color: $mainBackgroundColor;
border-top: 1px solid $borderColor;
}
QFrame#GroupTitleFrame QToolButton {
padding: 3px;
}
QMinimizePanel {
qproperty-background: $mainBackgroundColor;
qproperty-titleBackground: $backgroundColor2;
qproperty-border: $borderColor;
qproperty-expandIconPath: url(:/themes/dark/arrow-down.svg);
qproperty-collapseIconPath: url(:/themes/dark/arrow-up.svg);
qproperty-iconSize: 8px;
border: 2px solid $backgroundColor2;
}
QMinimizePanel QLabel, QMinimizePanel QCheckBox, QToolButton {
background-color: transparent;
}
QTextEdit, QPlainTextEdit {
border: 2px solid $borderColor;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<polygon class="st0" points="23.02,5.58 12,18.19 1,5.58 "/>
</svg>

After

Width:  |  Height:  |  Size: 466 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<polygon class="st0" points="1,18.19 12.02,5.58 23.02,18.19 "/>
</svg>

After

Width:  |  Height:  |  Size: 470 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
</svg>

After

Width:  |  Height:  |  Size: 352 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#038FA3;stroke-width:4;stroke-miterlimit:10;}
</style>
<line class="st0" x1="1.79" y1="1.34" x2="22.36" y2="22.66"/>
<line class="st0" x1="1.64" y1="22.51" x2="21.91" y2="1.94"/>
</svg>

After

Width:  |  Height:  |  Size: 578 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-width:4;stroke-miterlimit:10;}
</style>
<line class="st0" x1="1.79" y1="1.34" x2="22.36" y2="22.66"/>
<line class="st0" x1="1.64" y1="22.51" x2="21.91" y2="1.94"/>
</svg>

After

Width:  |  Height:  |  Size: 578 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-miterlimit:10;}
</style>
<polygon class="st0" points="8.75,6.42 15.25,12.21 8.75,17.99 15.25,12.21 "/>
</svg>

After

Width:  |  Height:  |  Size: 517 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-miterlimit:10;}
</style>
<polygon class="st0" points="17.78,8.95 11.99,15.46 6.22,8.95 11.99,15.46 "/>
</svg>

After

Width:  |  Height:  |  Size: 517 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#038FA3;}
</style>
<g>
<path class="st0" d="M1.54,8v16h16V8H1.54z M15.98,22.33H3.22V12h12.76V22.33z"/>
<g>
<polygon class="st0" points="7.06,0 7.06,8 8.73,8 8.73,4 21.49,4 21.49,14.33 17.44,14.33 17.44,16 23.06,16 23.06,0 "/>
<polygon class="st0" points="7.06,12 7.06,16 15.87,16 15.87,14.33 8.73,14.33 8.73,12 "/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 723 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M1.54,8v16h16V8H1.54z M15.98,22.33H3.22V12h12.76V22.33z"/>
<g>
<polygon class="st0" points="7.06,0 7.06,8 8.73,8 8.73,4 21.49,4 21.49,14.33 17.44,14.33 17.44,16 23.06,16 23.06,0 "/>
<polygon class="st0" points="7.06,12 7.06,16 15.87,16 15.87,14.33 8.73,14.33 8.73,12 "/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 723 B

View File

@ -0,0 +1,92 @@
$mainBackgroundColor: #24292e; // Main background color
$backgroundColor1: #394046; // Background color layer 1
$backgroundColor2: #464c53; // Background color layer 2
$backgroundColor3: #5a6067; // Background color layer 3
$backgroundColor4: #89939d; // Background color layer 4
$backgroundColor5: #adbac6; // Background color layer 5
$textColor: #000000; // Main text color
$primaryColor: #018fa3; // Primary color (buttons etc)
$secondaryColor: #e82257; // Secondary color
$tertiaryColor: #ffc50d; // Tertiary color
$quaternaryColor: #36b27e; // Quaternary color
$quinaryColor: #0ce5d5; // Quinary color
$senaryColor: #a54ce5; // Senary color
$borderColor: #394046; // Main border color
$curveColorGas: #2196f3; // Curve color for gas plot
$curveColorOil: #4caf50; // Curve color for oil plot
$markerColor: #e6e7ea; // Marker color
$lineMarkerColor: #eeeeee; // Color of line marker
$plotGridColor: #394046; // Plot grid color
$auxiliaryCurveColor: #000000; // Auxiliary curve color
QwtPlot["*"]::grid["*"] {
color: $backgroundColor2;
}
QwtPlot {
background-color: white;
}
QwtPlot > QWidget {
background-color: white;
}
QwtPlot["PvtPlot"]::curve["Auxiliary"] {
line-color: #ffffff;
}
QwtPlot["PvtPlot"]::curve["Oil"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["PvtPlot"]::curve["Gas"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRW"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROW"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOW"] {
line-color: $tertiaryColor;
symbol-color: $tertiaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRG"] {
line-color: $quaternaryColor;
symbol-color: $quaternaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROG"] {
line-color: $quinaryColor;
symbol-color: $quinaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOG"] {
line-color: $senaryColor;
symbol-color: $senaryColor;
}
QwtPlot["PvtPlot"]::lineMarker["*"] {
color: $textColor;
}
QwtPlot["PvtPlot"]::pointMarker["*"] {
color: $textColor;
}
QMainWindow {
background-color: #ffffff;
}
QToolBar {
background-color: #eeeeee;
}

View File

@ -0,0 +1,327 @@
$mainBackgroundColor: #ffffff; // Main background color
$backgroundColor1: #efefef; // Background color layer 1
$backgroundColor2: #d6d6d6; // Background color layer 2
$backgroundColor3: #848484; // Background color layer 3
$backgroundColor4: #89939d; // Background color layer 4
$backgroundColor5: #adbac6; // Background color layer 5
$textColor: #141719; // Main text color
$primaryColor: #018fa3; // Primary color (buttons etc)
$secondaryColor: #e82257; // Secondary color
$tertiaryColor: #ffc50d; // Tertiary color
$quaternaryColor: #36b27e; // Quaternary color
$quinaryColor: #0ce5d5; // Quinary color
$senaryColor: #a54ce5; // Senary color
$borderColor: #cccccc; // Main border color
$curveColorGas: #2196f3; // Curve color for gas plot
$curveColorOil: #4caf50; // Curve color for oil plot
$markerColor: #e6e7ea; // Marker color
$lineMarkerColor: #eeeeee; // Color of line marker
$plotGridColor: #394046; // Plot grid color
$auxiliaryCurveColor: #000000; // Auxiliary curve color
QwtPlot["*"]::grid["*"] {
color: $backgroundColor2;
}
QwtPlot["*"]::legend {
text-color: $textColor;
}
RiuQwtPlotWidget {
color: $textColor;
}
QwtTextLabel {
color: $textColor;
}
QwtPlot["PvtPlot"]::picker {
text-color: $textColor;
}
QwtPlot["PvtPlot"]::curve["Auxiliary"] {
line-color: #ffffff;
}
QwtPlot["PvtPlot"]::curve["Oil"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["PvtPlot"]::curve["Gas"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRW"] {
line-color: $primaryColor;
symbol-color: $primaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROW"] {
line-color: $secondaryColor;
symbol-color: $secondaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOW"] {
line-color: $tertiaryColor;
symbol-color: $tertiaryColor;
}
QwtPlot["RelPermPlot"]::curve["KRG"] {
line-color: $quaternaryColor;
symbol-color: $quaternaryColor;
}
QwtPlot["RelPermPlot"]::curve["KROG"] {
line-color: $quinaryColor;
symbol-color: $quinaryColor;
}
QwtPlot["RelPermPlot"]::curve["PCOG"] {
line-color: $senaryColor;
symbol-color: $senaryColor;
}
QwtPlot["PvtPlot"]::lineMarker["*"] {
color: $textColor;
}
QwtPlot["PvtPlot"]::pointMarker["*"] {
color: $textColor;
}
QToolBox {
background-color: $mainBackgroundColor;
}
QLabel, QCheckBox {
background-color: transparent;
}
QWidget {
background-color: $mainBackgroundColor;
color: $textColor;
border-color: $borderColor;
}
QProgressBar {
text-align: center;
background-color: $backgroundColor1;
}
QAbstractItemView {
border: 2px solid $borderColor;
border-style: solid;
}
QAbstractItemView::item:hover {
background-color: $primaryColor;
}
QAbstractItemView::item:selected {
background-color: $secondaryColor;
color: $textColor;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(:/themes/dark/collapsed.svg);
width: 12px;
height: 12px;
}
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {
border-image: none;
icon-size: 12px;
}
QDockWidget {
background-color: $mainBackgroundColor;
titlebar-close-icon: url(:/themes/dark/blank.svg);
titlebar-normal-icon: url(:/themes/dark/blank.svg);
}
QDockWidget::title {
background-color: $backgroundColor1;
padding: 5px;
}
QDockWidget::close-button, QDockWidget::float-button {
background: transparent;
border: none;
icon-size: 12px;
padding: 0px;
}
QToolBar QWidget {
background-color: transparent;
border-color: $borderColor;
}
QMenu::item:selected {
background-color: #bbd9f2;
}
QLineEdit, QComboBox, QSpinBox,
QDoubleSpinBox, QDateEdit, QDateTimeEdit, QToolButton {
background-color: $backgroundColor1;
color: $textColor;
border-color: $borderColor;
border-width : 1.5px;
border-style: solid;
padding: 3px;
}
QToolBar QToolButton {
border: none;
}
QToolBar QToolButton:hover {
background-color: $backgroundColor1;
}
QLCDNumber {
color: $textColor;
border-color: $borderColor;
border-width : 1.5px;
border-style: solid;
border-radius: 5px;
}
QPushButton {
color: $textColor;
border-color: $borderColor;
background-color: $backgroundColor1;
border-width: 1.5px;
border-style: solid;
padding: 5px;
font-weight: bold;
}
QTabWidget {
background-color: #535353;
}
QTabWidget::pane {
border-top: 1px solid $backgroundColor3;
background-color: $mainBackgroundColor;
}
QTabBar::tab {
background-color: $backgroundColor1;
border: 1px solid #2C2C2C;
border-bottom: 0px;
border-radius: 1px;
padding: 6px;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background-color: $backgroundColor3;
}
QTabBar::tab:selected {
border-bottom: 0px;
}
QTabBar::tab:!selected {
color: $textColor;
}
/* Scrollbars */
QScrollBar:vertical {
border: 0px;;
background: transparent;
width: 15px;
margin: 0px 0px 0px 0px;
}
QScrollBar:vertical:hover {
background: $backgroundColor2;
}
QScrollBar::handle:vertical {
background: $backgroundColor4;
min-height: 20px;
margin: 3px 3px 3px 3px;
border-radius: 3px;
}
QScrollBar::handle:vertical::hover,
QScrollBar::handle:horizontal::hover {
background: $backgroundColor5;
}
QScrollBar::handle:vertical::pressed,
QScrollBar::handle:horizontal::pressed {
background: white;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical,
QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal {
border: 0px;
height: 0px;
}
QScrollBar::up-arrow:vertical,
QScrollBar::down-arrow:vertical,
QScrollBar::down-arrow:horizontal,
QScrollBar::up-arrow:horizontal {
border: 0px;
background: none;
}
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
background: none;
}
QScrollBar:horizontal {
border: 0px;
background: transparent;
height: 15px;
margin: 0px 0px 0px 0px;
}
QScrollBar:horizontal:hover {
background: $backgroundColor2;
}
QScrollBar::handle:horizontal {
background: $backgroundColor4;
min-width: 20px;
margin: 3px 3px 3px 3px;
border-radius: 3px;
}
QFrame#FramedGroupContent {
background-color: $mainBackgroundColor;
border-top: 1px solid $borderColor;
}
QFrame#GroupTitleFrame QToolButton {
padding: 3px;
}
QMinimizePanel {
qproperty-background: $mainBackgroundColor;
qproperty-titleBackground: $backgroundColor2;
qproperty-border: $borderColor;
qproperty-iconSize: 8px;
border: 2px solid $backgroundColor2;
}
QMinimizePanel QLabel, QMinimizePanel QCheckBox {
background-color: transparent;
}
QTextEdit, QPlainTextEdit {
border: 2px solid $borderColor;
}

View File

@ -0,0 +1,133 @@
:!pressed
::down-arrow
::drop-down
:checked
:enabled
:hover
:pressed
absolute
background
background-color
border
border-bottom
border-bottom-color
border-bottom-radius
border-bottom-style
border-bottom-width
border-left
border-left-color
border-left-radius
border-left-style
border-left-width
border-radius
border-right
border-right-color
border-right-radius
border-right-style
border-right-width
border-style
border-top
border-top-color
border-top-radius
border-top-style
border-top-width
border-width
color
font-family
font-size
font-style
font-weight
image
justify
left
margin
margin-bottom
margin-left
margin-right
margin-top
outline
outline-color
outline-radius
outline-radius-bottomLeft
outline-radius-bottomRight
outline-radius-topLeft
outline-radius-topRight
outline-style
padding
padding-bottom
padding-left
padding-right
padding-top
position
QAbstractButton
QAbstractItemDelegate
QAbstractItemView
QAbstractScrollArea
QAbstractSlider
QAbstractSpinBox
QButtonGroup
QCalendarWidget
QCheckBox
QColumnView
QComboBox
QCommandLinkButton
QDataWidgetMapper
QDateEdit
QDateTimeEdit
QDial
QDialog
QDockWidget
QDoubleSpinBox
QFocusFrame
QFontComboBox
QFrame
QGroupBox
QHeaderView
QItemDelegate
QLabel
QLCDNumber
QLineEdit
QListView
QListWidget
QListWidgetItem
QMacCocoaViewContainer
QMacNativeWidget
QMainWindow
QMdiArea
QMdiSubWindow
QMenu
QProgressBar
qproperty-
QPushButton
QRadioButton
QScrollArea
QScrollBar
QSizeGrip
QSlider
QSpinBox
QSplitter
QSplitterHandle
QStackedWidget
QStandardItem
QStatusBar
QStyledItemDelegate
QTabBar
QTableView
QTableWidget
QTableWidgetItem
QTabWidget
QTimeEdit
QToolBar
QToolBox
QToolButton
QTreeView
QTreeWidget
QTreeWidgetItem
QUndoView
QWidget
relative
rgb
right
subcontrol-origin
text-align
top

View File

@ -0,0 +1,3 @@
// Test data directory used by unit tests
#define GUI_THEMES_DIR "${CMAKE_CURRENT_LIST_DIR}/Resources/themes"

View File

@ -93,6 +93,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuAbstractLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuCategoryLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuScalarMapperLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -185,6 +186,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuAbstractLegendFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuCategoryLegendFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuScalarMapperLegendFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.cpp
)
list(APPEND CODE_HEADER_FILES
@ -240,6 +244,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuAbstractOverlayContentFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuAbstractLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuCategoryLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuScalarMapperLegendFrame.h
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.h
${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.h
)
list(APPEND QT_UI_FILES

View File

@ -140,9 +140,9 @@ RiuFlowCharacteristicsPlot::RiuFlowCharacteristicsPlot( RimFlowCharacteristicsPl
void RiuFlowCharacteristicsPlot::addWindowZoom( QwtPlot* plot )
{
auto zoomer = new RiuQwtPlotZoomer( plot->canvas() );
zoomer->setRubberBandPen( QColor( Qt::black ) );
// zoomer->setRubberBandPen( QColor( Qt::black ) );
zoomer->setTrackerMode( QwtPicker::AlwaysOff );
zoomer->setTrackerPen( QColor( Qt::black ) );
// zoomer->setTrackerPen( QColor( Qt::black ) );
zoomer->initMousePattern( 1 );
}
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,916 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuGuiTheme.h"
#include "RiuThemesDirectory.h"
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "cafAppEnum.h"
#include <QAbstractItemModel>
#include <QColor>
#include <QCompleter>
#include <QFile>
#include <QFileInfo>
#include <QIODevice>
#include <QRegExp>
#include <QRegularExpression>
#include <QString>
#include <QStringListModel>
#include <QStyle>
#include <QWidget>
#include "qwt_legend_label.h"
#include "qwt_picker.h"
#include "qwt_plot.h"
#include "qwt_plot_curve.h"
#include "qwt_plot_grid.h"
#include "qwt_plot_marker.h"
#include "qwt_symbol.h"
namespace caf
{
template <>
void caf::AppEnum<RiuGuiTheme::ThemeEnum>::setUp()
{
addItem( RiuGuiTheme::ThemeEnum::DEFAULT, "DEFAULT", "Default theme" );
addItem( RiuGuiTheme::ThemeEnum::DARK, "DARK", "Dark theme" );
addItem( RiuGuiTheme::ThemeEnum::LIGHT, "LIGHT", "Light theme" );
setDefault( RiuGuiTheme::ThemeEnum::DEFAULT );
}
} // End namespace caf
QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableValueMap = {};
QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableGuiTextMap = {};
QMap<QString, QMap<QString, QMap<QString, QMap<QString, QString>>>> RiuGuiTheme::s_qwtPlotItemPropertiesMap = {};
QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme::s_customStyleSheetApplicators =
{ { QString(
"QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::curve\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((line-color|symbol-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression lineColorRegExp( "line-color:\\s*([#0-9a-zA-Z]+)" );
QString lineColor = lineColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
QRegularExpression symbolColorRegExp( "symbol-color:\\s*([#0-9a-zA-Z]+)" );
QString symbolColor = symbolColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
if ( !lineColor.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "curve" ),
match.captured( "itemName" ),
"line-color",
lineColor );
}
if ( !symbolColor.isEmpty() )
{
// Symbols get the same color assigned as curves.
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "curve" ),
match.captured( "itemName" ),
"symbol-color",
symbolColor );
}
if ( lineColor.isEmpty() && symbolColor.isEmpty() ) return;
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) )
{
for ( QwtPlotItem* item : plotWidget->itemList() )
{
if ( QwtPlotCurve* curve = dynamic_cast<QwtPlotCurve*>( item ) )
{
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
match.captured( "itemName" ) == "*" )
{
QPen pen = curve->pen();
pen.setColor( QColor( lineColor ) );
curve->setPen( pen );
if ( curve->symbol() && curve->symbol()->style() != QwtSymbol::NoSymbol )
{
QPen pen = curve->symbol()->pen();
pen.setColor( QColor( symbolColor ) );
QwtSymbol* symbol = cloneCurveSymbol( curve );
symbol->setPen( pen );
curve->setSymbol( symbol );
}
}
}
}
}
plotWidget->replot();
}
}
} },
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::grid\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
if ( !color.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "grid" ),
match.captured( "itemName" ),
"color",
color );
}
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ||
match.captured( "plotName" ) == "*" )
{
for ( QwtPlotItem* item : plotWidget->itemList() )
{
if ( QwtPlotGrid* grid = dynamic_cast<QwtPlotGrid*>( item ) )
{
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
match.captured( "itemName" ) == "*" )
{
QPen pen = grid->majorPen();
pen.setColor( QColor( color ) );
grid->setPen( pen );
}
}
}
}
plotWidget->replot();
}
}
} },
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::legend\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
if ( !color.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "legend" ),
match.captured( "itemName" ),
"text-color",
color );
}
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ||
match.captured( "plotName" ) == "*" )
{
for ( QwtLegendLabel* label : plotWidget->findChildren<QwtLegendLabel*>() )
{
QwtText text = label->text();
text.setColor( QColor( color ) );
label->setText( text );
label->repaint();
}
}
plotWidget->replot();
}
}
} },
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::lineMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
QString textColor = textColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
if ( !color.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "lineMarker" ),
match.captured( "itemName" ),
"color",
color );
}
if ( !textColor.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "lineMarker" ),
match.captured( "itemName" ),
"text-color",
textColor );
}
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ||
match.captured( "plotName" ) == "*" )
{
for ( QwtPlotItem* item : plotWidget->itemList() )
{
if ( QwtPlotMarker* marker = dynamic_cast<QwtPlotMarker*>( item ) )
{
if ( marker->symbol() == nullptr || marker->symbol()->style() == QwtSymbol::NoSymbol )
{
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
match.captured( "itemName" ) == "*" )
{
QPen pen = marker->linePen();
pen.setColor( QColor( color ) );
marker->setLinePen( pen );
marker->label().setColor( QColor( textColor ) );
}
}
}
}
}
plotWidget->replot();
}
}
} },
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::pointMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
QString textColor = textColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
if ( !color.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "pointMarker" ),
match.captured( "itemName" ),
"color",
color );
}
if ( !textColor.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ),
QString( "pointMarker" ),
match.captured( "itemName" ),
"text-color",
textColor );
}
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ||
match.captured( "plotName" ) == "*" )
{
for ( QwtPlotItem* item : plotWidget->itemList() )
{
if ( QwtPlotMarker* marker = dynamic_cast<QwtPlotMarker*>( item ) )
{
if ( marker->symbol() && marker->symbol()->style() != QwtSymbol::NoSymbol )
{
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
match.captured( "itemName" ) == "*" )
{
QPen pen = marker->symbol()->pen();
pen.setColor( QColor( color ) );
QwtSymbol* symbol = cloneMarkerSymbol( marker );
symbol->setPen( pen );
marker->setSymbol( symbol );
marker->label().setColor( QColor( textColor ) );
}
}
}
}
}
plotWidget->replot();
}
}
} },
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::picker"
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression textColorRegExp( "text-color:\\s*([#a-zA-Z0-9]+)" );
QString textColor = textColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->topLevelWidgets();
if ( !textColor.isEmpty() )
{
storeQwtStyleSheetProperty( match.captured( "plotName" ), QString( "picker" ), "*", "text-color", textColor );
}
for ( QWidget* widget : topLevelWidgets )
{
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
{
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) ||
match.captured( "plotName" ) == "*" )
{
QWidget* canvas = plotWidget->canvas();
if ( canvas )
{
for ( QwtPicker* picker : canvas->findChildren<QwtPicker*>() )
{
QPen pen = picker->trackerPen();
pen.setColor( QColor( textColor ) );
picker->setTrackerPen( pen );
}
}
}
plotWidget->replot();
}
}
} } };
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::updateGuiTheme( ThemeEnum theme )
{
s_qwtPlotItemPropertiesMap.clear();
applyStyleSheet( theme );
const QWidgetList allWidgets = RiaGuiApplication::instance()->allWidgets();
for ( QWidget* widget : allWidgets )
{
widget->style()->unpolish( widget );
widget->style()->polish( widget );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuGuiTheme::applyStyleSheet( ThemeEnum theme )
{
QString styleSheetPath = getStyleSheetPath( theme );
QFile styleSheetFile( styleSheetPath );
if ( styleSheetFile.exists() )
{
if ( styleSheetFile.open( QIODevice::ReadOnly ) )
{
RiaGuiApplication* app = RiaGuiApplication::instance();
QString styleSheet = styleSheetFile.readAll();
preparseStyleSheet( theme, styleSheet );
app->setStyleSheet( styleSheet );
styleSheetFile.close();
}
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::changeVariableValue( RiuGuiTheme::ThemeEnum theme, const QString& variableName, const QString& newValue )
{
if ( !s_variableValueMap.keys().contains( theme ) )
{
s_variableValueMap.insert( theme, {} );
}
if ( !s_variableValueMap[theme].keys().contains( variableName ) )
{
s_variableValueMap[theme].insert( variableName, newValue );
}
else
{
s_variableValueMap[theme][variableName] = newValue;
}
}
QMap<QString, QString> RiuGuiTheme::getVariableValueMap( RiuGuiTheme::ThemeEnum theme )
{
if ( !s_variableValueMap.keys().contains( theme ) )
{
QFile styleSheetFile( getStyleSheetPath( theme ) );
if ( styleSheetFile.exists() )
{
if ( styleSheetFile.open( QIODevice::ReadOnly ) )
{
QString styleSheet = styleSheetFile.readAll();
preparseStyleSheet( theme, styleSheet );
styleSheetFile.close();
return s_variableValueMap[theme];
}
}
return QMap<QString, QString>();
}
else
{
return s_variableValueMap[theme];
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QMap<QString, QString> RiuGuiTheme::getVariableGuiTextMap( RiuGuiTheme::ThemeEnum theme )
{
if ( !s_variableGuiTextMap.keys().contains( theme ) )
{
QFile styleSheetFile( getStyleSheetPath( theme ) );
if ( styleSheetFile.exists() )
{
if ( styleSheetFile.open( QIODevice::ReadOnly ) )
{
QString styleSheet = styleSheetFile.readAll();
preparseStyleSheet( theme, styleSheet );
styleSheetFile.close();
return s_variableGuiTextMap[theme];
}
}
return QMap<QString, QString>();
}
else
{
return s_variableGuiTextMap[theme];
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuGuiTheme::applyVariableValueMapToStyleSheet( RiuGuiTheme::ThemeEnum theme )
{
QFileInfo info( getStyleSheetPath( theme ) );
QString absoluteStyleSheetPath = QString( "%0/%1" ).arg( GUI_THEMES_DIR ).arg( info.fileName() );
QFile styleSheetFile( absoluteStyleSheetPath );
if ( styleSheetFile.exists() )
{
QString styleSheet;
if ( styleSheetFile.open( QIODevice::ReadOnly | QIODevice::Truncate | QIODevice::Text ) )
{
styleSheet = styleSheetFile.readAll();
QRegularExpression variableRegExp( "(?<prefix>[ \\t]*(?<name>\\$[a-zA-z0-9_]+)[ \\t]*:[ "
"\\t]*)(?<value>[a-zA-Z-_0-9#]+)(?<suffix>;[ \\t]*(\\/\\/[ "
"\\t]*(?<descriptor>(.*)))?)" );
QRegularExpressionMatchIterator matchIterator = variableRegExp.globalMatch( styleSheet );
while ( matchIterator.hasNext() )
{
QRegularExpressionMatch match = matchIterator.next();
styleSheet.replace( match.captured( 0 ),
QString( "%0%1%2" )
.arg( match.captured( "prefix" ) )
.arg( s_variableValueMap[theme].value( match.captured( "name" ) ) )
.arg( match.captured( "suffix" ) ) );
}
styleSheetFile.close();
}
if ( styleSheetFile.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) )
{
styleSheetFile.write( styleSheet.toLatin1() );
return styleSheet;
}
}
return QString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuGuiTheme::writeStyleSheetToFile( RiuGuiTheme::ThemeEnum theme, const QString& styleSheet )
{
QFileInfo info( getStyleSheetPath( theme ) );
QString absoluteStyleSheetPath = QString( "%0/%1" ).arg( GUI_THEMES_DIR ).arg( info.fileName() );
QFile styleSheetFile( absoluteStyleSheetPath );
if ( styleSheetFile.exists() )
{
if ( styleSheetFile.open( QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text ) )
{
styleSheetFile.write( styleSheet.toLatin1() );
styleSheetFile.close();
QString modifiedStyleSheet = styleSheet;
preparseStyleSheet( theme, modifiedStyleSheet );
RiaGuiApplication* app = RiaGuiApplication::instance();
app->setStyleSheet( modifiedStyleSheet );
const QWidgetList topLevelWidgets = RiaGuiApplication::instance()->allWidgets();
for ( QWidget* widget : topLevelWidgets )
{
widget->style()->unpolish( widget );
widget->style()->polish( widget );
}
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuGuiTheme::loadStyleSheet( RiuGuiTheme::ThemeEnum theme )
{
QFile styleSheetFile( getStyleSheetPath( theme ) );
QString styleSheet;
if ( styleSheetFile.exists() )
{
if ( styleSheetFile.open( QIODevice::ReadOnly ) )
{
styleSheet = styleSheetFile.readAll();
}
}
return styleSheet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QAbstractItemModel* RiuGuiTheme::getQssCompletionModel( QCompleter* completer )
{
QFile file( ":utility/qss-keywords.txt" );
if ( !file.open( QFile::ReadOnly ) ) return new QStringListModel( completer );
QStringList words;
while ( !file.atEnd() )
{
QByteArray line = file.readLine();
if ( !line.isEmpty() ) words << QString::fromUtf8( line.trimmed() );
}
return new QStringListModel( words, completer );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RiuGuiTheme::getColorByVariableName( const QString& variable, int theme /*= -1 */ )
{
RiuGuiTheme::ThemeEnum eTheme = RiaGuiApplication::instance()->preferences()->guiTheme();
if ( theme >= 0 && theme < static_cast<int>( caf::AppEnum<RiuGuiTheme::ThemeEnum>().size() ) )
{
eTheme = static_cast<RiuGuiTheme::ThemeEnum>( theme );
}
if ( s_variableValueMap.keys().contains( eTheme ) && s_variableValueMap[eTheme].keys().contains( "$" + variable ) )
{
return QColor( s_variableValueMap[eTheme]["$" + variable] );
}
return Qt::black;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuGuiTheme::getQwtStyleSheetProperty( QString plotName,
const QString& itemType,
QString itemName,
const QString& propertyName )
{
if ( !s_qwtPlotItemPropertiesMap.keys().contains( plotName ) )
{
if ( !s_qwtPlotItemPropertiesMap.keys().contains( "*" ) )
{
return QString();
}
else
{
plotName = "*";
}
}
if ( !s_qwtPlotItemPropertiesMap[plotName].keys().contains( itemType ) )
{
if ( s_qwtPlotItemPropertiesMap.keys().contains( "*" ) &&
s_qwtPlotItemPropertiesMap["*"].keys().contains( itemType ) )
{
plotName = "*";
}
else
{
return QString();
}
}
if ( !s_qwtPlotItemPropertiesMap[plotName][itemType].keys().contains( itemName ) )
{
if ( !s_qwtPlotItemPropertiesMap[plotName][itemType].keys().contains( "*" ) )
{
if ( s_qwtPlotItemPropertiesMap.keys().contains( "*" ) &&
s_qwtPlotItemPropertiesMap["*"].keys().contains( itemType ) &&
s_qwtPlotItemPropertiesMap["*"][itemType].keys().contains( "*" ) )
{
plotName = "*";
itemName = "*";
}
else
{
return QString();
}
}
else
{
itemName = "*";
}
}
return s_qwtPlotItemPropertiesMap[plotName][itemType][itemName].value( propertyName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::styleQwtItem( QwtPlotItem* item )
{
QwtPlot* plot = item->plot();
QString plotName;
if ( plot && plot->property( "qss-class" ).isValid() )
{
plotName = plot->property( "qss-class" ).toString();
}
if ( QwtPlotCurve* curve = dynamic_cast<QwtPlotCurve*>( item ) )
{
QPen pen = curve->pen();
QString color = getQwtStyleSheetProperty( plotName, "curve", curve->title().text(), "line-color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
curve->setPen( pen );
if ( curve->symbol() && curve->symbol()->style() != QwtSymbol::NoSymbol )
{
pen = curve->symbol()->pen();
QString symbolColor = getQwtStyleSheetProperty( plotName, "curve", curve->title().text(), "symbol-color" );
if ( !color.isEmpty() ) pen.setColor( QColor( symbolColor ) );
QwtSymbol* symbol = cloneCurveSymbol( curve );
symbol->setPen( pen );
curve->setSymbol( symbol );
}
}
else if ( QwtPlotGrid* grid = dynamic_cast<QwtPlotGrid*>( item ) )
{
QPen pen = grid->majorPen();
QString color = getQwtStyleSheetProperty( plotName, "grid", grid->title().text(), "color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
grid->setPen( pen );
}
else if ( QwtPlotMarker* marker = dynamic_cast<QwtPlotMarker*>( item ) )
{
if ( marker->symbol() == nullptr || marker->symbol()->style() == QwtSymbol::NoSymbol )
{
QPen pen = marker->linePen();
QString color = getQwtStyleSheetProperty( plotName, "lineMarker", marker->title().text(), "color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
marker->setLinePen( pen );
QString textColor = getQwtStyleSheetProperty( plotName, "lineMarker", marker->title().text(), "text-color" );
if ( !textColor.isEmpty() ) marker->label().setColor( QColor( textColor ) );
}
else
{
QwtSymbol* symbol = cloneMarkerSymbol( marker );
QPen pen = symbol->pen();
QString color = getQwtStyleSheetProperty( plotName, "pointMarker", marker->title().text(), "color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
symbol->setPen( pen );
marker->setSymbol( symbol );
QString textColor = getQwtStyleSheetProperty( plotName, "pointMarker", marker->title().text(), "text-color" );
if ( !textColor.isEmpty() ) marker->label().setColor( QColor( textColor ) );
}
}
else if ( QwtPlotMarker* marker = dynamic_cast<QwtPlotMarker*>( item ) )
{
if ( marker->symbol() == nullptr || marker->symbol()->style() == QwtSymbol::NoSymbol )
{
QPen pen = marker->linePen();
QString color = getQwtStyleSheetProperty( plotName, "lineMarker", marker->title().text(), "color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
marker->setLinePen( pen );
QString textColor = getQwtStyleSheetProperty( plotName, "lineMarker", marker->title().text(), "text-color" );
if ( !textColor.isEmpty() ) marker->label().setColor( QColor( textColor ) );
}
else
{
QwtSymbol* symbol = cloneMarkerSymbol( marker );
QPen pen = symbol->pen();
QString color = getQwtStyleSheetProperty( plotName, "pointMarker", marker->title().text(), "color" );
if ( !color.isEmpty() ) pen.setColor( QColor( color ) );
symbol->setPen( pen );
marker->setSymbol( symbol );
QString textColor = getQwtStyleSheetProperty( plotName, "pointMarker", marker->title().text(), "text-color" );
if ( !textColor.isEmpty() ) marker->label().setColor( QColor( textColor ) );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::styleQwtItem( QwtPicker* item )
{
QWidget* canvas = item->parentWidget();
if ( canvas )
{
QwtPlot* plot = dynamic_cast<QwtPlot*>( canvas->parentWidget() );
if ( plot )
{
QString plotName;
if ( plot && plot->property( "qss-class" ).isValid() )
{
plotName = plot->property( "qss-class" ).toString();
}
QPen pen = item->trackerPen();
QString textColor = getQwtStyleSheetProperty( plotName, "picker", "*", "text-color" );
if ( !textColor.isEmpty() ) pen.setColor( QColor( textColor ) );
item->setTrackerPen( pen );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::preparseStyleSheet( RiuGuiTheme::ThemeEnum theme, QString& styleSheet )
{
QRegularExpression variableRegExp(
"[ \\t]*(?<name>\\$[a-zA-z0-9_]+)[ \\t]*:[ \\t]*(?<value>[a-zA-Z-_0-9#]+);[ \\t]*(\\/\\/[ "
"\\t]*(?<descriptor>(.*)))?" );
QRegularExpressionMatchIterator matchIterator = variableRegExp.globalMatch( styleSheet );
if ( !s_variableValueMap.keys().contains( theme ) )
{
s_variableValueMap.insert( theme, {} );
}
else
{
s_variableValueMap[theme].clear();
}
while ( matchIterator.hasNext() )
{
QRegularExpressionMatch match = matchIterator.next();
styleSheet.replace( match.captured( 0 ), "" );
if ( s_variableValueMap[theme].keys().contains( match.captured( "name" ) ) )
{
styleSheet.replace( match.captured( "name" ), s_variableValueMap[theme].value( match.captured( "name" ) ) );
}
else
{
styleSheet.replace( match.captured( "name" ), match.captured( "value" ) );
s_variableValueMap[theme].insert( match.captured( "name" ), match.captured( "value" ) );
s_variableGuiTextMap[theme].insert( match.captured( "name" ), match.captured( "descriptor" ) );
}
}
QMap<QString, CustomStyleSheetApplicator>::iterator applicatorIterator;
for ( applicatorIterator = s_customStyleSheetApplicators.begin();
applicatorIterator != s_customStyleSheetApplicators.end();
applicatorIterator++ )
{
matchIterator = QRegularExpression( applicatorIterator.key() ).globalMatch( styleSheet );
while ( matchIterator.hasNext() )
{
QRegularExpressionMatch match = matchIterator.next();
applicatorIterator.value()( match );
styleSheet.replace( match.captured( 0 ), "" );
}
}
styleSheet = styleSheet.simplified();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuGuiTheme::getStyleSheetPath( ThemeEnum theme )
{
return QString( ":/themes/%0.qss" ).arg( caf::AppEnum<RiuGuiTheme::ThemeEnum>( theme ).text().toLower() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGuiTheme::storeQwtStyleSheetProperty( const QString& plotName,
const QString& itemType,
const QString& itemName,
const QString& propertyName,
const QString& value )
{
if ( !s_qwtPlotItemPropertiesMap.keys().contains( plotName ) )
{
s_qwtPlotItemPropertiesMap.insert( plotName, QMap<QString, QMap<QString, QMap<QString, QString>>>{} );
}
if ( !s_qwtPlotItemPropertiesMap[plotName].keys().contains( itemType ) )
{
s_qwtPlotItemPropertiesMap[plotName].insert( itemType, QMap<QString, QMap<QString, QString>>{} );
}
if ( !s_qwtPlotItemPropertiesMap[plotName][itemType].keys().contains( itemName ) )
{
s_qwtPlotItemPropertiesMap[plotName][itemType].insert( itemName, QMap<QString, QString>{} );
}
s_qwtPlotItemPropertiesMap[plotName][itemType][itemName].insert( propertyName, value );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Qt::PenStyle RiuGuiTheme::getPenStyleFromString( const QString& style )
{
if ( style == "solid" )
{
return Qt::PenStyle::SolidLine;
}
else if ( style == "dash" )
{
return Qt::PenStyle::DashLine;
}
else if ( style == "dot" )
{
return Qt::PenStyle::DotLine;
}
else if ( style == "dash-dot" )
{
return Qt::PenStyle::DashDotLine;
}
else if ( style == "dash-dot-dot" )
{
return Qt::PenStyle::DashDotDotLine;
}
else
{
return Qt::PenStyle::NoPen;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtSymbol* RiuGuiTheme::cloneMarkerSymbol( QwtPlotMarker* marker )
{
QwtSymbol* symbol = new QwtSymbol();
symbol->setBrush( marker->symbol()->brush() );
symbol->setPen( marker->symbol()->pen() );
symbol->setStyle( marker->symbol()->style() );
if ( marker->symbol()->style() == QwtSymbol::Style::Pixmap )
{
symbol->setPixmap( marker->symbol()->pixmap() );
}
else if ( marker->symbol()->style() == QwtSymbol::Style::Graphic )
{
symbol->setGraphic( marker->symbol()->graphic() );
}
symbol->setSize( marker->symbol()->size() );
symbol->setPinPoint( marker->symbol()->pinPoint() );
return symbol;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtSymbol* RiuGuiTheme::cloneCurveSymbol( QwtPlotCurve* curve )
{
QwtSymbol* symbol = new QwtSymbol();
symbol->setBrush( curve->symbol()->brush() );
symbol->setPen( curve->symbol()->pen() );
symbol->setStyle( curve->symbol()->style() );
if ( curve->symbol()->style() == QwtSymbol::Style::Pixmap )
{
symbol->setPixmap( curve->symbol()->pixmap() );
}
else if ( curve->symbol()->style() == QwtSymbol::Style::Graphic )
{
symbol->setGraphic( curve->symbol()->graphic() );
}
symbol->setSize( curve->symbol()->size() );
symbol->setPinPoint( curve->symbol()->pinPoint() );
return symbol;
}

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <functional>
#include <QMap>
#include <QPen>
class QWidget;
class QAbstractItemModel;
class QCompleter;
class QColor;
class QRegularExpressionMatch;
class QString;
class QwtPlotItem;
class QwtSymbol;
class QwtPlotMarker;
class QwtPlotCurve;
class QwtPicker;
typedef std::function<void( QRegularExpressionMatch& )> CustomStyleSheetApplicator;
class RiuGuiTheme
{
public:
enum class ThemeEnum
{
DEFAULT,
DARK,
LIGHT
};
static void updateGuiTheme( ThemeEnum theme );
static bool applyStyleSheet( ThemeEnum theme );
static void changeVariableValue( RiuGuiTheme::ThemeEnum theme, const QString& variableName, const QString& newValue );
static QMap<QString, QString> getVariableValueMap( RiuGuiTheme::ThemeEnum theme );
static QMap<QString, QString> getVariableGuiTextMap( RiuGuiTheme::ThemeEnum theme );
static QString applyVariableValueMapToStyleSheet( RiuGuiTheme::ThemeEnum theme );
static bool writeStyleSheetToFile( RiuGuiTheme::ThemeEnum theme, const QString& styleSheet );
static QString loadStyleSheet( RiuGuiTheme::ThemeEnum theme );
static QAbstractItemModel* getQssCompletionModel( QCompleter* completer );
static QColor getColorByVariableName( const QString& variable, int theme = -1 );
static QString
getQwtStyleSheetProperty( QString plotName, const QString& itemType, QString itemName, const QString& propertyName );
static void styleQwtItem( QwtPlotItem* item );
static void styleQwtItem( QwtPicker* item );
private:
static void preparseStyleSheet( RiuGuiTheme::ThemeEnum theme, QString& styleSheet );
static QString getStyleSheetPath( RiuGuiTheme::ThemeEnum theme );
static void storeQwtStyleSheetProperty( const QString& plotName,
const QString& itemType,
const QString& itemName,
const QString& propertyName,
const QString& value );
static Qt::PenStyle getPenStyleFromString( const QString& style );
static QwtSymbol* cloneMarkerSymbol( QwtPlotMarker* marker );
static QwtSymbol* cloneCurveSymbol( QwtPlotCurve* curve );
private:
static QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> s_variableValueMap;
static QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> s_variableGuiTextMap;
static QMap<QString, QMap<QString, QMap<QString, QMap<QString, QString>>>> s_qwtPlotItemPropertiesMap;
static QMap<QString, CustomStyleSheetApplicator> s_customStyleSheetApplicators;
};

View File

@ -530,6 +530,10 @@ void RiuMainWindow::createMenus()
testMenu->addAction( cmdFeatureMgr->action( "RicHoloLensExportToFolderFeature" ) );
testMenu->addAction( cmdFeatureMgr->action( "RicHoloLensCreateDummyFiledBackedSessionFeature" ) );
testMenu->addSeparator();
testMenu->addAction( cmdFeatureMgr->action( "RicThemeColorEditorFeature" ) );
// Windows menu
m_windowMenu = menuBar()->addMenu( "&Windows" );
connect( m_windowMenu, SIGNAL( aboutToShow() ), SLOT( slotBuildWindowActions() ) );
@ -1730,8 +1734,7 @@ void RiuMainWindow::updateMemoryUsage()
if ( availVirtualFraction < caf::MemoryInspector::getRemainingMemoryCriticalThresholdFraction() )
{
m_memoryCriticalWarning->setText( QString( "Available System Memory Critically Low!" ) );
m_memoryCriticalWarning->setStyleSheet(
QString( "QLabel {color: %1; padding: 0px 5px 0px 0px;}" ).arg( criticalColor.name() ) );
m_memoryCriticalWarning->setProperty( "styleRole", "memoryCriticalWarning" );
}
else
{
@ -1739,10 +1742,11 @@ void RiuMainWindow::updateMemoryUsage()
}
m_memoryUsedButton->setText( QString( "Memory Used: %1 MiB" ).arg( currentUsage ) );
m_memoryUsedButton->setProperty( "styleRole", "memoryUsedButton" );
m_memoryTotalStatus->setText( QString( "Total Physical Memory: %1 MiB" ).arg( totalPhysicalMemory ) );
m_memoryTotalStatus->setProperty( "styleRole", "memoryTotalStatus" );
m_memoryUsedButton->setStyleSheet( QString( "QLabel {color: %1; padding: 0px 5px 0px 0px;}" ).arg( usageColor.name() ) );
m_memoryTotalStatus->setStyleSheet( QString( "QLabel {padding: 0px 5px 0px 0px; }" ) );
m_memoryUsedButton->setStyleSheet( QString( "QLabel {color: %1;}" ).arg( usageColor.name() ) );
}
//--------------------------------------------------------------------------------------------------

View File

@ -55,7 +55,7 @@ RiuMessagePanel::RiuMessagePanel( QDockWidget* parent )
//--------------------------------------------------------------------------------------------------
void RiuMessagePanel::addMessage( RILogLevel messageLevel, const QString& msg )
{
QColor clr( Qt::black );
QColor clr = palette().color( QPalette::ColorRole::Text );
if ( messageLevel == RILogLevel::RI_LL_ERROR )
clr = Qt::red;
else if ( messageLevel == RILogLevel::RI_LL_WARNING )

View File

@ -70,7 +70,7 @@ RiuProjectAndPropertyView::RiuProjectAndPropertyView( QWidget* parent, Qt::Windo
{
QLabel* propertyHeader = new QLabel;
propertyHeader->setText( "Property Editor" );
propertyHeader->setStyleSheet( "QLabel { background-color: #CCCCCC }" );
// propertyHeader->setStyleSheet( "QLabel { background-color: #CCCCCC }" );
propertyHeader->setFixedHeight( 20 );
QVBoxLayout* layout = new QVBoxLayout;

View File

@ -19,6 +19,7 @@
#include "RiuPvtPlotPanel.h"
#include "RiuDockedQwtPlot.h"
#include "RiuGuiTheme.h"
#include "RiuPvtPlotUpdater.h"
#include "RigFlowDiagSolverInterface.h"
@ -101,6 +102,7 @@ RiuPvtPlotWidget::RiuPvtPlotWidget( RiuPvtPlotPanel* parent )
, m_trackerPlotMarker( nullptr )
{
m_qwtPlot = new PvtQwtPlot( this );
m_qwtPlot->setProperty( "qss-class", "PvtPlot" );
setPlotDefaults( m_qwtPlot );
applyFontSizes( false );
@ -112,6 +114,7 @@ RiuPvtPlotWidget::RiuPvtPlotWidget( RiuPvtPlotPanel* parent )
setLayout( layout );
m_qwtPicker = new RiuPvtQwtPicker( m_qwtPlot, this );
RiuGuiTheme::styleQwtItem( m_qwtPicker );
connect( m_qwtPicker, SIGNAL( activated( bool ) ), this, SLOT( slotPickerActivated( bool ) ) );
connect( m_qwtPicker, SIGNAL( moved( const QPoint& ) ), this, SLOT( slotPickerPointChanged( const QPoint& ) ) );
}
@ -121,13 +124,7 @@ RiuPvtPlotWidget::RiuPvtPlotWidget( RiuPvtPlotPanel* parent )
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotWidget::setPlotDefaults( QwtPlot* plot )
{
// Plot background and frame look
QPalette newPalette( plot->palette() );
newPalette.setColor( QPalette::Window, Qt::white );
plot->setPalette( newPalette );
plot->setAutoFillBackground( true );
plot->setCanvasBackground( Qt::white );
QFrame* canvasFrame = dynamic_cast<QFrame*>( plot->canvas() );
if ( canvasFrame )
@ -139,9 +136,7 @@ void RiuPvtPlotWidget::setPlotDefaults( QwtPlot* plot )
{
QwtPlotGrid* grid = new QwtPlotGrid;
grid->attach( plot );
QPen gridPen( Qt::SolidLine );
gridPen.setColor( Qt::lightGray );
grid->setPen( gridPen );
RiuGuiTheme::styleQwtItem( grid );
}
// Axis number font
@ -215,48 +210,50 @@ void RiuPvtPlotWidget::plotCurves( RiaEclipseUnitTools::UnitSystem
if ( xVals.size() > 1 )
{
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
QwtPlotCurve* qwtCurve = new QwtPlotCurve( "Auxiliary" );
qwtCurve->setSamples( xVals.data(), yVals.data(), static_cast<int>( xVals.size() ) );
qwtCurve->setStyle( QwtPlotCurve::Lines );
qwtCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QColor curveClr = Qt::darkGreen;
const QPen curvePen( curveClr );
qwtCurve->setPen( curvePen );
qwtCurve->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( qwtCurve );
}
}
// Add the primary curves
for ( size_t i = 0; i < curveArr.size(); i++ )
{
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
QwtSymbol* curveSymbol = new QwtSymbol( QwtSymbol::Ellipse );
CVF_ASSERT( curve.pressureVals.size() == curve.yVals.size() );
qwtCurve->setSamples( curve.pressureVals.data(), curve.yVals.data(), static_cast<int>( curve.pressureVals.size() ) );
qwtCurve->setStyle( QwtPlotCurve::Lines );
QColor curveClr = Qt::magenta;
if ( curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS )
curveClr = QColor( Qt::red );
{
qwtCurve->setTitle( "Gas" );
}
else if ( curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL )
curveClr = QColor( Qt::green );
const QPen curvePen( curveClr );
qwtCurve->setPen( curvePen );
{
qwtCurve->setTitle( "Oil" );
}
else
{
qwtCurve->setTitle( "Undefined" );
}
qwtCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol* curveSymbol = new QwtSymbol( QwtSymbol::Ellipse );
curveSymbol->setSize( 6, 6 );
curveSymbol->setPen( curvePen );
curveSymbol->setBrush( Qt::NoBrush );
qwtCurve->setSymbol( curveSymbol );
qwtCurve->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( qwtCurve );
m_qwtCurveArr.push_back( qwtCurve );
}
@ -268,13 +265,18 @@ void RiuPvtPlotWidget::plotCurves( RiaEclipseUnitTools::UnitSystem
if ( pressure != HUGE_VAL )
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
QPen pen;
pen.setStyle( Qt::DashLine );
lineMarker->setLinePen( pen );
lineMarker->setXValue( pressure );
lineMarker->setLineStyle( QwtPlotMarker::VLine );
lineMarker->setLinePen( QPen( QColor( 128, 128, 255 ), 1, Qt::DashLine ) );
lineMarker->setLabel( QString( "PRESSURE" ) );
lineMarker->setLabelAlignment( Qt::AlignTop | Qt::AlignRight );
lineMarker->setLabelOrientation( Qt::Vertical );
lineMarker->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( lineMarker );
}
// Then point marker
@ -283,10 +285,11 @@ void RiuPvtPlotWidget::plotCurves( RiaEclipseUnitTools::UnitSystem
QwtPlotMarker* pointMarker = new QwtPlotMarker;
pointMarker->setValue( pressure, pointMarkerYValue );
QColor markerClr( 128, 0, 255 );
QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse );
symbol->setSize( 13, 13 );
symbol->setPen( QPen( markerClr, 2 ) );
QPen pen;
pen.setWidth( 2 );
symbol->setPen( pen );
symbol->setBrush( Qt::NoBrush );
pointMarker->setSymbol( symbol );
@ -294,12 +297,13 @@ void RiuPvtPlotWidget::plotCurves( RiaEclipseUnitTools::UnitSystem
{
QwtText text( pointMarkerLabel );
text.setRenderFlags( Qt::AlignLeft );
text.setColor( markerClr );
text.setColor( RiuGuiTheme::getColorByVariableName( "textColor" ) );
pointMarker->setLabel( text );
pointMarker->setLabelAlignment( Qt::AlignTop | Qt::AlignRight );
}
pointMarker->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( pointMarker );
}
m_qwtPlot->setTitle( plotTitle );
@ -366,13 +370,14 @@ void RiuPvtPlotWidget::updateTrackerPlotMarkerAndLabelFromPicker()
if ( !m_trackerPlotMarker )
{
m_trackerPlotMarker = new QwtPlotMarker;
m_trackerPlotMarker->setTitle( QString( "TrackedPoint" ) );
QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse );
symbol->setSize( 13, 13 );
symbol->setPen( QPen( QColor( 0, 0, 0 ), 2 ) );
symbol->setBrush( Qt::NoBrush );
m_trackerPlotMarker->setSymbol( symbol );
m_trackerPlotMarker->attach( m_qwtPlot );
RiuGuiTheme::styleQwtItem( m_trackerPlotMarker );
needsReplot = true;
}

View File

@ -0,0 +1,185 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuQssSyntaxHighlighter.h"
#include <QRegularExpression>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QssSyntaxHighligter::QssSyntaxHighligter( QTextDocument* parent )
: QSyntaxHighlighter( parent )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QssSyntaxHighligter::highlightBlock( const QString& text )
{
QTextCharFormat variableFormat;
variableFormat.setFontWeight( QFont::Bold );
variableFormat.setForeground( QColor( "#e20a48" ) );
QTextCharFormat commentFormat;
commentFormat.setFontWeight( QFont::Normal );
commentFormat.setForeground( QColor( "#4e9041" ) );
QTextCharFormat classFormat;
classFormat.setFontWeight( QFont::Bold );
classFormat.setForeground( QColor( "#fc8f00" ) );
QTextCharFormat handleFormat;
handleFormat.setFontWeight( QFont::Bold );
handleFormat.setForeground( QColor( "#e20a48" ) );
QTextCharFormat modifierFormat;
modifierFormat.setFontWeight( QFont::Normal );
modifierFormat.setForeground( QColor( "#e20a48" ) );
// Block states:
// -1 - none
// 1 - inside class
// 2 - inside function
// 3 - inside multiline comment
QRegularExpression classStartExpression = QRegularExpression( QString( "\\{" ) );
QRegularExpression classEndExpression = QRegularExpression( QString( "\\}" ) );
QRegularExpression functionStartExpression = QRegularExpression( QString( "\\(" ) );
QRegularExpression functionEndExpression = QRegularExpression( QString( "\\)" ) );
QRegularExpression commentStartExpression = QRegularExpression( QString( "/\\*" ) );
QRegularExpression commentEndExpression = QRegularExpression( QString( "\\*/" ) );
setCurrentBlockState( -1 );
auto parseClass = [this, text]( int startIndex, int length ) {
QTextCharFormat propertyFormat;
propertyFormat.setFontWeight( QFont::Bold );
QTextCharFormat valueFormat;
valueFormat.setFontWeight( QFont::Normal );
valueFormat.setForeground( QColor( "#0d98ce" ) );
QTextCharFormat functionFormat;
functionFormat.setFontWeight( QFont::Bold );
functionFormat.setForeground( QColor( "#dd1bc1" ) );
QRegularExpression expression =
QRegularExpression( "\\s*([a-zA-Z0-9_-]+)[ \\t]*:\\s*([a-zA-Z0-9_-]+\\()?([\\$#\\[\\]:\\.,a-zA-Z0-9-_ "
"]+)(\\))?[ \\t]*;" );
QRegularExpressionMatchIterator j = expression.globalMatch( text );
while ( j.hasNext() )
{
QRegularExpressionMatch matchClass = j.next();
setFormat( startIndex + matchClass.capturedStart( 1 ), matchClass.capturedLength( 1 ), propertyFormat );
setFormat( startIndex + matchClass.capturedStart( 2 ), matchClass.capturedLength( 2 ), functionFormat );
setFormat( startIndex + matchClass.capturedStart( 3 ), matchClass.capturedLength( 3 ), valueFormat );
setFormat( startIndex + matchClass.capturedStart( 4 ), matchClass.capturedLength( 4 ), functionFormat );
}
};
if ( previousBlockState() == -1 )
{
QRegularExpression expression = QRegularExpression( "([a-zA-z0-9_-]+)(::[a-zA-Z0-9_-]+)?(:[a-zA-Z0-9_-]+)?" );
QRegularExpressionMatchIterator i = expression.globalMatch( text );
while ( i.hasNext() )
{
QRegularExpressionMatch matchClass = i.next();
setFormat( matchClass.capturedStart( 1 ), matchClass.capturedLength( 1 ), classFormat );
setFormat( matchClass.capturedStart( 2 ), matchClass.capturedLength( 2 ), handleFormat );
setFormat( matchClass.capturedStart( 3 ), matchClass.capturedLength( 3 ), modifierFormat );
}
int startIndex = text.indexOf( classStartExpression );
while ( startIndex >= 0 )
{
QRegularExpressionMatch match = classEndExpression.match( text, startIndex );
int endIndex = match.capturedStart();
int classLength = 0;
if ( endIndex == -1 )
{
setCurrentBlockState( 1 );
classLength = text.length() - startIndex;
}
else
{
classLength = endIndex - startIndex + match.capturedLength();
}
parseClass( startIndex, classLength );
startIndex = text.indexOf( classStartExpression, startIndex + classLength );
}
}
if ( previousBlockState() == 1 )
{
int startIndex = 0;
while ( startIndex >= 0 )
{
QRegularExpressionMatch match = classEndExpression.match( text, startIndex );
int endIndex = match.capturedStart();
int classLength = 0;
if ( endIndex == -1 )
{
setCurrentBlockState( 1 );
classLength = text.length() - startIndex;
}
else
{
classLength = endIndex - startIndex + match.capturedLength();
}
parseClass( startIndex, classLength );
startIndex = text.indexOf( classStartExpression, startIndex + classLength );
}
}
QRegularExpression expression( "\\$[a-zA-z0-9_]+" );
QRegularExpressionMatchIterator i = expression.globalMatch( text );
while ( i.hasNext() )
{
QRegularExpressionMatch match = i.next();
setFormat( match.capturedStart(), match.capturedLength(), variableFormat );
}
expression = QRegularExpression( "\\/\\/(.*)" );
i = expression.globalMatch( text );
while ( i.hasNext() )
{
QRegularExpressionMatch match = i.next();
setFormat( match.capturedStart(), match.capturedLength(), commentFormat );
}
int startIndex = 0;
if ( previousBlockState() != 2 ) startIndex = text.indexOf( commentStartExpression );
while ( startIndex >= 0 )
{
QRegularExpressionMatch match = commentEndExpression.match( text, startIndex );
int endIndex = match.capturedStart();
int commentLength = 0;
if ( endIndex == -1 )
{
setCurrentBlockState( 2 );
commentLength = text.length() - startIndex;
}
else
{
commentLength = endIndex - startIndex + match.capturedLength();
}
setFormat( startIndex, commentLength, commentFormat );
startIndex = text.indexOf( commentStartExpression, startIndex + commentLength );
}
}

View File

@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QSyntaxHighlighter>
#include <QTextDocument>
class QssSyntaxHighligter : public QSyntaxHighlighter
{
public:
QssSyntaxHighligter( QTextDocument* parent );
protected:
virtual void highlightBlock( const QString& text );
};

View File

@ -44,8 +44,11 @@ RiuQwtCurvePointTracker::RiuQwtCurvePointTracker( QwtPlot* pl
this->setTrackerMode( QwtPicker::AlwaysOn );
m_plotMarker = new QwtPlotMarker;
// Get text color from palette
QColor color = plot->palette().color( QPalette::Text );
// QwtPlotMarker takes ownership of the symbol, it is deleted in destructor of QwtPlotMarker
QwtSymbol* mySymbol = new QwtSymbol( QwtSymbol::Ellipse, Qt::NoBrush, QPen( Qt::black, 2.0 ), QSize( 12, 12 ) );
QwtSymbol* mySymbol = new QwtSymbol( QwtSymbol::Ellipse, Qt::NoBrush, QPen( color, 2.0 ), QSize( 12, 12 ) );
m_plotMarker->setSymbol( mySymbol );
}

View File

@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiuQwtPlotTools.h"
#include "RiuGuiTheme.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
@ -53,8 +55,8 @@ void RiuQwtPlotTools::setCommonPlotBehaviour( QwtPlot* plot )
QwtPlotGrid* grid = new QwtPlotGrid;
grid->attach( plot );
QPen gridPen( Qt::SolidLine );
gridPen.setColor( Qt::lightGray );
grid->setPen( gridPen );
RiuGuiTheme::styleQwtItem( grid );
// Axis number font
int axisFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(),

View File

@ -19,6 +19,7 @@
#include "RiuQwtSymbol.h"
#include "RiaColorTools.h"
#include "RiaFontCache.h"
#include "cvfAssert.h"
@ -157,6 +158,7 @@ void RiuQwtSymbol::renderSymbolLabel( QPainter* painter, const QPointF& position
QFont font = painter->font();
font.setPixelSize( m_labelFontSizePx );
painter->setFont( font );
painter->setPen( RiaColorTools::systemPaletteTextColor() );
QSize symbolSize = QwtSymbol::size();
QRect symbolRect( position.x(), position.y(), symbolSize.width(), symbolSize.height() );

View File

@ -18,6 +18,7 @@
#include "RiuRelativePermeabilityPlotPanel.h"
#include "RiuDockedQwtPlot.h"
#include "RiuGuiTheme.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotTools.h"
#include "RiuRelativePermeabilityPlotUpdater.h"
@ -85,6 +86,8 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QDockWidget*
, m_plotUpdater( new RiuRelativePermeabilityPlotUpdater( this ) )
{
m_qwtPlot = new RelPermQwtPlot( this );
m_qwtPlot->setProperty( "qss-class", "RelPermPlot" );
setPlotDefaults( m_qwtPlot );
applyFontSizes( false );
@ -366,37 +369,36 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaEclipseUnitTools::Uni
qwtCurve->setStyle( QwtPlotCurve::Lines );
Qt::PenStyle penStyle = Qt::SolidLine;
QColor clr = Qt::magenta;
switch ( curve.ident )
{
case RigFlowDiagSolverInterface::RelPermCurve::KRW:
clr = QColor( 0, 0, 200 );
qwtCurve->setTitle( "KRW" );
break;
case RigFlowDiagSolverInterface::RelPermCurve::KROW:
clr = QColor( 0, 0, 200 );
qwtCurve->setTitle( "KROW" );
break;
case RigFlowDiagSolverInterface::RelPermCurve::PCOW:
clr = QColor( 0, 130, 175 );
qwtCurve->setTitle( "PCOW" );
penStyle = Qt::DashLine;
break;
case RigFlowDiagSolverInterface::RelPermCurve::KRG:
clr = QColor( 200, 0, 0 );
qwtCurve->setTitle( "KRG" );
break;
case RigFlowDiagSolverInterface::RelPermCurve::KROG:
clr = QColor( 200, 0, 0 );
qwtCurve->setTitle( "KROG" );
break;
case RigFlowDiagSolverInterface::RelPermCurve::PCOG:
clr = QColor( 225, 110, 0 );
qwtCurve->setTitle( "PCOG" );
penStyle = Qt::DashLine;
break;
}
const QPen curvePen( clr, 1, penStyle );
const QPen curvePen( Qt::black, 1, penStyle );
qwtCurve->setPen( curvePen );
QwtSymbol* curveSymbol = new QwtSymbol( QwtSymbol::Ellipse );
curveSymbol->setSize( 6, 6 );
curveSymbol->setPen( clr );
curveSymbol->setPen( Qt::black );
curveSymbol->setBrush( Qt::NoBrush );
qwtCurve->setSymbol( curveSymbol );
@ -414,6 +416,8 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaEclipseUnitTools::Uni
qwtCurve->attach( plot );
RiuGuiTheme::styleQwtItem( qwtCurve );
// Add markers to indicate where SWAT and/or SGAS saturation intersects the respective curves
// Note that if we're using log scale we must guard against non-positive values
if ( swat != HUGE_VAL )
@ -424,7 +428,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaEclipseUnitTools::Uni
{
addCurveConstSaturationIntersectionMarker( curve,
swat,
Qt::blue,
RiuGuiTheme::getColorByVariableName( "markerColor" ),
plotOnWhichYAxis,
plot,
myPlotMarkers,
@ -440,7 +444,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaEclipseUnitTools::Uni
{
addCurveConstSaturationIntersectionMarker( curve,
sgas,
Qt::red,
RiuGuiTheme::getColorByVariableName( "markerColor" ),
plotOnWhichYAxis,
plot,
myPlotMarkers,
@ -457,11 +461,11 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaEclipseUnitTools::Uni
// Add vertical marker lines to indicate cell SWAT and/or SGAS saturations
if ( swat != HUGE_VAL )
{
addVerticalSaturationMarkerLine( swat, "SWAT", Qt::blue, plot, myPlotMarkers );
addVerticalSaturationMarkerLine( swat, "SWAT", RiuGuiTheme::getColorByVariableName( "markerColor" ), plot, myPlotMarkers );
}
if ( sgas != HUGE_VAL )
{
addVerticalSaturationMarkerLine( sgas, "SGAS", Qt::red, plot, myPlotMarkers );
addVerticalSaturationMarkerLine( sgas, "SGAS", RiuGuiTheme::getColorByVariableName( "markerColor" ), plot, myPlotMarkers );
}
if ( logScaleLeftAxis )

View File

@ -52,6 +52,7 @@
RiuResultQwtPlot::RiuResultQwtPlot( QWidget* parent )
: RiuDockedQwtPlot( parent )
{
setAutoFillBackground( true );
setDefaults();
}

View File

@ -0,0 +1,157 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuTextEditWithCompletion.h"
#include <QAbstractItemModel>
#include <QAbstractItemView>
#include <QApplication>
#include <QCompleter>
#include <QKeyEvent>
#include <QModelIndex>
#include <QScrollBar>
#include <QtDebug>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TextEditWithCompletion::TextEditWithCompletion( QWidget* parent /*= nullptr */ )
: QTextEdit( parent )
{
m_completer = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TextEditWithCompletion::~TextEditWithCompletion()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void TextEditWithCompletion::setCompleter( QCompleter* completer )
{
if ( m_completer ) m_completer->disconnect( this );
m_completer = completer;
if ( !m_completer ) return;
m_completer->setWidget( this );
m_completer->setCompletionMode( QCompleter::PopupCompletion );
m_completer->setCaseSensitivity( Qt::CaseInsensitive );
QObject::connect( m_completer,
QOverload<const QString&>::of( &QCompleter::activated ),
this,
&TextEditWithCompletion::insertCompletion );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QCompleter* TextEditWithCompletion::completer()
{
return m_completer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void TextEditWithCompletion::keyPressEvent( QKeyEvent* e )
{
if ( m_completer && m_completer->popup()->isVisible() )
{
// The following keys are forwarded by the completer to the widget
switch ( e->key() )
{
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
case Qt::Key_Tab:
case Qt::Key_Backtab:
e->ignore();
return; // let the completer do default behavior
default:
break;
}
}
const bool isShortcut = ( e->modifiers().testFlag( Qt::ControlModifier ) && e->key() == Qt::Key_E ); // CTRL+E
if ( !m_completer || !isShortcut ) // do not process the shortcut when we have a completer
QTextEdit::keyPressEvent( e );
const bool ctrlOrShift = e->modifiers().testFlag( Qt::ControlModifier ) ||
e->modifiers().testFlag( Qt::ShiftModifier );
if ( !m_completer || ( ctrlOrShift && e->text().isEmpty() ) ) return;
static QString eow( "~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-=" ); // end of word
const bool hasModifier = ( e->modifiers() != Qt::NoModifier ) && !ctrlOrShift;
QString completionPrefix = textUnderCursor();
if ( !isShortcut &&
( hasModifier || e->text().isEmpty() || completionPrefix.length() < 3 || eow.contains( e->text().right( 1 ) ) ) )
{
m_completer->popup()->hide();
return;
}
if ( completionPrefix != m_completer->completionPrefix() )
{
m_completer->setCompletionPrefix( completionPrefix );
m_completer->popup()->setCurrentIndex( m_completer->completionModel()->index( 0, 0 ) );
}
QRect cr = cursorRect();
cr.setWidth( m_completer->popup()->sizeHintForColumn( 0 ) +
m_completer->popup()->verticalScrollBar()->sizeHint().width() );
m_completer->complete( cr ); // popup it up!
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void TextEditWithCompletion::focusInEvent( QFocusEvent* e )
{
if ( m_completer ) m_completer->setWidget( this );
QTextEdit::focusInEvent( e );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void TextEditWithCompletion::insertCompletion( const QString& completion )
{
if ( m_completer->widget() != this ) return;
QTextCursor tc = textCursor();
int extra = completion.length() - m_completer->completionPrefix().length();
tc.movePosition( QTextCursor::Left );
tc.movePosition( QTextCursor::EndOfWord );
tc.insertText( completion.right( extra ) );
setTextCursor( tc );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString TextEditWithCompletion::textUnderCursor() const
{
QTextCursor tc = textCursor();
tc.select( QTextCursor::WordUnderCursor );
return tc.selectedText();
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QTextEdit>
class QCompleter;
class TextEditWithCompletion : public QTextEdit
{
Q_OBJECT
public:
TextEditWithCompletion( QWidget* parent = nullptr );
~TextEditWithCompletion();
void setCompleter( QCompleter* completer );
QCompleter* completer();
protected:
void keyPressEvent( QKeyEvent* e ) override;
void focusInEvent( QFocusEvent* e ) override;
private slots:
void insertCompletion( const QString& completion );
private:
QString textUnderCursor() const;
private:
QCompleter* m_completer;
};

View File

@ -25,6 +25,8 @@
#include "RiuMainWindow.h"
#include "RiuQwtCurvePointTracker.h"
#include "RiuGuiTheme.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@ -67,19 +69,19 @@ RiuTofAccumulatedPhaseFractionsPlot::RiuTofAccumulatedPhaseFractionsPlot( RimTof
setTitle( title );
m_watCurve = new QwtPlotCurve;
setCurveColor( m_watCurve, QColor( 62, 122, 167 ) ); // Blue
setCurveColor( m_watCurve, RiuGuiTheme::getColorByVariableName( "waterCurveColor" ) );
m_watCurve->setZ( 0.9 );
m_watCurve->setTitle( "Water" );
m_watCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
m_oilCurve = new QwtPlotCurve;
setCurveColor( m_oilCurve, QColor( 123, 167, 0 ) ); // Green
setCurveColor( m_oilCurve, RiuGuiTheme::getColorByVariableName( "oilCurveColor" ) );
m_oilCurve->setZ( 0.8 );
m_oilCurve->setTitle( "Oil" );
m_oilCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
m_gasCurve = new QwtPlotCurve;
setCurveColor( m_gasCurve, QColor( 169, 18, 16 ) ); // Red
setCurveColor( m_gasCurve, RiuGuiTheme::getColorByVariableName( "gasCurveColor" ) );
m_gasCurve->setZ( 0.7 );
m_gasCurve->setTitle( "Gas" );
m_gasCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true );

View File

@ -23,4 +23,5 @@
namespace RiuTools
{
Qt::WindowFlags defaultDialogFlags();
void applyGuiTheme();
} // end namespace RiuTools

View File

@ -45,7 +45,9 @@
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QRegularExpression>
#include <QResizeEvent>
#include <QStyle>
#include <QVBoxLayout>
#include <algorithm>
@ -150,6 +152,12 @@ static const QIcon& expandUpIcon()
QMinimizePanel::QMinimizePanel( QWidget* parent /*=0*/ )
: QFrame( parent )
{
m_titleBackground =
"qlineargradient(spread:pad, x1:0 y1:0, x2:0 y2:1, stop:0 rgba(150, 150, 150, 20), stop:1 rgba(0, 0, 0, 50))";
m_border = "1px solid darkgray";
m_background = "rgba(255, 250, 250, 85)";
m_collapseIcon = expandUpIcon();
m_expandIcon = expandDownIcon();
this->initialize( "" );
}
@ -224,6 +232,121 @@ bool QMinimizePanel::isExpanded() const
return !m_contentFrame->isHidden();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getBackground() const
{
return m_background;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setBackground( QString background )
{
m_background = background;
m_contentFrame->setStyleSheet( contentFrameStyleSheet() );
m_contentFrame->style()->unpolish( m_contentFrame );
m_contentFrame->style()->polish( m_contentFrame );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getTitleBackground() const
{
return m_titleBackground;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setTitleBackground( QString background )
{
m_titleBackground = background;
m_titleFrame->setStyleSheet( titleFrameStyleSheet() );
m_titleFrame->style()->unpolish( m_titleFrame );
m_titleFrame->style()->polish( m_titleFrame );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getBorder() const
{
return m_border;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setBorder( QString border )
{
m_border = border;
m_contentFrame->setStyleSheet( contentFrameStyleSheet() );
m_contentFrame->style()->unpolish( m_contentFrame );
m_contentFrame->style()->polish( m_contentFrame );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getExpandIconPath() const
{
return m_expandIconPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setExpandIconPath( QString path )
{
m_expandIconPath = path;
m_expandIcon = QIcon( path );
if ( !isExpanded() ) m_collapseButton->setIcon( m_expandIcon );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getCollapseIconPath() const
{
return m_expandIconPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setCollapseIconPath( QString path )
{
m_collapseIconPath = path;
m_collapseIcon = QIcon( path );
if ( isExpanded() ) m_collapseButton->setIcon( m_collapseIcon );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString QMinimizePanel::getIconSize() const
{
return m_iconSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QMinimizePanel::setIconSize( QString size )
{
m_iconSize = size;
QRegularExpression sizeRegExp = QRegularExpression( "\\s*([0-9]+)px\\s*" );
if ( sizeRegExp.match( size ).hasMatch() )
{
m_collapseButton->setIconSize(
QSize( sizeRegExp.match( size ).captured( 1 ).toInt(), sizeRegExp.match( size ).captured( 1 ).toInt() ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -234,12 +357,12 @@ void QMinimizePanel::setExpanded( bool isExpanded )
m_contentFrame->setVisible( isExpanded );
if ( isExpanded )
{
m_collapseButton->setIcon( expandUpIcon() );
m_collapseButton->setIcon( m_collapseIcon );
this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
}
else
{
m_collapseButton->setIcon( expandDownIcon() );
m_collapseButton->setIcon( m_expandIcon );
this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
}
@ -287,7 +410,7 @@ void QMinimizePanel::initialize( const QString& title )
{
m_collapseButton = new QPushButton();
m_collapseButton->setFlat( true );
m_collapseButton->setIcon( expandUpIcon() );
m_collapseButton->setIcon( m_collapseIcon );
m_collapseButton->setDefault( false );
m_collapseButton->setAutoDefault( false );
m_collapseButton->setIconSize( QSize( 16, 16 ) );
@ -314,9 +437,9 @@ QString QMinimizePanel::titleFrameStyleSheet()
return QString( "QFrame#GroupTitleFrame "
"{"
" border-top: none; border-left: none; border-right: none; border-bottom: none;"
" background: qlineargradient(spread:pad, x1:0 y1:0, x2:0 y2:1,"
" stop:0 rgba(150, 150, 150, 20), stop:1 rgba(0, 0, 0, 50));"
"}" );
" background: %0;"
"}" )
.arg( m_titleBackground );
}
//--------------------------------------------------------------------------------------------------
@ -326,11 +449,12 @@ QString QMinimizePanel::contentFrameStyleSheet()
{
return QString( "QFrame#FramedGroupContent"
"{"
" border-top: 1px solid darkgray; border-left: none; border-right: none; border-bottom: none; "
" background: rgba(255, 250, 250, 85)"
" border-top: %0; border-left: none; border-right: none; border-bottom: none; "
" background: %1;"
"}"
"QFrame#UnframedGroupContent"
"{"
" border-top: none; border-left: none; border-right: none; border-bottom: none; "
"}" );
"}" )
.arg( m_border, m_background );
}

View File

@ -37,6 +37,7 @@
#pragma once
#include <QFrame>
#include <QIcon>
class QLabel;
class QPushButton;
@ -49,6 +50,12 @@ class QPushButton;
class QMinimizePanel : public QFrame
{
Q_OBJECT
Q_PROPERTY( QString background READ getBackground WRITE setBackground DESIGNABLE true )
Q_PROPERTY( QString titleBackground READ getTitleBackground WRITE setTitleBackground DESIGNABLE true )
Q_PROPERTY( QString border READ getBorder WRITE setBorder DESIGNABLE true )
Q_PROPERTY( QString expandIconPath READ getExpandIconPath WRITE setExpandIconPath DESIGNABLE true )
Q_PROPERTY( QString collapseIconPath READ getCollapseIconPath WRITE setCollapseIconPath DESIGNABLE true )
Q_PROPERTY( QString iconSize READ getIconSize WRITE setIconSize DESIGNABLE true )
public:
explicit QMinimizePanel( QWidget* parent = nullptr );
explicit QMinimizePanel( const QString& title, QWidget* parent = nullptr );
@ -59,6 +66,25 @@ public:
QString title() const;
void enableFrame( bool showFrame );
bool isExpanded() const;
QString getBackground() const;
void setBackground( QString background );
QString getTitleBackground() const;
void setTitleBackground( QString background );
QString getBorder() const;
void setBorder( QString border );
QString getExpandIconPath() const;
void setExpandIconPath( QString path );
QString getCollapseIconPath() const;
void setCollapseIconPath( QString path );
QString getIconSize() const;
void setIconSize( QString size );
public slots:
void setExpanded( bool isExpanded );
void toggleExpanded();
@ -77,4 +103,13 @@ private:
QString titleFrameStyleSheet();
QString contentFrameStyleSheet();
QString m_background;
QString m_titleBackground;
QString m_border;
QString m_expandIconPath;
QString m_collapseIconPath;
QString m_iconSize;
QIcon m_expandIcon;
QIcon m_collapseIcon;
};

View File

@ -179,15 +179,6 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName )
QPalette myPalette;
if ( attributes.m_baseColor == myPalette.color( QPalette::Active, QPalette::Base ) )
{
m_listView->setStyleSheet( "" );
}
else
{
m_listView->setStyleSheet( "background-color: " + attributes.m_baseColor.name() + ";" );
}
m_listView->setHeightHint( attributes.m_heightHint );
if ( !attributes.m_allowHorizontalScrollBar )
{

View File

@ -22,6 +22,7 @@
#include "nightcharts.h"
#include <QPainterPath>
#include <QPalette>
Nightcharts::Nightcharts()//QPainter *painter)
@ -332,13 +333,13 @@ int Nightcharts::draw(QPainter *painter)
painter->setPen(Qt::SolidLine);
for (int i=1;i<10;i++)
{
painter->drawLine(cX-3,cY+cH/10*i,cX+3,cY+cH/10*i); //äåëåíèÿ ïî îñè Y
painter->drawLine(cX-3,cY+cH/10*i,cX+3,cY+cH/10*i);
//painter->drawText(cX-20,cY+cH/10*i,QString::number((10-i)*10)+"%");
}
painter->drawLine(cX,cY+cH,cX,cY); //îñü Y
painter->drawLine(cX,cY,cX+4,cY+10); //ñòðåëêè
painter->drawLine(cX,cY+cH,cX,cY);
painter->drawLine(cX,cY,cX+4,cY+10);
painter->drawLine(cX,cY,cX-4,cY+10);
painter->drawLine(cX,cY+cH,cX+cW,cY+cH); //îñü Õ
painter->drawLine(cX,cY+cH,cX+cW,cY+cH);
}
return 0;
@ -350,35 +351,15 @@ void Nightcharts::drawLegend(QPainter *painter)
double angle = palpha;
painter->setPen(Qt::SolidLine);
QPalette palette;
QColor textColor = palette.color(QPalette::Text);
painter->setPen(textColor);
switch(cltype)
{
/*case Nightcharts::Horizontal:
{
int dist = 5;
painter->setBrush(Qt::white);
float x = cX;
float y = cY+cH+20+dist;
//painter->drawRoundRect(cX+cW+20,cY,dist*2+200,pieces.size()*(fontmetr.height()+2*dist)+dist,15,15);
for (int i=0;i<pieces.size();i++)
{
painter->setBrush(pieces[i].rgbColor);
x += fontmetr.height()+2*dist;
if (i%3 == 0)
{
x = cX;
y += dist+fontmetr.height();
}
painter->drawRect(x,y,fontmetr.height(),fontmetr.height());
QString label = pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%";
painter->drawText(x+fontmetr.height()+dist,y+fontmetr.height()/2+dist,label);
x += fontmetr.width(label);
}
break;
}*/
case Nightcharts::Vertical:
{
int dist = 5;
painter->setBrush(Qt::white);
//painter->drawRoundRect(cX+cW+20,cY,dist*2+200,pieces.size()*(painter->fontMetrics().height()+2*dist)+dist,15,15);
for (int i=pieces.size()-1;i>=0;i--)
{
@ -410,7 +391,7 @@ void Nightcharts::drawLegend(QPainter *painter)
float recH = painter->fontMetrics().height()+10;
p_.setX(p_.x()-recW/2 + recW/2*cos(angle*M_PI/180));
p_.setY(p_.y()+recH/2 + recH/2*sin(angle*M_PI/180));
painter->setBrush(Qt::white);
painter->setBrush(textColor);
painter->drawRoundRect(p_.x() ,p_.y(), recW, -recH);
painter->drawText(p_.x()+5, p_.y()-recH/2+5, label);
angle -= pdegree/2;