From e7a10091b64ddeb1d3e21e3f36abbf412021c815 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Mon, 1 Oct 2018 16:19:21 +0200 Subject: fixed many warnings --- src/data/edgestyle.cpp | 6 ++++++ src/data/graph.cpp | 2 +- src/data/graphelementdata.cpp | 8 ++++---- src/data/graphelementdata.h | 5 ++--- src/data/tikzparser.y | 2 +- src/gui/edgeitem.cpp | 4 ++++ src/gui/mainwindow.ui | 4 ++-- src/gui/stylepalette.cpp | 7 ++++--- src/gui/stylepalette.h | 4 ++-- src/gui/tikzscene.cpp | 2 +- src/gui/undocommands.cpp | 2 +- src/gui/undocommands.h | 2 -- src/main.cpp | 2 +- src/tikzit.cpp | 12 +----------- src/tikzit.h | 8 ++++---- 15 files changed, 34 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/data/edgestyle.cpp b/src/data/edgestyle.cpp index 275393e..8f3008f 100644 --- a/src/data/edgestyle.cpp +++ b/src/data/edgestyle.cpp @@ -71,6 +71,8 @@ QPen EdgeStyle::pen() const pat << 1.0 << 1.0; p.setDashPattern(pat); break; + case Solid: + break; } return p; @@ -114,6 +116,8 @@ QIcon EdgeStyle::icon() const case Flat: painter.drawLine(90,40,90,60); break; + case NoTip: + break; } switch (arrowTail()) { @@ -124,6 +128,8 @@ QIcon EdgeStyle::icon() const case Flat: painter.drawLine(10,40,10,60); break; + case NoTip: + break; } diff --git a/src/data/graph.cpp b/src/data/graph.cpp index b63289b..bba2061 100644 --- a/src/data/graph.cpp +++ b/src/data/graph.cpp @@ -341,7 +341,7 @@ void Graph::reflectNodes(QSet nds, bool horizontal) void Graph::rotateNodes(QSet nds, bool clockwise) { - QRectF bds = boundsForNodes(nds); + //QRectF bds = boundsForNodes(nds); // QPointF ctr = bds.center(); // ctr.setX((float)floor(ctr.x() * 4.0f) / 4.0f); // ctr.setY((float)floor(ctr.y() * 4.0f) / 4.0f); diff --git a/src/data/graphelementdata.cpp b/src/data/graphelementdata.cpp index 66ef16f..25ba08e 100644 --- a/src/data/graphelementdata.cpp +++ b/src/data/graphelementdata.cpp @@ -118,9 +118,9 @@ QVariant GraphElementData::data(const QModelIndex &index, int role) const QString s = (index.column() == 0) ? p.key() : p.value(); return QVariant(s); } - } else { - return QVariant(); } + + return QVariant(); } QVariant GraphElementData::headerData(int section, Qt::Orientation orientation, int role) const @@ -133,12 +133,12 @@ QVariant GraphElementData::headerData(int section, Qt::Orientation orientation, return QVariant(); } -QModelIndex GraphElementData::index(int row, int column, const QModelIndex &parent) const +QModelIndex GraphElementData::index(int row, int column, const QModelIndex &) const { return createIndex(row, column, (void*)0); } -QModelIndex GraphElementData::parent(const QModelIndex &index) const +QModelIndex GraphElementData::parent(const QModelIndex &) const { // there is no nesting, so always return an invalid index return QModelIndex(); diff --git a/src/data/graphelementdata.h b/src/data/graphelementdata.h index e57cf49..acaada7 100644 --- a/src/data/graphelementdata.h +++ b/src/data/graphelementdata.h @@ -48,9 +48,8 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const override; - QModelIndex parent(const QModelIndex &index) const override; + QModelIndex index(int row, int column, const QModelIndex &) const override; + QModelIndex parent(const QModelIndex &) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &) const override; diff --git a/src/data/tikzparser.y b/src/data/tikzparser.y index 3dfb66f..4473107 100644 --- a/src/data/tikzparser.y +++ b/src/data/tikzparser.y @@ -69,7 +69,7 @@ #define assembler yyget_extra(scanner) /* pass errors off to the assembler */ -void yyerror(YYLTYPE *yylloc, void *scanner, const char *str) { +void yyerror(YYLTYPE *yylloc, void * /*scanner*/, const char *str) { // TODO: implement reportError() //assembler->reportError(str, yylloc); qDebug() << "\nparse error: " << str << " line:" << yylloc->first_line; diff --git a/src/gui/edgeitem.cpp b/src/gui/edgeitem.cpp index 146b4e0..2f5b15c 100644 --- a/src/gui/edgeitem.cpp +++ b/src/gui/edgeitem.cpp @@ -102,6 +102,8 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge painter->drawPath(pth); break; } + case EdgeStyle::NoTip: + break; } //QPen outline = QPen(Qt::red); @@ -126,6 +128,8 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge painter->drawPath(pth); break; } + case EdgeStyle::NoTip: + break; } if (isSelected()) { diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index cae5735..8eff5ee 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -62,8 +62,8 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.SF NS Text'; font-size:13pt;"><br /></p></body></html> - - 20 + + 20.000000000000000 diff --git a/src/gui/stylepalette.cpp b/src/gui/stylepalette.cpp index 447e7a4..7423f29 100644 --- a/src/gui/stylepalette.cpp +++ b/src/gui/stylepalette.cpp @@ -89,7 +89,8 @@ void StylePalette::changeNodeStyle(int increment) if (row < 0) row += _nodeModel->rowCount(); } - QModelIndex i1 = ui->styleListView->rootIndex().child(row, 0); + //QModelIndex i1 = ui->styleListView->rootIndex().child(row, 0); + QModelIndex i1 = _nodeModel->index(row,0); ui->styleListView->selectionModel()->select(i1, QItemSelectionModel::ClearAndSelect); ui->styleListView->scrollTo(i1); } @@ -126,12 +127,12 @@ QString StylePalette::activeEdgeStyleName() } } -void StylePalette::nodeStyleDoubleClicked(const QModelIndex &index) +void StylePalette::nodeStyleDoubleClicked(const QModelIndex &) { tikzit->activeWindow()->tikzScene()->applyActiveStyleToNodes(); } -void StylePalette::edgeStyleDoubleClicked(const QModelIndex &index) +void StylePalette::edgeStyleDoubleClicked(const QModelIndex &) { qDebug() << "got double click"; tikzit->activeWindow()->tikzScene()->applyActiveStyleToEdges(); diff --git a/src/gui/stylepalette.h b/src/gui/stylepalette.h index 5943e52..fc4e253 100644 --- a/src/gui/stylepalette.h +++ b/src/gui/stylepalette.h @@ -41,8 +41,8 @@ public: public slots: - void nodeStyleDoubleClicked(const QModelIndex &index); - void edgeStyleDoubleClicked(const QModelIndex &index); + void nodeStyleDoubleClicked(const QModelIndex &); + void edgeStyleDoubleClicked(const QModelIndex &); void on_buttonOpenTikzstyles_clicked(); void on_buttonEditTikzstyles_clicked(); void on_buttonRefreshTikzstyles_clicked(); diff --git a/src/gui/tikzscene.cpp b/src/gui/tikzscene.cpp index b9afe4a..b2c5fd7 100644 --- a/src/gui/tikzscene.cpp +++ b/src/gui/tikzscene.cpp @@ -669,7 +669,7 @@ void TikzScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) if (ok) { QMap oldLabels; oldLabels.insert(ni->node(), ni->node()->label()); - ChangeLabelCommand *cmd = new ChangeLabelCommand(this, graph(), oldLabels, newLabel); + ChangeLabelCommand *cmd = new ChangeLabelCommand(this, oldLabels, newLabel); _tikzDocument->undoStack()->push(cmd); } break; diff --git a/src/gui/undocommands.cpp b/src/gui/undocommands.cpp index 50b81a4..f713582 100644 --- a/src/gui/undocommands.cpp +++ b/src/gui/undocommands.cpp @@ -395,7 +395,7 @@ void PasteCommand::redo() GraphUpdateCommand::redo(); } -ChangeLabelCommand::ChangeLabelCommand(TikzScene *scene, Graph *graph, QMap oldLabels, QString newLabel, QUndoCommand *parent) : +ChangeLabelCommand::ChangeLabelCommand(TikzScene *scene, QMap oldLabels, QString newLabel, QUndoCommand *parent) : GraphUpdateCommand(scene, parent), _oldLabels(oldLabels), _newLabel(newLabel) { } diff --git a/src/gui/undocommands.h b/src/gui/undocommands.h index 1836892..dc60549 100644 --- a/src/gui/undocommands.h +++ b/src/gui/undocommands.h @@ -165,14 +165,12 @@ class ChangeLabelCommand : public GraphUpdateCommand { public: explicit ChangeLabelCommand(TikzScene *scene, - Graph *graph, QMap oldLabels, QString newLabel, QUndoCommand *parent = 0); void undo() override; void redo() override; private: - Graph *_graph; QMap _oldLabels; QString _newLabel; }; diff --git a/src/main.cpp b/src/main.cpp index 97dbe4d..9ad40ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); a.setQuitOnLastWindowClosed(false); tikzit = new Tikzit(); - tikzit->init(&a); + tikzit->init(); if (a.arguments().length() > 1) { tikzit->open(a.arguments()[1]); diff --git a/src/tikzit.cpp b/src/tikzit.cpp index a327f9f..967d76e 100644 --- a/src/tikzit.cpp +++ b/src/tikzit.cpp @@ -36,7 +36,7 @@ Tikzit::Tikzit() : _styleFile("[default]"), _activeWindow(0) { } -void Tikzit::init(QApplication *app) +void Tikzit::init() { QSettings settings("tikzit", "tikzit"); @@ -263,16 +263,6 @@ QString Tikzit::styleFile() const return _styleFile; } -void Tikzit::focusChanged(QWidget *old, QWidget *nw) -{ -// foreach (MainWindow *w, _windows) { -// if (w->isActiveWindow()) { -// _stylePalette->raise(); -// break; -// } -// } -} - QString Tikzit::styleFilePath() const { return _styleFilePath; diff --git a/src/tikzit.h b/src/tikzit.h index 35b19de..525696d 100644 --- a/src/tikzit.h +++ b/src/tikzit.h @@ -115,7 +115,7 @@ public: void open(); void open(QString fileName); void quit(); - void init(QApplication *app); + void init(); // convenience functions for named colors QColor colorByIndex(int i); @@ -132,7 +132,7 @@ public: QString styleFilePath() const; public slots: - void focusChanged(QWidget *old, QWidget *nw); + //void focusChanged(QWidget *old, QWidget *nw); private: // void createMenu(); @@ -140,11 +140,11 @@ private: ToolPalette *_toolPalette; PropertyPalette *_propertyPalette; //StylePalette *_stylePalette; - QVector _windows; - MainWindow *_activeWindow; TikzStyles *_styles; QString _styleFile; QString _styleFilePath; + QVector _windows; + MainWindow *_activeWindow; StyleEditor *_styleEditor; QStringList _colNames; QVector _cols; -- cgit v1.2.3