Skip to content

Commit 26c1171

Browse files
author
Charles PIGNEROL
committed
Version 5.3.0. Porting Qt 6.
1 parent 657cd5c commit 26c1171

23 files changed

+277
-384
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.15)
22

33
project (QwtCharts CXX)
44

cmake/version.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#
44

55
set (QWT_CHARTS_MAJOR_VERSION "5")
6-
set (QWT_CHARTS_MINOR_VERSION "2")
7-
set (QWT_CHARTS_RELEASE_VERSION "1")
6+
set (QWT_CHARTS_MINOR_VERSION "3")
7+
set (QWT_CHARTS_RELEASE_VERSION "0")
88
set (QWT_CHARTS_VERSION ${QWT_CHARTS_MAJOR_VERSION}.${QWT_CHARTS_MINOR_VERSION}.${QWT_CHARTS_RELEASE_VERSION})
99

1010

src/QwtCharts/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ find_package (Qwt REQUIRED) # définit ${QWT_TARGET}
1010

1111
include (${CMAKE_SOURCE_DIR}/cmake/version.cmake)
1212
include (${GUIToolkitsVariables_CMAKE_DIR}/common.cmake)
13+
include (${GUIToolkitsVariables_CMAKE_DIR}/common_qt.cmake)
1314
include (${GUIToolkitsVariables_CMAKE_DIR}/workarounds.cmake)
1415

1516
find_package (QtUtil 6 REQUIRED)
16-
find_package(Qt5Core 5 NO_CMAKE_SYSTEM_PATH) # In order to enable moc ...
17+
find_package(Qt${QT_MAJOR}Core ${QT_MAJOR} NO_CMAKE_SYSTEM_PATH) # In order to enable moc ...
1718

