Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.15)

project (QwtCharts CXX)

Expand Down
4 changes: 2 additions & 2 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#

set (QWT_CHARTS_MAJOR_VERSION "5")
set (QWT_CHARTS_MINOR_VERSION "2")
set (QWT_CHARTS_RELEASE_VERSION "1")
set (QWT_CHARTS_MINOR_VERSION "3")
set (QWT_CHARTS_RELEASE_VERSION "0")
set (QWT_CHARTS_VERSION ${QWT_CHARTS_MAJOR_VERSION}.${QWT_CHARTS_MINOR_VERSION}.${QWT_CHARTS_RELEASE_VERSION})


5 changes: 3 additions & 2 deletions src/QwtCharts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ find_package (Qwt REQUIRED) # définit ${QWT_TARGET}

include (${CMAKE_SOURCE_DIR}/cmake/version.cmake)
include (${GUIToolkitsVariables_CMAKE_DIR}/common.cmake)
include (${GUIToolkitsVariables_CMAKE_DIR}/common_qt.cmake)
include (${GUIToolkitsVariables_CMAKE_DIR}/workarounds.cmake)

find_package (QtUtil 6 REQUIRED)
find_package(Qt5Core 5 NO_CMAKE_SYSTEM_PATH) # In order to enable moc ...
find_package(Qt${QT_MAJOR}Core ${QT_MAJOR} NO_CMAKE_SYSTEM_PATH) # In order to enable moc ...

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

target_include_directories (QwtCharts PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/public>$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
Expand Down
79 changes: 28 additions & 51 deletions src/QwtCharts/QwtChartGeneralOptionsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <TkUtil/MemoryError.h>

#include <qwt_plot_layout.h>
#include <qwt_text.h>

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


QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
QWidget* parent, QwtChartPanel* chartPanel)
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (QWidget* parent, QwtChartPanel* chartPanel)
: QwtChartPanel::QwtChartEditionPanel (parent, chartPanel),
_chartPanel (chartPanel),
_backgroundColor (Qt::white),
_titleTextField (0), _titleFontPanel (0),
_cartesianButton (0), _polarButton (0),
_marginsTextField (0),
_aspectRatioCheckbox (0), _aspectRatioTextField (0)
_chartPanel (chartPanel), _backgroundColor (Qt::white), _titleTextField (0), _titleFontPanel (0),
_cartesianButton (0), _polarButton (0), _marginsTextField (0), _aspectRatioCheckbox (0), _aspectRatioTextField (0)
{
if (0 != _chartPanel)
_backgroundColor = _chartPanel->getBackgroundColor ( );
Expand All @@ -51,19 +47,15 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
vLayout->addLayout (hLayout);
QLabel* label = new QLabel ("Titre :", group);
hLayout->addWidget (label);
QString title =
0 == _chartPanel ? "" : _chartPanel->getPlot ( ).title ( ).text ( );
QString title = 0 == _chartPanel ? "" : _chartPanel->getPlot ( ).title ( ).text ( );
_titleTextField = new QtTextField (title, group);
hLayout->addWidget (_titleTextField);
QPushButton* button = new QPushButton ("Modifier ...", group);
hLayout->addWidget (button);
connect (button, SIGNAL (clicked ( )), this, SLOT (editTitleCallback ( )));
QFont font = 0 == _chartPanel ?
QApplication::font( ) : _chartPanel->getPlot ( ).title ( ).font ( );
QColor color = 0 == _chartPanel ?
Qt::black : _chartPanel->getPlot ( ).title ( ).color ( );
_titleFontPanel =
new QtFontPanel (this, font, color, QtFontPanel::HORIZONTAL_PANEL);
QFont font = 0 == _chartPanel ? QApplication::font( ) : _chartPanel->getPlot ( ).title ( ).font ( );
QColor color = 0 == _chartPanel ? Qt::black : _chartPanel->getPlot ( ).title ( ).color ( );
_titleFontPanel = new QtFontPanel (this, font, color, QtFontPanel::HORIZONTAL_PANEL);
vLayout->addWidget (_titleFontPanel);
vLayout->addStretch (2);

Expand All @@ -74,21 +66,18 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
hLayout = new QHBoxLayout ( );
group->setLayout (hLayout);
mainLayout->addWidget (group);
_cartesianButton =
new QRadioButton (QSTR ("Cartésienne"), group);
_cartesianButton = new QRadioButton (QSTR ("Cartésienne"), group);
hLayout->addWidget (_cartesianButton);
if (QwtChartPanel::CARTESIAN == chartPanel->getDisplayMode ( ))
_cartesianButton->setChecked (true);
_cartesianButton->setEnabled (
chartPanel->isDisplayModeAllowed (QwtChartPanel::CARTESIAN));
_cartesianButton->setEnabled (chartPanel->isDisplayModeAllowed (QwtChartPanel::CARTESIAN));
buttonGroup->addButton (_cartesianButton);
_polarButton = new QRadioButton ("Polaire", group);
buttonGroup->addButton (_polarButton);
hLayout->addWidget (_polarButton);
if (QwtChartPanel::POLAR == chartPanel->getDisplayMode ( ))
_polarButton->setChecked (true);
_polarButton->setEnabled (
chartPanel->isDisplayModeAllowed (QwtChartPanel::POLAR));
_polarButton->setEnabled (chartPanel->isDisplayModeAllowed (QwtChartPanel::POLAR));
hLayout->addStretch (200);

// Fond :
Expand All @@ -100,8 +89,7 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
hLayout->addWidget (label);
button = new QPushButton ("Couleur ...", group);
hLayout->addWidget (button);
connect (button, SIGNAL (clicked ( )), this,
SLOT (backgroundColorCallback ( )));
connect (button, SIGNAL (clicked ( )), this, SLOT (backgroundColorCallback ( )));
hLayout->addStretch (2);

// Marges :
Expand All @@ -113,7 +101,11 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
hLayout->addWidget (label);
int margin = 0;
if (0 != _chartPanel)
#ifdef QT_5
_chartPanel->getPlot ( ).getContentsMargins (&margin, &margin, &margin, &margin);
#else // QT_5
margin = _chartPanel->getPlot ( ).contentsMargins ( ).left ( );
#endif // QT_5
_marginsTextField = new QtIntTextField (margin, group);
_marginsTextField->setRange (0, 100);
_marginsTextField->setVisibleColumns (3);
Expand All @@ -124,16 +116,13 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
hLayout = new QHBoxLayout ( );
group->setLayout (hLayout);
mainLayout->addWidget (group);
_aspectRatioCheckbox =
new QCheckBox ("Utiliser le rapport d'aspect", group);
_aspectRatioCheckbox = new QCheckBox ("Utiliser le rapport d'aspect", group);
if (0 != _chartPanel)
_aspectRatioCheckbox->setChecked (_chartPanel->useAspectRatio ( ));
hLayout->addWidget (_aspectRatioCheckbox);
label = new QLabel ("Rapport d'aspect :", group);
hLayout->addWidget (label);
_aspectRatioTextField =
new QtDoubleTextField (0 == _chartPanel ?
1. : _chartPanel->getAspectRatio ( ), group);
_aspectRatioTextField = new QtDoubleTextField (0 == _chartPanel ? 1. : _chartPanel->getAspectRatio ( ), group);
_aspectRatioTextField->setRange (1E-6, 1E6);
hLayout->addWidget (_aspectRatioTextField);
hLayout->addStretch (2);
Expand All @@ -143,20 +132,16 @@ QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
} // QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel


QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (
const QwtChartGeneralOptionsPanel& view)
QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (const QwtChartGeneralOptionsPanel& view)
: QwtChartPanel::QwtChartEditionPanel (0, 0), _chartPanel (0),
_backgroundColor (Qt::white), _titleTextField (0), _titleFontPanel (0),
_cartesianButton (0), _polarButton (0),
_marginsTextField (0),
_aspectRatioCheckbox (0), _aspectRatioTextField (0)
_cartesianButton (0), _polarButton (0), _marginsTextField (0), _aspectRatioCheckbox (0), _aspectRatioTextField (0)
{
assert (0 && "QwtChartGeneralOptionsPanel copy constructor is not allowed.");
} // QwtChartGeneralOptionsPanel::QwtChartGeneralOptionsPanel (const QwtChartGeneralOptionsPanel& view)


QwtChartGeneralOptionsPanel& QwtChartGeneralOptionsPanel::operator = (
const QwtChartGeneralOptionsPanel& view)
QwtChartGeneralOptionsPanel& QwtChartGeneralOptionsPanel::operator = (const QwtChartGeneralOptionsPanel& view)
{
assert (0 && "QwtChartGeneralOptionsPanel::operator = is not allowed.");
return *this;
Expand Down Expand Up @@ -190,8 +175,7 @@ void QwtChartGeneralOptionsPanel::setTitle (const QwtText& title)
} // QwtChartGeneralOptionsPanel::setTitle


QwtChartPanel::DISPLAY_MODE
QwtChartGeneralOptionsPanel::getDisplayMode ( ) const
QwtChartPanel::DISPLAY_MODE QwtChartGeneralOptionsPanel::getDisplayMode ( ) const
{
assert (0 != _cartesianButton);
assert (0 != _polarButton);
Expand All @@ -205,18 +189,15 @@ QwtChartPanel::DISPLAY_MODE
} // QwtChartGeneralOptionsPanel::getDisplayMode


