mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Several adjustments related to Qt6
* Avoid ambiguous definition during unity build on Windows * Add missing include * Add Qt6 to expressionparser * Add Qt6 to nightcharts * Replace forward define of QStringList with include <QStringList> * Use toMSecsSinceEpoch * Use setContentsMargins
This commit is contained in:
11
ThirdParty/expressionparser/CMakeLists.txt
vendored
11
ThirdParty/expressionparser/CMakeLists.txt
vendored
@@ -7,9 +7,14 @@ if(MSVC)
|
||||
message(STATUS "MSVC: Enabled increased number of sections in object files")
|
||||
endif()
|
||||
|
||||
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core)
|
||||
set(QT_LIBRARIES Qt5::Core)
|
||||
if (CEE_USE_QT6)
|
||||
find_package(Qt6 COMPONENTS REQUIRED Core)
|
||||
set(QT_LIBRARIES Qt6::Core)
|
||||
qt_standard_project_setup()
|
||||
else()
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core)
|
||||
set(QT_LIBRARIES Qt5::Core)
|
||||
endif()
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
ExpressionParser.h
|
||||
|
||||
11
ThirdParty/nightcharts/CMakeLists.txt
vendored
11
ThirdParty/nightcharts/CMakeLists.txt
vendored
@@ -2,9 +2,14 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (nightcharts)
|
||||
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Widgets)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
if (CEE_USE_QT6)
|
||||
find_package(Qt6 COMPONENTS REQUIRED Core Gui Widgets)
|
||||
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
qt_standard_project_setup()
|
||||
else()
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||
endif()
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
nightcharts.h
|
||||
|
||||
6
ThirdParty/nightcharts/nightcharts.cpp
vendored
6
ThirdParty/nightcharts/nightcharts.cpp
vendored
@@ -330,7 +330,7 @@ int Nightcharts::draw(QPainter *painter)
|
||||
painter->drawRect(cX+pDist+i*(pW + pDist),cY+cH,pW,-cH/100*pieces[i].pPerc-5);
|
||||
QString label = QString::number(pieces[i].pPerc)+"%";
|
||||
painter->setPen(Qt::SolidLine);
|
||||
painter->drawText(cX+pDist+i*(pW + pDist)+pW/2-painter->fontMetrics().width(label)/2,cY+cH-cH/100*pieces[i].pPerc-painter->fontMetrics().height()/2,label);
|
||||
painter->drawText(cX+pDist+i*(pW + pDist)+pW/2-painter->fontMetrics().horizontalAdvance(label)/2,cY+cH-cH/100*pieces[i].pPerc-painter->fontMetrics().height()/2,label);
|
||||
}
|
||||
painter->setPen(Qt::SolidLine);
|
||||
for (int i=1;i<10;i++)
|
||||
@@ -386,12 +386,12 @@ void Nightcharts::drawLegend(QPainter *painter)
|
||||
}
|
||||
painter->drawLine(p.x(),p.y(),p_.x(),p_.y());
|
||||
QString label = pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%";
|
||||
float recW = painter->fontMetrics().width(label)+10;
|
||||
float recW = painter->fontMetrics().horizontalAdvance(label)+10;
|
||||
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(textColor);
|
||||
painter->drawRoundRect(p_.x() ,p_.y(), recW, -recH);
|
||||
painter->drawRect(p_.x() ,p_.y(), recW, -recH);
|
||||
painter->drawText(p_.x()+5, p_.y()-recH/2+5, label);
|
||||
angle -= pdegree/2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user