1819
file (GLOB HEADERS public/${CURRENT_PACKAGE_NAME}/*.h)
1920
file (GLOB CPP_SOURCES *.cpp *.qrc)
@@ -26,7 +27,7 @@ set_property (TARGET QwtCharts PROPERTY AUTORCC ON) # => QwtCharts.qrc taken int
2627
set (ALL_TARGETS QwtCharts)
2728
set_property (TARGET QwtCharts PROPERTY VERSION ${QWT_CHARTS_VERSION})
2829
set_property (TARGET QwtCharts PROPERTY SOVERSION ${QWT_CHARTS_MAJOR_VERSION})
29-
set (QWT_CHARTS_PUBLIC_FLAGS -DQT_5)
30+
set (QWT_CHARTS_PUBLIC_FLAGS -DQT_${QT_MAJOR})
3031
set (QWT_CHARTS_PRIVATE_FLAGS -DQWT_CHARTS_VERSION="${QWT_CHARTS_VERSION}")
3132

3233
target_include_directories (QwtCharts PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/public>$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)

src/QwtCharts/QwtChartGeneralOptionsPanel.cpp

Lines changed: 28 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <TkUtil/MemoryError.h>
88

99
#include <qwt_plot_layout.h>
10+
#include <qwt_text.h>
1011

1112
#include <QButtonGroup>
1213
#include <QColorDialog>
@@ -26,15 +27,10 @@ static const TkUtil::Charset charset ("àéèùô");
2627
USE_ENCODING_AUTODETECTION
2728

2829

29-
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
30-
QWidget* parent, QwtChartPanel* chartPanel)
30+
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (QWidget* parent, QwtChartPanel* chartPanel)
3131
: QwtChartPanel::QwtChartEditionPanel (parent, chartPanel),
32-
_chartPanel (chartPanel),
33-
_backgroundColor (Qt::white),
34-
_titleTextField (0), _titleFontPanel (0),
35-
_cartesianButton (0), _polarButton (0),
36-
_marginsTextField (0),
37-
_aspectRatioCheckbox (0), _aspectRatioTextField (0)
32+
_chartPanel (chartPanel), _backgroundColor (Qt::white), _titleTextField (0), _titleFontPanel (0),
33+
_cartesianButton (0), _polarButton (0), _marginsTextField (0), _aspectRatioCheckbox (0), _aspectRatioTextField (0)
3834
{
3935
if (0 != _chartPanel)
4036
_backgroundColor = _chartPanel->getBackgroundColor ( );
@@ -51,19 +47,15 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
5147
vLayout->addLayout (hLayout);
5248
QLabel* label = new QLabel ("Titre :", group);
5349
hLayout->addWidget (label);
54-
QString title =
55-
0 == _chartPanel ? "" : _chartPanel->getPlot ( ).title ( ).text ( );
50+
QString title = 0 == _chartPanel ? "" : _chartPanel->getPlot ( ).title ( ).text ( );
5651
_titleTextField = new QtTextField (title, group);
5752
hLayout->addWidget (_titleTextField);
5853
QPushButton* button = new QPushButton ("Modifier ...", group);
5954
hLayout->addWidget (button);
6055
connect (button, SIGNAL (clicked ( )), this, SLOT (editTitleCallback ( )));
61-
QFont font = 0 == _chartPanel ?
62-
QApplication::font( ) : _chartPanel->getPlot ( ).title ( ).font ( );
63-
QColor color = 0 == _chartPanel ?
64-
Qt::black : _chartPanel->getPlot ( ).title ( ).color ( );
65-
_titleFontPanel =
66-
new QtFontPanel (this, font, color, QtFontPanel::HORIZONTAL_PANEL);
56+
QFont font = 0 == _chartPanel ? QApplication::font( ) : _chartPanel->getPlot ( ).title ( ).font ( );
57+
QColor color = 0 == _chartPanel ? Qt::black : _chartPanel->getPlot ( ).title ( ).color ( );
58+
_titleFontPanel = new QtFontPanel (this, font, color, QtFontPanel::HORIZONTAL_PANEL);
6759
vLayout->addWidget (_titleFontPanel);
6860
vLayout->addStretch (2);
6961

@@ -74,21 +66,18 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
7466
hLayout = new QHBoxLayout ( );
7567
group->setLayout (hLayout);
7668
mainLayout->addWidget (group);
77-
_cartesianButton =
78-
new QRadioButton (QSTR ("Cartésienne"), group);
69+
_cartesianButton = new QRadioButton (QSTR ("Cartésienne"), group);
7970
hLayout->addWidget (_cartesianButton);
8071
if (QwtChartPanel::CARTESIAN == chartPanel->getDisplayMode ( ))
8172
_cartesianButton->setChecked (true);
82-
_cartesianButton->setEnabled (
83-
chartPanel->isDisplayModeAllowed (QwtChartPanel::CARTESIAN));
73+
_cartesianButton->setEnabled (chartPanel->isDisplayModeAllowed (QwtChartPanel::CARTESIAN));
8474
buttonGroup->addButton (_cartesianButton);
8575
_polarButton = new QRadioButton ("Polaire", group);
8676
buttonGroup->addButton (_polarButton);
8777
hLayout->addWidget (_polarButton);
8878
if (QwtChartPanel::POLAR == chartPanel->getDisplayMode ( ))
8979
_polarButton->setChecked (true);
90-
_polarButton->setEnabled (
91-
chartPanel->isDisplayModeAllowed (QwtChartPanel::POLAR));
80+
_polarButton->setEnabled (chartPanel->isDisplayModeAllowed (QwtChartPanel::POLAR));
9281
hLayout->addStretch (200);
9382

9483
// Fond :
@@ -100,8 +89,7 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
10089
hLayout->addWidget (label);
10190
button = new QPushButton ("Couleur ...", group);
10291
hLayout->addWidget (button);
103-
connect (button, SIGNAL (clicked ( )), this,
104-
SLOT (backgroundColorCallback ( )));
92+
connect (button, SIGNAL (clicked ( )), this, SLOT (backgroundColorCallback ( )));
10593
hLayout->addStretch (2);
10694

10795
// Marges :
@@ -113,7 +101,11 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
113101
hLayout->addWidget (label);
114102
int margin = 0;
115103
if (0 != _chartPanel)
104+
#ifdef QT_5
116105
_chartPanel->getPlot ( ).getContentsMargins (&margin, &margin, &margin, &margin);
106+
#else // QT_5
107+
margin = _chartPanel->getPlot ( ).contentsMargins ( ).left ( );
108+
#endif // QT_5
117109
_marginsTextField = new QtIntTextField (margin, group);
118110
_marginsTextField->setRange (0, 100);
119111
_marginsTextField->setVisibleColumns (3);
@@ -124,16 +116,13 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
124116
hLayout = new QHBoxLayout ( );
125117
group->setLayout (hLayout);
126118
mainLayout->addWidget (group);
127-
_aspectRatioCheckbox =
128-
new QCheckBox ("Utiliser le rapport d'aspect", group);
119+
_aspectRatioCheckbox = new QCheckBox ("Utiliser le rapport d'aspect", group);
129120
if (0 != _chartPanel)
130121
_aspectRatioCheckbox->setChecked (_chartPanel->useAspectRatio ( ));
131122
hLayout->addWidget (_aspectRatioCheckbox);
132123
label = new QLabel ("Rapport d'aspect :", group);
133124
hLayout->addWidget (label);
134-
_aspectRatioTextField =
135-
new QtDoubleTextField (0 == _chartPanel ?
136-
1. : _chartPanel->getAspectRatio ( ), group);
125+
_aspectRatioTextField = new QtDoubleTextField (0 == _chartPanel ? 1. : _chartPanel->getAspectRatio ( ), group);
137126
_aspectRatioTextField->setRange (1E-6, 1E6);
138127
hLayout->addWidget (_aspectRatioTextField);
139128
hLayout->addStretch (2);
@@ -143,20 +132,16 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
143132
} // QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel
144133

145134

146-
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
147-
const QwtChartGeneralOptionsPanel& view)
135+
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (const QwtChartGeneralOptionsPanel& view)
148136
: QwtChartPanel::QwtChartEditionPanel (0, 0), _chartPanel (0),
149137
_backgroundColor (Qt::white), _titleTextField (0), _titleFontPanel (0),
150-
_cartesianButton (0), _polarButton (0),
151-
_marginsTextField (0),
152-
_aspectRatioCheckbox (0), _aspectRatioTextField (0)
138+
_cartesianButton (0), _polarButton (0), _marginsTextField (0), _aspectRatioCheckbox (0), _aspectRatioTextField (0)
153139
{
154140
assert (0 && "QwtChartGeneralOptionsPanel copy constructor is not allowed.");
155141
} // QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (const QwtChartGeneralOptionsPanel& view)
156142

157143

158-
QwtChartGeneralOptionsPanel& QwtChartGeneralOptionsPanel::operator = (
159-
const QwtChartGeneralOptionsPanel& view)
144+
QwtChartGeneralOptionsPanel& QwtChartGeneralOptionsPanel::operator = (const QwtChartGeneralOptionsPanel& view)
160145
{
161146
assert (0 && "QwtChartGeneralOptionsPanel::operator = is not allowed.");
162147
return *this;
@@ -190,8 +175,7 @@ void QwtChartGeneralOptionsPanel::setTitle (const QwtText& title)
190175
} // QwtChartGeneralOptionsPanel::setTitle
191176

192177

193-
QwtChartPanel::DISPLAY_MODE
194-
QwtChartGeneralOptionsPanel::getDisplayMode ( ) const
178+
QwtChartPanel::DISPLAY_MODE QwtChartGeneralOptionsPanel::getDisplayMode ( ) const
195179
{
196180
assert (0 != _cartesianButton);
197181
assert (0 != _polarButton);
@@ -205,18 +189,15 @@ QwtChartPanel::DISPLAY_MODE
205189
} // QwtChartGeneralOptionsPanel::getDisplayMode
206190

207191

208-
void QwtChartGeneralOptionsPanel::setDisplayMode (
209-
QwtChartPanel::DISPLAY_MODE mode)
192+
void QwtChartGeneralOptionsPanel::setDisplayMode (QwtChartPanel::DISPLAY_MODE mode)
210193
{
211194
assert (0 != _cartesianButton);
212195
assert (0 != _polarButton);
213196

214197
switch (mode)
215198
{
216-
case QwtChartPanel::CARTESIAN :
217-
_cartesianButton->setChecked (true); break;
218-
case QwtChartPanel::POLAR :
219-
_polarButton->setChecked (true); break;
199+
case QwtChartPanel::CARTESIAN : _cartesianButton->setChecked (true); break;
200+
case QwtChartPanel::POLAR : _polarButton->setChecked (true); break;
220201
default :
221202
{
222203
INTERNAL_ERROR (exc, "Mode de représentation (cartésienne/polaire) indéfini.", "QwtChartGeneralOptionsPanel::setDisplayMode")
@@ -244,8 +225,7 @@ unsigned int QwtChartGeneralOptionsPanel::getMargins ( ) const
244225
if (0 > _marginsTextField->getValue ( ))
245226
{
246227
UTF8String msg (charset);
247-
msg << "La valeur " << (unsigned long)_marginsTextField->getValue ( )
248-
<< " est négative alors qu'elle devrait être positive ou nulle.";
228+
msg << "La valeur " << (unsigned long)_marginsTextField->getValue ( ) << " est négative alors qu'elle devrait être positive ou nulle.";
249229
INTERNAL_ERROR (exc, msg, "QwtChartGeneralOptionsPanel::getMargins")
250230
throw exc;
251231
} // if (0 > _marginsTextField->getValue ( ))
@@ -335,14 +315,11 @@ void QwtChartGeneralOptionsPanel::editTitleCallback ( )
335315

336316
try
337317
{
338-
UTF8String title (
339-
QtUnicodeHelper::qstringToUTF8String (_titleTextField->text( )));
318+
UTF8String title (QtUnicodeHelper::qstringToUTF8String (_titleTextField->text( )));
340319
QFont font = _titleFontPanel->getFont ( );
341320
QColor textColor = _titleFontPanel->getColor ( );
342321
QColor background = getBackgroundColor ( );
343-
QtScientificTextDialog dialog (
344-
this, "Titre du graphique", title, true, font,
345-
textColor, background);
322+
QtScientificTextDialog dialog (this, "Titre du graphique", title, true, font, textColor, background);
346323
if (QDialog::Accepted != dialog.exec ( ))
347324
return;
348325

src/QwtCharts/QwtChartOptionsDialog.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,31 @@ USE_ENCODING_AUTODETECTION
4545
}
4646

4747

48-
QwtChartOptionsDialog::QwtChartOptionsDialog (
49-
QWidget* parent, QwtChartPanel* chartPanel, bool modal,
50-
const string& helpURL, const string& helpTag)
51-
: QDialog (parent),
52-
_chartOptionsPanel (0), _dlgClosurePanel (0)
48+
QwtChartOptionsDialog::QwtChartOptionsDialog (QWidget* parent, QwtChartPanel* chartPanel, bool modal, const string& helpURL, const string& helpTag)
49+
: QDialog (parent), _chartOptionsPanel (0), _dlgClosurePanel (0)
5350
{
5451
setWindowTitle (QSTR ("Editions des propriétés du graphique"));
5552
setModal (modal);
5653
if (true == modal)
5754
setWindowModality (Qt::WindowModal);
5855

5956
QVBoxLayout* layout = new QVBoxLayout (this);
57+
#ifdef QT_5
6058
layout->setMargin (QtConfiguration::margin);
59+
#else // QT_5
60+
layout->setContentsMargins (QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin);
61+
#endif // QT_5
6162
layout->setSizeConstraint (QLayout::SetMinimumSize);
6263
_chartOptionsPanel = new QwtChartOptionsPanel (this, chartPanel);
6364
layout->addWidget (_chartOptionsPanel);
6465

6566
layout->addWidget (new QLabel (" ", this));
6667

67-
_dlgClosurePanel =
68-
new QtDlgClosurePanel (this, true, "Appliquer", "Fermer", "",
69-
helpURL, helpTag);
68+
_dlgClosurePanel = new QtDlgClosurePanel (this, true, "Appliquer", "Fermer", "", helpURL, helpTag);
7069
layout->addWidget (_dlgClosurePanel);
7170
_dlgClosurePanel->setMinimumSize (_dlgClosurePanel->sizeHint ( ));
72-
connect (_dlgClosurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this,
73-
SLOT (applyCallback ( )));
74-
connect (_dlgClosurePanel->getCloseButton ( ), SIGNAL(clicked ( )), this,
75-
SLOT (accept ( )));
71+
connect (_dlgClosurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this, SLOT (applyCallback ( )));
72+
connect (_dlgClosurePanel->getCloseButton ( ), SIGNAL(clicked ( )), this, SLOT (accept ( )));
7673
_dlgClosurePanel->getApplyButton ( )->setAutoDefault (false);
7774
_dlgClosurePanel->getApplyButton ( )->setDefault (false);
7875
_dlgClosurePanel->getCloseButton ( )->setAutoDefault (false);
@@ -94,8 +91,7 @@ QwtChartOptionsDialog::QwtChartOptionsDialog (const QwtChartOptionsDialog& view)
9491
} // QwtChartOptionsDialog::QwtChartOptionsDialog (const QwtChartOptionsDialog& view)
9592

9693

97-
QwtChartOptionsDialog& QwtChartOptionsDialog::operator = (
98-
const QwtChartOptionsDialog& view)
94+
QwtChartOptionsDialog& QwtChartOptionsDialog::operator = (const QwtChartOptionsDialog& view)
9995
{
10096
assert (0 && "QwtChartOptionsDialog::operator = is not allowed.");
10197
return *this;

0 commit comments

Comments
 (0)