void QwtChartGeneralOptionsPanel::setDisplayMode (
QwtChartPanel::DISPLAY_MODE mode)
void QwtChartGeneralOptionsPanel::setDisplayMode (QwtChartPanel::DISPLAY_MODE mode)
{
assert (0 != _cartesianButton);
assert (0 != _polarButton);

switch (mode)
{
case QwtChartPanel::CARTESIAN :
_cartesianButton->setChecked (true); break;
case QwtChartPanel::POLAR :
_polarButton->setChecked (true); break;
case QwtChartPanel::CARTESIAN : _cartesianButton->setChecked (true); break;
case QwtChartPanel::POLAR : _polarButton->setChecked (true); break;
default :
{
INTERNAL_ERROR (exc, "Mode de représentation (cartésienne/polaire) indéfini.", "QwtChartGeneralOptionsPanel::setDisplayMode")
Expand Down Expand Up @@ -244,8 +225,7 @@ unsigned int QwtChartGeneralOptionsPanel::getMargins ( ) const
if (0 > _marginsTextField->getValue ( ))
{
UTF8String msg (charset);
msg << "La valeur " << (unsigned long)_marginsTextField->getValue ( )
<< " est négative alors qu'elle devrait être positive ou nulle.";
msg << "La valeur " << (unsigned long)_marginsTextField->getValue ( ) << " est négative alors qu'elle devrait être positive ou nulle.";
INTERNAL_ERROR (exc, msg, "QwtChartGeneralOptionsPanel::getMargins")
throw exc;
} // if (0 > _marginsTextField->getValue ( ))
Expand Down Expand Up @@ -335,14 +315,11 @@ void QwtChartGeneralOptionsPanel::editTitleCallback ( )

try
{
UTF8String title (
QtUnicodeHelper::qstringToUTF8String (_titleTextField->text( )));
UTF8String title (QtUnicodeHelper::qstringToUTF8String (_titleTextField->text( )));
QFont font = _titleFontPanel->getFont ( );
QColor textColor = _titleFontPanel->getColor ( );
QColor background = getBackgroundColor ( );
QtScientificTextDialog dialog (
this, "Titre du graphique", title, true, font,
textColor, background);
QtScientificTextDialog dialog (this, "Titre du graphique", title, true, font, textColor, background);
if (QDialog::Accepted != dialog.exec ( ))
return;

Expand Down
24 changes: 10 additions & 14 deletions src/QwtCharts/QwtChartOptionsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,31 @@ USE_ENCODING_AUTODETECTION
}


QwtChartOptionsDialog::QwtChartOptionsDialog (
QWidget* parent, QwtChartPanel* chartPanel, bool modal,
const string& helpURL, const string& helpTag)
: QDialog (parent),
_chartOptionsPanel (0), _dlgClosurePanel (0)
QwtChartOptionsDialog::QwtChartOptionsDialog (QWidget* parent, QwtChartPanel* chartPanel, bool modal, const string& helpURL, const string& helpTag)
: QDialog (parent), _chartOptionsPanel (0), _dlgClosurePanel (0)
{
setWindowTitle (QSTR ("Editions des propriétés du graphique"));
setModal (modal);
if (true == modal)
setWindowModality (Qt::WindowModal);

QVBoxLayout* layout = new QVBoxLayout (this);
#ifdef QT_5
layout->setMargin (QtConfiguration::margin);
#else // QT_5
layout->setContentsMargins (QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin);
#endif // QT_5
layout->setSizeConstraint (QLayout::SetMinimumSize);
_chartOptionsPanel = new QwtChartOptionsPanel (this, chartPanel);
layout->addWidget (_chartOptionsPanel);

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

_dlgClosurePanel =
new QtDlgClosurePanel (this, true, "Appliquer", "Fermer", "",
helpURL, helpTag);
_dlgClosurePanel = new QtDlgClosurePanel (this, true, "Appliquer", "Fermer", "", helpURL, helpTag);
layout->addWidget (_dlgClosurePanel);
_dlgClosurePanel->setMinimumSize (_dlgClosurePanel->sizeHint ( ));
connect (_dlgClosurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this,
SLOT (applyCallback ( )));
connect (_dlgClosurePanel->getCloseButton ( ), SIGNAL(clicked ( )), this,
SLOT (accept ( )));
connect (_dlgClosurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this, SLOT (applyCallback ( )));
connect (_dlgClosurePanel->getCloseButton ( ), SIGNAL(clicked ( )), this, SLOT (accept ( )));
_dlgClosurePanel->getApplyButton ( )->setAutoDefault (false);
_dlgClosurePanel->getApplyButton ( )->setDefault (false);
_dlgClosurePanel->getCloseButton ( )->setAutoDefault (false);
Expand All @@ -94,8 +91,7 @@ QwtChartOptionsDialog::QwtChartOptionsDialog (const QwtChartOptionsDialog& view)
} // QwtChartOptionsDialog::QwtChartOptionsDialog (const QwtChartOptionsDialog& view)


QwtChartOptionsDialog& QwtChartOptionsDialog::operator = (
const QwtChartOptionsDialog& view)
QwtChartOptionsDialog& QwtChartOptionsDialog::operator = (const QwtChartOptionsDialog& view)
{
assert (0 && "QwtChartOptionsDialog::operator = is not allowed.");
return *this;
Expand Down
Loading