6 changes: 3 additions & 3 deletions src/libkstapp/datamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ DataManager::DataManager(QWidget *parent, Document *doc)
_session->header()->setResizeMode(QHeaderView::ResizeToContents);
_session->setContextMenuPolicy(Qt::CustomContextMenu);
_session->setSortingEnabled(true);
_session->sortByColumn(1); // Sort by type by default
_session->sortByColumn(1, Qt::AscendingOrder); // Sort by type by default
_session->setUniformRowHeights(true);
connect(_session, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(showContextMenu(QPoint)));
Expand Down Expand Up @@ -158,15 +158,15 @@ void DataManager::showContextMenu(const QPoint &position) {

foreach (PlotItemInterface *plot, Data::self()->plotList()) {
action = new QAction(plot->plotName(), this);
action->setData(qVariantFromValue(plot));
action->setData(QVariant::fromValue(plot));
addMenu->addAction(action);

PlotItem* plotItem = static_cast<PlotItem*>(plot);
if (plotItem) {
foreach (PlotRenderItem* renderItem, plotItem->renderItems()) {
if (renderItem->relationList().contains(r)) {
action = new QAction(plot->plotName(), this);
action->setData(qVariantFromValue(plot));
action->setData(QVariant::fromValue(plot));
removeMenu->addAction(action);
break;
}
Expand Down
14 changes: 7 additions & 7 deletions src/libkstapp/datawizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ void DataWizardPagePlot::updatePlotBox() {
}

foreach (PlotItemInterface *plot, Data::self()->plotList()) {
_existingPlotName->addItem(plot->plotName(), qVariantFromValue(plot));
_existingPlotName->addItem(plot->plotName(), QVariant::fromValue(plot));
}
bool havePlots = _existingPlotName->count() > 0;
_cycleExisting->setEnabled(havePlots);
Expand Down Expand Up @@ -874,7 +874,7 @@ QStringList DataWizard::dataSourceIndexList() const {
void DataWizard::finished() {
DataVectorList vectors;
uint n_curves = 0;
uint n_steps = 0;
// uint n_steps = 0;

dialogDefaults().setValue("wizard/updateType", _pageDataSource->updateType());
dialogDefaults().setValue("wizard/doPSD", _pageDataPresentation->plotPSD());
Expand Down Expand Up @@ -986,15 +986,15 @@ void DataWizard::finished() {
return;
}

n_steps += _pageVectors->plotVectors()->count();
if (_pageDataPresentation->plotPSD()) {
n_steps += _pageVectors->plotVectors()->count();
}
// n_steps += _pageVectors->plotVectors()->count();
// if (_pageDataPresentation->plotPSD()) {
// n_steps += _pageVectors->plotVectors()->count();
// }

VectorPtr xv;
// only create x vector if needed
if (_pageDataPresentation->createXAxisFromField()) {
n_steps += 1; // for the creation of the x-vector
//n_steps += 1; // for the creation of the x-vector

const QString field = _pageDataPresentation->vectorField();

Expand Down
2 changes: 1 addition & 1 deletion src/libkstapp/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ bool Document::open(const QString& file) {
QBrush brush;
QStringRef av = attrs.value("gradient");
if (!av.isNull()) {
QStringList stopInfo = av.toString().split(',', QString::SkipEmptyParts);
QStringList stopInfo = av.toString().split(',', Qt::SkipEmptyParts);
QLinearGradient gradient(1,0,0,0);
gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
for (int i = 0; i < stopInfo.size(); i+=2) {
Expand Down
2 changes: 1 addition & 1 deletion src/libkstapp/formatgridhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool findNextEdgeLocation(QList<AutoFormatEdges> &edges, QList<qreal> &locations
void convertEdgeLocationsToGrid(const QList<qreal> &locations, QList<int> &grid_locations) {

QList<qreal> sorted_locations(locations);
qSort(sorted_locations);
std::sort(sorted_locations.begin(), sorted_locations.end());

int n_loc = locations.size();
for (int i_unsorted = 0; i_unsorted<n_loc; i_unsorted++) {
Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/labelrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class RenderContext : public QObject {

inline int fontWidth(const QString& txt) const {
if (p) {
return p->fontMetrics().width(txt);
return p->fontMetrics().horizontalAdvance(txt);
} else {
return _fm.width(txt);
return _fm.horizontalAdvance(txt);
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/libkstapp/logdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ void LogDialog::ok() {
void LogDialog::runScript() {
QString script = _script->text().simplified().replace("$imagefile",_imagename).
replace("$messagefile", _msgfilename).replace("$user", _username);

_proc->start(script);
QStringList args = QProcess::splitCommand(script);
if (!args.isEmpty()) {
QString cmd = args.first();
args.removeFirst();
_proc->start(cmd, args);
}
}


Expand Down
14 changes: 7 additions & 7 deletions src/libkstapp/plotaxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ double PlotAxis::convertJDtoCTime(double jdIn) {
jdIn *= 24.0*3600.0;

if (jdIn > double(std::numeric_limits<time_t>::max())-1.0) {
jdIn = std::numeric_limits<time_t>::max()-1;
jdIn = double(std::numeric_limits<time_t>::max())-1.0;
}
if (jdIn<0) {
jdIn = 0.0;
Expand Down Expand Up @@ -241,7 +241,7 @@ QString PlotAxis::convertJDToDateString(double jd, double range_jd) {
if (accuracy > 0) {
QString strSecond;

strSecond.sprintf("%02.*f", accuracy, second);
strSecond.asprintf("%02.*f", accuracy, second);
for (int i=strSecond.length()-1; i>0; i--) {
if (strSecond.at(i) == '0') {
accuracy--;
Expand All @@ -257,15 +257,15 @@ QString PlotAxis::convertJDToDateString(double jd, double range_jd) {

QString seconds;
QString hourminute;
hourminute.sprintf(" %02d:%02d:", hour, minute);
seconds.sprintf("%02.*f", accuracy, second);
hourminute.asprintf(" %02d:%02d:", hour, minute);
seconds.asprintf("%02.*f", accuracy, second);
switch (_axisDisplay) {
case AXIS_DISPLAY_YYMMDDHHMMSS_SS:
label.sprintf("%d/%02d/%02d", year, month, day);
label.asprintf("%d/%02d/%02d", year, month, day);
label += hourminute + seconds;
break;
case AXIS_DISPLAY_DDMMYYHHMMSS_SS:
label.sprintf("%02d/%02d/%d", day, month, year);
label.asprintf("%02d/%02d/%d", day, month, year);
label += hourminute + seconds;
break;
case AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
Expand All @@ -275,7 +275,7 @@ QString PlotAxis::convertJDToDateString(double jd, double range_jd) {
break;
case AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
date.setDate(year, month, day);
label = date.toString(Qt::LocalDate).toLatin1();
label = QLocale::system().toString(date, QLocale::ShortFormat); //date.toString(Qt::LocalDate).toLatin1();
label += hourminute + seconds;
break;
case AXIS_DISPLAY_QTDATETIME_FORMAT:
Expand Down
16 changes: 8 additions & 8 deletions src/libkstapp/plotitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,10 +1569,10 @@ static void PaintNumber(QPainter *painter, const QRectF rec, int flags, const QS
base_mantisa[1].remove(']');
base_mantisa.append(QString(']'));
}
qreal w = painter->fontMetrics().width(base_mantisa[0] + base) +
painter->fontMetrics().width(base_mantisa[1])*superscript_scale;
qreal w = painter->fontMetrics().horizontalAdvance(base_mantisa[0] + base) +
painter->fontMetrics().horizontalAdvance(base_mantisa[1])*superscript_scale;
if (base_mantisa.size()>2) {
w += painter->fontMetrics().width(base_mantisa[2]);
w += painter->fontMetrics().horizontalAdvance(base_mantisa[2]);
}
if (flags & Qt::AlignRight) {
qreal right = r.right();
Expand All @@ -1586,17 +1586,17 @@ static void PaintNumber(QPainter *painter, const QRectF rec, int flags, const QS
QPointF p = QPointF(r.topLeft().x(), r.center().y()+painter->fontMetrics().boundingRect('0').height()/2);
//painter->drawRect(r);
painter->drawText(p, base_mantisa[0]);
p.setX(p.x() + painter->fontMetrics().width(base_mantisa[0]));
p.setX(p.x() + painter->fontMetrics().horizontalAdvance(base_mantisa[0]));
painter->drawText(p,base);
qreal ly = p.y();
p.setX(p.x() + painter->fontMetrics().width(base));
p.setX(p.x() + painter->fontMetrics().horizontalAdvance(base));
p.setY(p.y() - superscript_raise * painter->fontMetrics().height());
painter->save();
QFont f = painter->font();
f.setPointSizeF(f.pointSizeF()*superscript_scale);
painter->setFont(f);
painter->drawText(p,base_mantisa[1]);
p.setX(p.x() + painter->fontMetrics().width(base_mantisa[1]));
p.setX(p.x() + painter->fontMetrics().horizontalAdvance(base_mantisa[1]));
painter->restore();
if (base_mantisa.size()>2) {
p.setY(ly);
Expand Down Expand Up @@ -1929,8 +1929,8 @@ void PlotItem::setSharedAxisBox(SharedAxisBoxItem* parent) {
setTiedZoom(false, false);
}
setInSharedAxisBox(true);
setAllowedGripModes(0);
setFlags(0);
setAllowedGripModes(QFlag(0));
setFlags(QFlag(0));
setParentViewItem(parent);
//setBrush(Qt::transparent);

Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/plotitemmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ QList<PlotItem*> PlotItemManager::plotsForView(View *view) {
}
}

qSort(plot_items.begin(), plot_items.end(), shortNameLessThan);
std::sort(plot_items.begin(), plot_items.end(), shortNameLessThan);

return plot_items;
}
Expand All @@ -203,7 +203,7 @@ QList<ViewItem*> PlotItemManager::tieableItemsForView(View *view) {
}
}

qSort(view_items.begin(), view_items.end(), shortNameLessThan);
std::sort(view_items.begin(), view_items.end(), shortNameLessThan);

return view_items;

Expand Down
8 changes: 4 additions & 4 deletions src/libkstapp/plotrenderitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ PlotRenderItem::PlotRenderItem(PlotItem *parentItem)
setTypeName(tr("Plot Render"));
setParentViewItem(parentItem);
setHasStaticGeometry(true);
setAllowedGripModes(0);
setAllowedGrips(0);
setAllowedGripModes(QFlag(0));
setAllowedGrips(QFlag(0));

connect(parentItem, SIGNAL(geometryChanged()),
this, SLOT(updateGeometry()));
Expand Down Expand Up @@ -471,7 +471,7 @@ void PlotRenderItem::keyPressEvent(QKeyEvent *event) {
return;
}

Qt::KeyboardModifiers modifiers = 0;
Qt::KeyboardModifiers modifiers = QFlag(0);


if (event->key()== Qt::Key_Shift) {
Expand Down Expand Up @@ -631,7 +631,7 @@ void PlotRenderItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
return;
}

if (event->button() == Qt::MidButton) {
if (event->button() == Qt::MiddleButton) {
plotItem()->zoomPrevious();
event->ignore();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libkstapp/plotrenderitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class PlotRenderItem : public ViewItem
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);

void setCursorsMode(QPointF p, Qt::KeyboardModifiers modifiers=0);
void setCursorsMode(QPointF p, Qt::KeyboardModifiers modifiers=QFlag(0));

virtual QPainterPath shape() const;

Expand Down
9 changes: 5 additions & 4 deletions src/libkstapp/sessionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ int SessionModel::columnCount(const QModelIndex& parent) const {


void SessionModel::triggerReset() {
beginResetModel();
generateObjectList();
reset();
endResetModel();
}


Expand Down Expand Up @@ -113,15 +114,15 @@ QVariant SessionModel::data(const QModelIndex& index, int role) const {
const int vectorCount = parent->outputVectors().count();
if (index.row() < vectorCount) {
if (VectorPtr v = parent->outputVectors().values()[index.row()]) {
return qVariantFromValue(v.data());
return QVariant::fromValue(v.data());
}
} else if (MatrixPtr m = parent->outputMatrices().values()[index.row() - vectorCount]) {
return qVariantFromValue(m.data());
return QVariant::fromValue(m.data());
}
} else {
Q_ASSERT(_store);
DataObjectPtr p = kst_cast<DataObject>(_objectList.at(index.row()));
return qVariantFromValue(p.data());
return QVariant::fromValue(p.data());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/libkstapp/sharedaxisboxitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ void SharedAxisBoxItem::lockItems() {
continue;

if (PlotItem *plotItem = qobject_cast<PlotItem*>(viewItem)) {
plotItem->setAllowedGripModes(0);
plotItem->setFlags(0);
plotItem->setAllowedGripModes(QFlag(0));
plotItem->setFlags(QFlag(0));

_sharedPlots << plotItem;
}
Expand Down
8 changes: 5 additions & 3 deletions src/libkstapp/vectormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ bool VectorModel::addVector(VectorPtr v)
{
assert(v);
if (!_vectorList.contains(v)) {
beginResetModel();
beginInsertColumns(QModelIndex(), columnCount(), columnCount());
_vectorList.append(v);
// Standard nb of digits:
_digitNbList.append(dialogDefaults().value("viewvector/digits",12).toInt());
endInsertColumns();
reset();
endResetModel();
_rows = rowCount();
return true;
}
Expand Down Expand Up @@ -154,15 +155,16 @@ bool VectorModel::setData(const QModelIndex& index, const QVariant& value, int r
return false;
}

qDebug() << "UGLY!! Add setData API to KstVector!";
//qDebug() << "UGLY!! Add setData API to KstVector!";
double *d = const_cast<double*>(_vectorList.at(index.column())->value());
d[index.row()] = v;
return true;
}

void VectorModel::resetIfChanged() {
if (_rows!=rowCount()) {
reset();
beginResetModel();
endResetModel();
_rows = rowCount();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/libkstapp/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ bool View::event(QEvent *event) {

// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-8188
// also see PlotRenderItem::hoverEnterEvent, there is a workaround.
//if (viewItem && viewItem->tryShortcut(e->key())) {
if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key())) {
//if (viewItem && viewItem->tryShortcut(e->key())) {
if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key().toString())) {
return true;
}
}
Expand Down Expand Up @@ -722,7 +722,7 @@ QList<ViewItem*> View::layoutableViewItems() {
}
}

qSort(layoutable_view_items.begin(), layoutable_view_items.end(), shortNameLessThan);
std::sort(layoutable_view_items.begin(), layoutable_view_items.end(), shortNameLessThan);

return layoutable_view_items;

Expand Down
6 changes: 3 additions & 3 deletions src/libkstapp/viewitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ViewItem::ViewItem(View *parentView) :
{
_initializeShortName();
setZValue(DRAWING_ZORDER);
setAcceptsHoverEvents(true);
setAcceptHoverEvents(true);
setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable);
connect(parentView, SIGNAL(mouseModeChanged(View::MouseMode)),
this, SLOT(viewMouseModeChanged(View::MouseMode)));
Expand Down Expand Up @@ -395,7 +395,7 @@ bool ViewItem::parse(QXmlStreamReader &xml, bool &validChildTag) {
QBrush brush;
av = attrs.value("gradient");
if (!av.isNull()) {
QStringList stopInfo = av.toString().split(',', QString::SkipEmptyParts);
QStringList stopInfo = av.toString().split(',', Qt::SkipEmptyParts);
QLinearGradient gradient(1,0,0,0);
gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
for (int i = 0; i < stopInfo.size(); i+=2) {
Expand Down Expand Up @@ -2368,7 +2368,7 @@ void ViewItem::viewMouseModeChanged(View::MouseMode oldMode) {
void ViewItem::registerShortcut(QAction *action) {
Q_ASSERT(action->parent() == this);
view()->grabShortcut(action->shortcut());
_shortcutMap.insert(action->shortcut(), action);
_shortcutMap.insert(action->shortcut().toString(), action);
}


Expand Down
5 changes: 3 additions & 2 deletions src/libkstapp/viewvectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ViewVectorDialog::ViewVectorDialog(QWidget *parent, Document *doc)

_vectors->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
// Allow reorganizing the columns per drag&drop
_vectors->horizontalHeader()->setMovable(true);
_vectors->horizontalHeader()->setSectionsMovable(true);

// Custom context menu for the remove action and display format
setContextMenuPolicy(Qt::CustomContextMenu);
Expand Down Expand Up @@ -106,6 +106,7 @@ void ViewVectorDialog::show() {
}

void ViewVectorDialog::contextMenu(const QPoint& position) {
Q_UNUSED(position)
QMenu menu;
QPoint cursor = QCursor::pos();
QAction* removeAction = menu.addAction(tr("Remove"));
Expand Down Expand Up @@ -213,7 +214,7 @@ QList<int> ViewVectorDialog::selectedColumns() {
}
}
// Sort the columns in descending order
qSort(columns.begin(), columns.end(), qGreater<int>());
std::sort(columns.begin(), columns.end(), std::greater<int>());
return columns;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libkstmath/colorsequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Kst {

static const QLatin1String& KstColorSequenceName = QLatin1String("KstColors");
//static const QLatin1String& KstColorSequenceName = QLatin1String("KstColors");


ColorSequence *ColorSequence::_self = &ColorSequence::self();
Expand Down
4 changes: 2 additions & 2 deletions src/libkstmath/dataobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ void DataObject::writeLockInputsAndOutputs() const {
outputs += (*i).data();
}

qSort(inputs);
qSort(outputs);
std::sort(inputs.begin(), inputs.end());
std::sort(outputs.begin(), outputs.end());

QList<PrimitivePtr>::ConstIterator inputIt = inputs.constBegin();
QList<PrimitivePtr>::ConstIterator outputIt = outputs.constBegin();
Expand Down
26 changes: 13 additions & 13 deletions src/libkstmath/escan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,9 @@ extern int yylex (void);
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;

#line 21 "escan.l"

Expand Down Expand Up @@ -742,7 +742,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
Expand Down Expand Up @@ -1130,9 +1130,9 @@ ECHO;
*/
static int yy_get_next_buffer (void)
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = (yytext_ptr);
int number_to_move, i;
int ret_val;

if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
Expand Down Expand Up @@ -1264,14 +1264,14 @@ static int yy_get_next_buffer (void)

static yy_state_type yy_get_previous_state (void)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;

yy_current_state = (yy_start);

for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
Expand All @@ -1296,10 +1296,10 @@ static int yy_get_next_buffer (void)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
int yy_is_jam;
char *yy_cp = (yy_c_buf_p);

register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
Expand Down
1 change: 0 additions & 1 deletion src/libkstmath/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ void Image::updatePaintObjects(const CurveRenderContext& context) {
}

// color map
QColor thisPixel;
MatrixPtr m = _inputMatrices.value(THEMATRIX);

if (image->hasColorMap()) {
Expand Down
4 changes: 2 additions & 2 deletions src/libkstmath/relation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ void Relation::writeLockInputsAndOutputs() const {
outputs += (*i).data();
}

qSort(inputs);
qSort(outputs);
std::sort(inputs.begin(), inputs.end());
std::sort(outputs.begin(), outputs.end());

QList<PrimitivePtr>::ConstIterator inputIt = inputs.constBegin();
QList<PrimitivePtr>::ConstIterator outputIt = outputs.constBegin();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/filters/cumulativesum/cumulativesum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ bool CumulativeSumSource::algorithm() {
double s_in = inputScalar->value();
int len = inputVector->length();

v_out[0] = v_in[0];
v_out[0] = v_in[0]*s_in;

for (int i = 1; i < len; i++) {
v_out[i] = v_in[i]*s_in + v_out[i-1];
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/fits/non_linear_weighted.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int function_f( const gsl_vector* pVectorX, void* pParams, gsl_vector* pVectorF
dParameters[i] = gsl_vector_get( pVectorX, i );
}

for( i=0; i<pData->n; i++ ) {
for( i=0; (unsigned long)i<pData->n; i++ ) {
dY = function_calculate( pData->pdX[i], dParameters );
gsl_vector_set( pVectorF, i, (dY - pData->pdY[i])*pData->pdWeight[i] );
}
Expand All @@ -77,7 +77,7 @@ int function_df( const gsl_vector* pVectorX, void* pParams, gsl_matrix* pMatrixJ
dParameters[i] = gsl_vector_get( pVectorX, i );
}

for( i=0; i<pData->n; i++ ) {
for( i=0; (unsigned long)i<pData->n; i++ ) {
function_derivative( pData->pdX[i], dParameters, dDerivatives );

for( j=0; j<n_params; j++ ) {
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/cclineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CategoricalCompleter::CategoricalCompleter(QLineEdit *lineEdit, QList<Completion
setCompletionMode(PopupCompletion);
setCaseSensitivity(Qt::CaseInsensitive);
setWrapAround(false);
qSort(_data.begin(),_data.end());
std::sort(_data.begin(),_data.end());
connect(_tableView,SIGNAL(activateHint(QString)),this,SIGNAL(activated(QString)));
}

Expand All @@ -74,7 +74,7 @@ CategoricalCompleter::CategoricalCompleter(QTextEdit *textEdit, QList<Completion
setCompletionMode(PopupCompletion);
setCaseSensitivity(Qt::CaseInsensitive);
setWrapAround(false);
qSort(_data.begin(),_data.end());
std::sort(_data.begin(),_data.end());
connect(_tableView,SIGNAL(activateHint(QString)),this,SIGNAL(activated(QString)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/curveplacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void CurvePlacement::updatePlotListCombo() {

_plotList->clear();
foreach (PlotItemInterface *plot, _plots) {
_plotList->addItem(plot->plotCleanedName(), qVariantFromValue(plot));
_plotList->addItem(plot->plotCleanedName(), QVariant::fromValue(plot));
}

if ((xi>0) && (xi<_plotList->count())) {
Expand Down
7 changes: 2 additions & 5 deletions src/widgets/curveplacement.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<width>438</width>
<height>245</height>
</rect>
</property>
Expand Down Expand Up @@ -94,10 +94,7 @@
<enum>QComboBox::InsertAtTop</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
<property name="autoCompletion">
<bool>true</bool>
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
Expand Down
8 changes: 4 additions & 4 deletions src/widgets/curveselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool CurveSelector::selectedCurveDirty() const {
void CurveSelector::setSelectedCurve(CurvePtr selectedCurve) {
//FIXME: findData doesn't work, but the loop here - which is supposed
// to do exactly the same thing - does. WHY???
//int i = _curve->findData(qVariantFromValue(selectedVector.data()));
//int i = _curve->findData(QVariant::fromValue(selectedVector.data()));
int i=-1;
for (int j=0; j<_curve->count() ; j++) {
if (selectedCurve.data() == _curve->itemData(j).value<Curve*>()) {
Expand Down Expand Up @@ -88,7 +88,7 @@ void CurveSelector::setAllowEmptySelection(bool allowEmptySelection) {
_curve->removeItem(i);

if (_allowEmptySelection) {
_curve->insertItem(0, tr("<None>"), qVariantFromValue(0));
_curve->insertItem(0, tr("<None>"), QVariant::fromValue(0));
_curve->setCurrentIndex(0);
}
}
Expand All @@ -114,14 +114,14 @@ void CurveSelector::fillCurves() {

QStringList list = curves.keys();

qSort(list);
std::sort(list.begin(), list.end());

CurvePtr current = selectedCurve();

_curve->clear();
foreach (const QString &string, list) {
CurvePtr r = curves.value(string);
_curve->addItem(string, qVariantFromValue(r.data()));
_curve->addItem(string, QVariant::fromValue(r.data()));
}

if (_allowEmptySelection) //reset the <None>
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dialogdefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ QBrush dialogDefaultsBrush(const QString &group_name, bool default_no_fill) {
if (useGradient) {
QStringList stopInfo =
dialogDefaults().value(group_name +"/fillBrushGradient", "0,#000000,1,#ffffff,").
toString().split(',', QString::SkipEmptyParts);
toString().split(',', Qt::SkipEmptyParts);
QLinearGradient gradient(1,0,0,0);
gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
for (int i = 0; i < stopInfo.size(); i+=2) {
Expand Down
5 changes: 2 additions & 3 deletions src/widgets/gradienteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ void GradientEditor::mouseReleaseEvent(QMouseEvent *event) {
return;
}

bool ok;
QRgb color = QColorDialog::getRgba(Qt::white, &ok, parentWidget());
if (ok) {
QColor color = QColorDialog::getColor(Qt::white, parentWidget());
if (color.isValid()) {
int position = event->pos().x();
Stop stop;
stop.pos = position;
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/matrixselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void MatrixSelector::matrixSelected(QString) {
}

void MatrixSelector::setSelectedMatrix(MatrixPtr selectedMatrix) {
int i = _matrix->findData(qVariantFromValue(selectedMatrix.data()));
int i = _matrix->findData(QVariant::fromValue(selectedMatrix.data()));
if (i != -1) {
_matrix->setCurrentIndex(i);
}
Expand Down Expand Up @@ -137,14 +137,14 @@ void MatrixSelector::fillMatrices() {

QStringList list = matrices.keys();

qSort(list);
std::sort(list.begin(), list.end());

MatrixPtr current = selectedMatrix();

_matrix->clear();
foreach (const QString &string, list) {
MatrixPtr m = matrices.value(string);
_matrix->addItem(string, qVariantFromValue(m.data()));
_matrix->addItem(string, QVariant::fromValue(m.data()));
}

if (current)
Expand Down
15 changes: 12 additions & 3 deletions src/widgets/matrixselector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>271</width>
<height>26</height>
<height>38</height>
</rect>
</property>
<property name="whatsThis">
Expand All @@ -17,13 +17,22 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Kst::ComboBox" name="_matrix">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
Expand Down
16 changes: 8 additions & 8 deletions src/widgets/scalarselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ void ScalarSelector::setIsFOverSR(bool is_f_over_sr)
_SR->show();

QSize size = _scalar->size();
size.setWidth(fontMetrics().width("000000000"));
size.setWidth(fontMetrics().horizontalAdvance("000000000"));
_SR->setMinimumSize(size);
_cutoff->setMinimumSize(size);

size.setWidth(fontMetrics().width("0000000000000"));
size.setWidth(fontMetrics().horizontalAdvance("0000000000000"));
_scalar->setMinimumSize(size);

//setMinimumWidth(3*min_width + _cutoffLabel->width() + _SRLabel->width()+3*_newScalar->width());
Expand All @@ -103,7 +103,7 @@ void ScalarSelector::setIsFOverSR(bool is_f_over_sr)
}

QSize ScalarSelector::minimumSizeHint() const {
return QSize(15*fontMetrics().width("m")+ 3 * iconWidth(), iconWidth());
return QSize(15*fontMetrics().horizontalAdvance("m")+ 3 * iconWidth(), iconWidth());
}


Expand All @@ -129,7 +129,7 @@ void ScalarSelector::setDefaultValue(double value) {
QString string = QString::number(value);
int index = _scalar->findText(string);
if (index<0) {
_scalar->addItem(string, qVariantFromValue(0));
_scalar->addItem(string, QVariant::fromValue(0));
_scalar->setCurrentIndex(_scalar->findText(string));
} else {
_scalar->setCurrentIndex(index);
Expand Down Expand Up @@ -312,15 +312,15 @@ void ScalarSelector::fillScalars() {

QStringList list = scalars.keys();

qSort(list);
std::sort(list.begin(), list.end());

QString current_text = _scalar->currentText();
ScalarPtr current = _scalar->itemData(_scalar->currentIndex()).value<Scalar*>();

_scalar->clear();
foreach (const QString &string, list) {
ScalarPtr v = scalars.value(string);
_scalar->addItem(string, qVariantFromValue(v.data()));
_scalar->addItem(string, QVariant::fromValue(v.data()));
}

_scalarListSelector->clear();
Expand All @@ -329,7 +329,7 @@ void ScalarSelector::fillScalars() {
if (current) {
setSelectedScalar(current);
} else {
_scalar->addItem(current_text, qVariantFromValue(0));
_scalar->addItem(current_text, QVariant::fromValue(0));
_scalar->setCurrentIndex(_scalar->findText(current_text));
_defaultsSet = true;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ void ScalarSelector::updateFields(ControlField control_field) {
ratio = cutoff/frequency;
setDefaultValue(ratio);
//QString string = QString::number(ratio, 'g', 12);
//_scalar->addItem(string, qVariantFromValue(0));
//_scalar->addItem(string, QVariant::fromValue(0));
//_scalar->setCurrentIndex(_scalar->findText(string));
//_scalar->setCurrentText(QString::number(ratio, 'g', 12));
} else if (control_field == SampleRate) { // Cutoff follows SR. Keep ratio fixed
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/scalarselector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>570</width>
<height>34</height>
<height>38</height>
</rect>
</property>
<property name="whatsThis">
Expand Down Expand Up @@ -44,7 +44,7 @@
<bool>true</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/stringselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ void StringSelector::fillStrings() {

QStringList list = strings.keys();

qSort(list);
std::sort(list.begin(), list.end());

StringPtr current = selectedString();

_string->clear();
foreach (const QString &string, list) {
StringPtr s = strings.value(string);
_string->addItem(string, qVariantFromValue(s.data()));
_string->addItem(string, QVariant::fromValue(s.data()));
}

if (_allowEmptySelection) //reset the <None>
Expand All @@ -157,7 +157,7 @@ void StringSelector::setAllowEmptySelection(bool allowEmptySelection) {
_string->removeItem(i);

if (_allowEmptySelection) {
_string->insertItem(0, tr("<None>"), qVariantFromValue(0));
_string->insertItem(0, tr("<None>"), QVariant::fromValue(0));
_string->setCurrentIndex(0);
}
}
Expand Down
15 changes: 12 additions & 3 deletions src/widgets/stringselector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>296</width>
<height>35</height>
<height>38</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -20,7 +20,16 @@
<string>Select a string to utilize. If you wish to create a new string, select the icon to the right.</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand All @@ -32,7 +41,7 @@
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
Expand Down
10 changes: 5 additions & 5 deletions src/widgets/vectorselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int VectorSelector::iconWidth() const {
}

QSize VectorSelector::minimumSizeHint() const {
return QSize(15*fontMetrics().width("m")+ 2 * iconWidth(), iconWidth());
return QSize(15*fontMetrics().horizontalAdvance("m")+ 2 * iconWidth(), iconWidth());
}


Expand Down Expand Up @@ -110,7 +110,7 @@ void VectorSelector::setSelectedVector(VectorPtr selectedVector) {
return;
}
// "findData can't work here" says the trolls... so we do it 'manually'.
//int i = _vector->findData(qVariantFromValue(selectedVector.data()));
//int i = _vector->findData(QVariant::fromValue(selectedVector.data()));
int i=-1;
for (int j=0; j<_vector->count() ; ++j) {
if (selectedVector.data() == _vector->itemData(j).value<Vector*>()) {
Expand Down Expand Up @@ -141,7 +141,7 @@ void VectorSelector::setAllowEmptySelection(bool allowEmptySelection) {
_vector->removeItem(i);

if (_allowEmptySelection) {
_vector->insertItem(0, tr("<None>"), qVariantFromValue(0));
_vector->insertItem(0, tr("<None>"), QVariant::fromValue(0));
_vector->setCurrentIndex(0);
_editVector->setEnabled(false);
}
Expand Down Expand Up @@ -229,12 +229,12 @@ void VectorSelector::fillVectors() {

QStringList list = vectors.keys();

qSort(list);
std::sort(list.begin(), list.end());

_vector->clear();
foreach (const QString &string, list) {
VectorPtr v = vectors.value(string);
_vector->addItem(string, qVariantFromValue(v.data()));
_vector->addItem(string, QVariant::fromValue(v.data()));
}
_editVector->setEnabled(_vector->count() > 0);

Expand Down