diff --git a/app/configappearancewidget.cpp b/app/configappearancewidget.cpp index 50fa0d5..3e6f7d1 100644 --- a/app/configappearancewidget.cpp +++ b/app/configappearancewidget.cpp @@ -117,7 +117,7 @@ void ConfigAppearanceWidget::setItemToolTip(QTableWidgetItem *item, const QFont { const QFontMetrics metrics(font); ui.itemTable->setRowHeight(m_itemHighlighted, metrics.height() + m_itemMargin); - if (metrics.width(item->text()) >= ui.itemTable->contentsRect().width() - 30) + if (metrics.horizontalAdvance(item->text()) >= ui.itemTable->contentsRect().width() - 30) item->setToolTip(item->text()); else item->setToolTip(QString()); diff --git a/app/linenumberwidget.cpp b/app/linenumberwidget.cpp index a845c02..72712ca 100644 --- a/app/linenumberwidget.cpp +++ b/app/linenumberwidget.cpp @@ -72,7 +72,7 @@ void LineNumberWidget::paintEvent(QPaintEvent *event) if (bottom >= event->rect().top()) { for (int i = 0; i < userBookmarks.length(); ++i) { if (userBookmarks.at(i) == lineNumber) { - painter.fillRect(2, top, fm.width(QLatin1Char('B')) + 4, lineHeight, + painter.fillRect(2, top, fm.horizontalAdvance(QLatin1Char('B')) + 4, lineHeight, m_highlightBrush); painter.setPen(m_highlightedTextPen); painter.drawText(4, top, width() - 4, lineHeight, Qt::AlignLeft | Qt::AlignTop, diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 57b2e94..2ef5ded 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -36,6 +36,7 @@ #endif #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -955,7 +955,7 @@ void MainWindow::readSettings() QSettings settings; settings.beginGroup(QLatin1String("MainWindow")); - const int screenWidth = QApplication::desktop()->availableGeometry().width(); + const int screenWidth = this->screen()->geometry().width(); QSize size; if (screenWidth > 1200) size = settings.value(QLatin1String("size"), QSize(1200, 600)).toSize(); diff --git a/app/tikzcommandinserter.cpp b/app/tikzcommandinserter.cpp index bd597f7..3903210 100644 --- a/app/tikzcommandinserter.cpp +++ b/app/tikzcommandinserter.cpp @@ -482,8 +482,8 @@ void TikzCommandInserter::addListWidgetItems(QListWidget *listWidget, QString itemText = commandList.children.at(i).title; item->setText(itemText.remove(QLatin1Char('&'))); - item->setBackgroundColor(titleBg); - item->setTextColor(titleFg); + item->setBackground(titleBg); + item->setForeground(titleFg); item->setFont(titleFont); addListWidgetItems(listWidget, standardPalette, commandList.children.at(i)); diff --git a/app/tikzeditor.cpp b/app/tikzeditor.cpp index 2b5790a..291e026 100644 --- a/app/tikzeditor.cpp +++ b/app/tikzeditor.cpp @@ -314,7 +314,7 @@ void TikzEditor::paintSpace(QPainter &painter, qreal x, qreal y, int spaceWidth) void TikzEditor::printWhiteSpaces(QPainter &painter) { const QFontMetrics fontMetrics = QFontMetrics(document()->defaultFont()); - const int spaceWidth = fontMetrics.width(QLatin1Char(' ')); + const int spaceWidth = fontMetrics.horizontalAdvance(QLatin1Char(' ')); const int fontHeight = fontMetrics.height(); QTextCursor cursor = textCursor(); @@ -747,7 +747,8 @@ int TikzEditor::lineNumberAreaWidth() ++digits; digits = qMax(4, digits) + 1; - return m_showLineNumberArea ? 3 + fontMetrics().width(QLatin1Char('9')) * digits : 0; + return m_showLineNumberArea ? 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits + : 0; } void TikzEditor::updateLineNumberAreaWidth() diff --git a/app/tikzeditorview.cpp b/app/tikzeditorview.cpp index 861925c..6594167 100644 --- a/app/tikzeditorview.cpp +++ b/app/tikzeditorview.cpp @@ -157,7 +157,8 @@ void TikzEditorView::setFont(const QFont &editorFont) fm.setFontPointSize(editorFont.pointSize()); m_tikzEditor->setCurrentCharFormat(fm); - m_tikzEditor->setTabStopWidth(m_tikzEditor->fontMetrics().width(QLatin1String(" "))); + m_tikzEditor->setTabStopDistance( + m_tikzEditor->fontMetrics().horizontalAdvance(QLatin1String(" "))); } void TikzEditorView::createActions() diff --git a/common/tikzpreview.cpp b/common/tikzpreview.cpp index 7590e96..b17f514 100644 --- a/common/tikzpreview.cpp +++ b/common/tikzpreview.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -92,7 +93,7 @@ void TikzPreview::contextMenuEvent(QContextMenuEvent *event) QSize TikzPreview::sizeHint() const { - const int screenWidth = QApplication::desktop()->availableGeometry().width(); + const int screenWidth = this->screen()->geometry().width(); if (screenWidth > 1200) return QSize(500, 400); else if (screenWidth > 1024) @@ -404,7 +405,7 @@ void TikzPreview::setBackgroundColor(QColor color) void TikzPreview::wheelEvent(QWheelEvent *event) { if (event->modifiers() == Qt::ControlModifier) { - if (event->delta() > 0) + if (event->angleDelta().y() > 0) zoomIn(); else zoomOut(); diff --git a/common/tikzpreviewgenerator.cpp b/common/tikzpreviewgenerator.cpp index c4d747b..548d67e 100644 --- a/common/tikzpreviewgenerator.cpp +++ b/common/tikzpreviewgenerator.cpp @@ -476,7 +476,7 @@ static QString createTempTikzFile(const QString &tikzFileBaseName, const QString QTextStream tikzStream(&tikzFile); codecProfile->configureStreamEncoding(tikzStream); - tikzStream << tikzCode << endl; + tikzStream << tikzCode << Qt::endl; tikzStream.flush(); tikzFile.close();