diff --git a/profiler_gui/CMakeLists.txt b/profiler_gui/CMakeLists.txt index 9b6d957..095db53 100644 --- a/profiler_gui/CMakeLists.txt +++ b/profiler_gui/CMakeLists.txt @@ -4,9 +4,10 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(Qt5Widgets) +find_package(Qt6Widgets) +find_package(Qt6Core5Compat) -if (Qt5Widgets_FOUND) +if (Qt6Widgets_FOUND) message(STATUS "Using Qt v${Qt5Widgets_VERSION}") if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") AND WIN32) set(APPLICATION_PLATFORM WIN32) @@ -70,7 +71,7 @@ if (Qt5Widgets_FOUND) resources.qrc resources.rc ) - target_link_libraries(profiler_gui Qt5::Widgets easy_profiler) + target_link_libraries(profiler_gui Qt6::Widgets Qt6::Core5Compat easy_profiler) if (WIN32) target_compile_definitions(profiler_gui PRIVATE -D_WIN32_WINNT=0x0600) endif () diff --git a/profiler_gui/arbitrary_value_inspector.cpp b/profiler_gui/arbitrary_value_inspector.cpp index 1fa3cd3..e30717b 100644 --- a/profiler_gui/arbitrary_value_inspector.cpp +++ b/profiler_gui/arbitrary_value_inspector.cpp @@ -767,7 +767,7 @@ void ArbitraryValuesChartItem::paintMouseIndicator(QPainter* _painter, qreal _to valueString = profiler_gui::autoTimeStringRealNs(value, 3); } - const int textWidth = _painter->fontMetrics().width(valueString) + 3; + const int textWidth = _painter->fontMetrics().boundingRect(valueString).width() + 3; const QRectF rect(0, y - _font_h - 2, _width - 3, 4 + (_font_h << 1)); _painter->setPen(Qt::blue); @@ -810,7 +810,7 @@ void ArbitraryValuesChartItem::paintMouseIndicator(QPainter* _painter, qreal _to valueString = QString::number(value, 'f', 3); } - const int textWidth = _painter->fontMetrics().width(valueString) + 6; + const int textWidth = _painter->fontMetrics().boundingRect(valueString).width() + 6; const int textWidthHalf = textWidth >> 1; qreal left = x - textWidthHalf; @@ -2034,7 +2034,7 @@ void ArbitraryValuesWidget::showEvent(QShowEvent* event) const auto indicatorSize = header->isSortIndicatorShown() ? px(11) : 0; for (int i = 0; i < static_cast(m_columnsMinimumWidth.size()); ++i) { - auto minSize = static_cast(fm.width(headerItem->text(i)) * profiler_gui::FONT_METRICS_FACTOR + padding); + auto minSize = static_cast(fm.boundingRect(headerItem->text(i)).width() * profiler_gui::FONT_METRICS_FACTOR + padding); m_columnsMinimumWidth[i] = minSize; if (header->isSortIndicatorShown() && header->sortIndicatorSection() == i) @@ -2850,7 +2850,7 @@ QTreeWidgetItem* ArbitraryValuesWidget::buildTreeForThread(const profiler::Block item->setText(int_cast(ArbitraryColumns::Value), profiler_gui::valueString(*value, childIndex)); const auto sizeHintWidth = valueItem->sizeHint(CheckColumn).width(); - item->setWidthHint(std::max(sizeHintWidth, fm.width(valueItem->text(CheckColumn))) + 32); + item->setWidthHint(std::max(sizeHintWidth, fm.boundingRect(valueItem->text(CheckColumn)).width()) + 32); } auto typeString = profiler_gui::valueTypeString(*value); @@ -2893,7 +2893,7 @@ QTreeWidgetItem* ArbitraryValuesWidget::buildTreeForThread(const profiler::Block valueItem->setText(int_cast(ArbitraryColumns::Value), profiler_gui::shortValueString(*value)); auto sizeHintWidth = valueItem->sizeHint(CheckColumn).width(); - valueItem->setWidthHint(std::max(sizeHintWidth, fm.width(valueItem->text(CheckColumn))) + 32); + valueItem->setWidthHint(std::max(sizeHintWidth, fm.boundingRect(valueItem->text(CheckColumn)).width()) + 32); *(usedItems + typeIndex) = valueItem; @@ -2912,7 +2912,7 @@ QTreeWidgetItem* ArbitraryValuesWidget::buildTreeForThread(const profiler::Block item->setText(int_cast(ArbitraryColumns::Value), profiler_gui::valueString(*value, childIndex)); sizeHintWidth = valueItem->sizeHint(CheckColumn).width(); - item->setWidthHint(std::max(sizeHintWidth, fm.width(valueItem->text(CheckColumn))) + 32); + item->setWidthHint(std::max(sizeHintWidth, fm.boundingRect(valueItem->text(CheckColumn)).width()) + 32); } auto typeString = profiler_gui::valueTypeString(*value); diff --git a/profiler_gui/arbitrary_value_tooltip.cpp b/profiler_gui/arbitrary_value_tooltip.cpp index 03f7826..9725dc2 100644 --- a/profiler_gui/arbitrary_value_tooltip.cpp +++ b/profiler_gui/arbitrary_value_tooltip.cpp @@ -144,7 +144,7 @@ ArbitraryValueToolTip::ArbitraryValueToolTip(const QString& _name QFontMetrics fm(EASY_GLOBALS.font.default_font); QFontMetrics fm2(font); - pane->setMinimumWidth(fm.width(firstString) + 24); + pane->setMinimumWidth(fm.boundingRect(firstString).width() + 24); pane->setMaximumHeight((fm.height() + fm.leading() + 1) * rowsCount); setMaximumHeight(pane->maximumHeight() + fm2.height() + fm2.leading() + 10); diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp index 051dc86..693f456 100644 --- a/profiler_gui/blocks_graphics_view.cpp +++ b/profiler_gui/blocks_graphics_view.cpp @@ -231,7 +231,7 @@ void BackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*, qreal first_x = first * sceneStep; const auto textWidth = QFontMetricsF(_painter->font(), sceneView). - width(QString::number(static_cast(0.5 + first_x * factor))) * profiler_gui::FONT_METRICS_FACTOR + px(10); + boundingRect(QString::number(static_cast(0.5 + first_x * factor))).width() * profiler_gui::FONT_METRICS_FACTOR + px(10); const int n = 1 + static_cast(textWidth / step); int next = first % n; @@ -1288,7 +1288,7 @@ void BlocksGraphicsView::scaleTo(qreal _scale) ////////////////////////////////////////////////////////////////////////// -void BlocksGraphicsView::enterEvent(QEvent* _event) +void BlocksGraphicsView::enterEvent(QEnterEvent* _event) { Parent::enterEvent(_event); m_bHovered = true; @@ -1323,7 +1323,7 @@ void BlocksGraphicsView::wheelEvent(QWheelEvent* _event) m_idleTime = 0; if (!m_bEmpty) - onWheel(mapToDiagram(mapToScene(_event->pos()).x()), _event->delta()); + onWheel(mapToDiagram(mapToScene(_event->position().toPoint()).x()), _event->angleDelta().y()); _event->accept(); } @@ -3078,7 +3078,7 @@ void ThreadNamesWidget::onTreeChange() qreal maxLength = 100; const auto& graphicsItems = m_view->getItems(); for (auto graphicsItem : graphicsItems) - maxLength = std::max(maxLength, (10 + fm.width(graphicsItem->threadName())) * profiler_gui::FONT_METRICS_FACTOR); + maxLength = std::max(maxLength, (10 + fm.boundingRect(graphicsItem->threadName()).width()) * profiler_gui::FONT_METRICS_FACTOR); auto vbar = verticalScrollBar(); auto viewBar = m_view->verticalScrollBar(); @@ -3247,7 +3247,7 @@ void ThreadNamesWidget::repaintScene() scene()->update(); } -void ThreadNamesWidget::enterEvent(QEvent* _event) +void ThreadNamesWidget::enterEvent(QEnterEvent* _event) { Parent::enterEvent(_event); m_bHovered = true; @@ -3342,7 +3342,7 @@ void ThreadNamesWidget::wheelEvent(QWheelEvent* _event) _event->accept(); const auto prev = vbar->value(); - vbar->setValue(vbar->value() - _event->delta()); + vbar->setValue(vbar->value() - _event->angleDelta().y()); if (prev != vbar->value()) { diff --git a/profiler_gui/blocks_graphics_view.h b/profiler_gui/blocks_graphics_view.h index 4201114..66535fc 100644 --- a/profiler_gui/blocks_graphics_view.h +++ b/profiler_gui/blocks_graphics_view.h @@ -230,7 +230,7 @@ public: // Public virtual methods - void enterEvent(QEvent* _event) override; + void enterEvent(QEnterEvent* _event) override; void leaveEvent(QEvent* _event) override; void wheelEvent(QWheelEvent* _event) override; void mousePressEvent(QMouseEvent* _event) override; @@ -384,7 +384,7 @@ public: explicit ThreadNamesWidget(BlocksGraphicsView* _view, int _additionalHeight, QWidget* _parent = nullptr); ~ThreadNamesWidget() override; - void enterEvent(QEvent* _event) override; + void enterEvent(QEnterEvent* _event) override; void leaveEvent(QEvent* _event) override; void mousePressEvent(QMouseEvent* _event) override; void mouseDoubleClickEvent(QMouseEvent* _event) override; diff --git a/profiler_gui/blocks_tree_widget.cpp b/profiler_gui/blocks_tree_widget.cpp index a173483..589407e 100644 --- a/profiler_gui/blocks_tree_widget.cpp +++ b/profiler_gui/blocks_tree_widget.cpp @@ -446,7 +446,7 @@ bool BlocksTreeWidget::eventFilter(QObject* _object, QEvent* _event) for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) { - m_columnsMinimumWidth[i] = static_cast(fm.width(headerItem()->text(i)) * profiler_gui::FONT_METRICS_FACTOR + padding); + m_columnsMinimumWidth[i] = static_cast(fm.boundingRect(headerItem()->text(i)).width() * profiler_gui::FONT_METRICS_FACTOR + padding); } EASY_CONSTEXPR int Margins = 20; @@ -1645,7 +1645,7 @@ void StatsWidget::saveSettings() settings.endGroup(); } -void StatsWidget::enterEvent(QEvent* event) +void StatsWidget::enterEvent(QEnterEvent* event) { Parent::enterEvent(event); m_tree->updateHintLabelOnHover(true); diff --git a/profiler_gui/blocks_tree_widget.h b/profiler_gui/blocks_tree_widget.h index beac947..036bc0d 100644 --- a/profiler_gui/blocks_tree_widget.h +++ b/profiler_gui/blocks_tree_widget.h @@ -211,7 +211,7 @@ public: explicit StatsWidget(QWidget* _parent = nullptr); ~StatsWidget() override; - void enterEvent(QEvent* event) override; + void enterEvent(QEnterEvent* event) override; void leaveEvent(QEvent* event) override; void keyPressEvent(QKeyEvent* _event) override; void contextMenuEvent(QContextMenuEvent* _event) override; diff --git a/profiler_gui/bookmarks_editor.cpp b/profiler_gui/bookmarks_editor.cpp index e95ded6..b4d3beb 100644 --- a/profiler_gui/bookmarks_editor.cpp +++ b/profiler_gui/bookmarks_editor.cpp @@ -104,7 +104,7 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent connect(m_colorButton, &QPushButton::clicked, this, &This::onColorButtonClicked); auto palette = m_colorButton->palette(); - palette.setBrush(QPalette::Background, QBrush(QColor::fromRgb(bookmark.color))); + palette.setBrush(QPalette::Window, QBrush(QColor::fromRgb(bookmark.color))); m_colorButton->setPalette(palette); m_colorButton->setStyleSheet(QString("background-color: %1;").arg(QColor::fromRgb(bookmark.color).name())); @@ -156,7 +156,7 @@ void BookmarkEditor::onSaveClicked(bool) auto& bookmark = EASY_GLOBALS.bookmarks[m_bookmarkIndex]; bookmark.text = m_textEdit->toPlainText().trimmed().toStdString(); - bookmark.color = m_colorButton->palette().brush(QPalette::Background).color().rgb(); + bookmark.color = m_colorButton->palette().brush(QPalette::Window).color().rgb(); EASY_GLOBALS.bookmark_default_color = bookmark.color; EASY_GLOBALS.has_local_changes = true; @@ -175,11 +175,11 @@ void BookmarkEditor::onColorButtonClicked(bool) { auto palette = m_colorButton->palette(); - QColorDialog colorDialog(palette.brush(QPalette::Background).color(), this); + QColorDialog colorDialog(palette.brush(QPalette::Window).color(), this); colorDialog.exec(); auto color = colorDialog.currentColor(); - palette.setBrush(QPalette::Background, QBrush(color)); + palette.setBrush(QPalette::Window, QBrush(color)); m_colorButton->setPalette(palette); m_colorButton->setStyleSheet(QString("background-color: %1;").arg(color.name())); diff --git a/profiler_gui/descriptors_tree_widget.cpp b/profiler_gui/descriptors_tree_widget.cpp index e918d40..c4039ca 100644 --- a/profiler_gui/descriptors_tree_widget.cpp +++ b/profiler_gui/descriptors_tree_widget.cpp @@ -74,6 +74,7 @@ #include #include #include +#include #include "descriptors_tree_widget.h" @@ -338,7 +339,7 @@ void DescriptorsTreeWidget::showEvent(QShowEvent* event) const auto indicatorSize = header->isSortIndicatorShown() ? px(11) : 0; for (int i = 0; i < DESC_COL_COLUMNS_NUMBER; ++i) { - auto minSize = static_cast(fm.width(headerItem->text(i)) * profiler_gui::FONT_METRICS_FACTOR + padding); + auto minSize = static_cast(fm.boundingRect(headerItem->text(i)).width() * profiler_gui::FONT_METRICS_FACTOR + padding); m_columnsMinimumWidth[i] = minSize; if (header->isSortIndicatorShown() && header->sortIndicatorSection() == i) @@ -552,8 +553,8 @@ void DescriptorsTreeWidget::build() if (p.item == nullptr) { auto item = new DescriptorsTreeItem(0); - auto fullName = QString(desc->file()).remove(QRegExp("^(\\.{2}\\\\+)+")); // without leading "..\" - auto fileName = QString(desc->file()).remove(QRegExp("^(.+(\\\\|\\/)+)+")); + auto fullName = QString(desc->file()).remove(QRegExp("^(\\.{2}\\\\+)+").pattern()); // without leading "..\" + auto fileName = QString(desc->file()).remove(QRegExp("^(.+(\\\\|\\/)+)+").pattern()); auto dir = fullName.left(fullName.length() - fileName.length()); if (count == 1) diff --git a/profiler_gui/fps_widget.cpp b/profiler_gui/fps_widget.cpp index e06e90c..f9ad1b3 100644 --- a/profiler_gui/fps_widget.cpp +++ b/profiler_gui/fps_widget.cpp @@ -223,7 +223,9 @@ void FpsGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*, _painter->setPen(Qt::NoPen); _painter->setBrush(Qt::white); - _painter->drawRect(0, top + 1, std::max({fontMetrics.width(txtTop), fontMetrics.width(txtMid), fontMetrics.width(txtBtm)}) + 8, bottom - top - 1); + _painter->drawRect(0, top + 1, std::max({fontMetrics.boundingRect(txtTop).width(), + fontMetrics.boundingRect(txtMid).width(), + fontMetrics.boundingRect(txtBtm).width()}) + 8, bottom - top - 1); _painter->setPen(Qt::black); _painter->setBrush(Qt::NoBrush); diff --git a/profiler_gui/graphics_scrollbar.cpp b/profiler_gui/graphics_scrollbar.cpp index 7d7871d..cfc4eeb 100644 --- a/profiler_gui/graphics_scrollbar.cpp +++ b/profiler_gui/graphics_scrollbar.cpp @@ -154,7 +154,7 @@ void GraphicsHistogramItem::paintMouseIndicator(QPainter* _painter, qreal _top, else { _painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, mouseStr); - mouseIndicatorLeft = _painter->fontMetrics().width(mouseStr) + 3; + mouseIndicatorLeft = _painter->fontMetrics().boundingRect(mouseStr).width() + 3; } _painter->drawLine(QLineF(mouseIndicatorLeft, _mouse_y, mouseIndicatorRight, _mouse_y)); diff --git a/profiler_gui/graphics_slider_area.cpp b/profiler_gui/graphics_slider_area.cpp index 054c527..6cdeedd 100644 --- a/profiler_gui/graphics_slider_area.cpp +++ b/profiler_gui/graphics_slider_area.cpp @@ -539,7 +539,7 @@ void GraphicsSliderArea::wheelEvent(QWheelEvent* _event) if (m_imageItem->isVisible()) { - if (_event->delta() > 0) + if (_event->angleDelta().y() > 0) m_imageItem->increaseTopValue(); else m_imageItem->decreaseTopValue(); @@ -554,7 +554,7 @@ void GraphicsSliderArea::wheelEvent(QWheelEvent* _event) if (m_imageItem->isVisible()) { - if (_event->delta() > 0) + if (_event->angleDelta().y() > 0) m_imageItem->increaseBottomValue(); else m_imageItem->decreaseBottomValue(); @@ -565,16 +565,16 @@ void GraphicsSliderArea::wheelEvent(QWheelEvent* _event) if (!bindMode()) { - const auto w = m_slider->halfwidth() * (_event->delta() < 0 ? profiler_gui::SCALING_COEFFICIENT : profiler_gui::SCALING_COEFFICIENT_INV); - setValue(mapToScene(_event->pos()).x() - m_minimumValue - w); - emit EASY_GLOBALS.events.chartWheeled(m_value + w * m_windowScale, _event->delta()); + const auto w = m_slider->halfwidth() * (_event->angleDelta().y() < 0 ? profiler_gui::SCALING_COEFFICIENT : profiler_gui::SCALING_COEFFICIENT_INV); + setValue(mapToScene(_event->position().toPoint()).x() - m_minimumValue - w); + emit EASY_GLOBALS.events.chartWheeled(m_value + w * m_windowScale, _event->angleDelta().y()); } else { - auto x = static_cast(_event->pos().x()) / m_windowScale; + auto x = static_cast(_event->position().x()) / m_windowScale; if (m_bBindMode) // check m_bBindMode because it may differ from bindMode() for arbitrary value complexity chart x *= sliderWidth() / range(); - emit EASY_GLOBALS.events.chartWheeled(m_value + x, _event->delta()); + emit EASY_GLOBALS.events.chartWheeled(m_value + x, _event->angleDelta().y()); } } diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp index f2efe69..e54c8eb 100644 --- a/profiler_gui/main_window.cpp +++ b/profiler_gui/main_window.cpp @@ -59,6 +59,7 @@ ************************************************************************/ #include +#include #include #include @@ -96,6 +97,7 @@ #include #include #include +#include #include #include @@ -429,7 +431,7 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos //QRegExp rx("^0*(2(5[0-5]|[0-4]\\d)|1?\\d{1,2})(\\.0*(2(5[0-5]|[0-4]\\d)|1?\\d{1,2})){3}$"); //m_addressEdit->setValidator(new QRegExpValidator(rx, m_addressEdit)); m_addressEdit->setText(m_lastAddress); - m_addressEdit->setFixedWidth((m_addressEdit->fontMetrics().width(QString("255.255.255.255")) * 3) / 2); + m_addressEdit->setFixedWidth((m_addressEdit->fontMetrics().boundingRect(QString("255.255.255.255")).width() * 3) / 2); toolbar->addWidget(m_addressEdit); lbl = new QLabel("Port:", toolbar); @@ -438,7 +440,7 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos m_portEdit = new QLineEdit(); m_portEdit->setValidator(new QIntValidator(1, 65535, m_portEdit)); m_portEdit->setText(QString::number(m_lastPort)); - m_portEdit->setFixedWidth(m_portEdit->fontMetrics().width(QString("000000")) + 10); + m_portEdit->setFixedWidth(m_portEdit->fontMetrics().boundingRect(QString("000000")).width() + 10); toolbar->addWidget(m_portEdit); connect(m_addressEdit, &QLineEdit::returnPressed, [this] { onConnectClicked(true); }); @@ -889,15 +891,15 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos connect(action, &QAction::triggered, this, &This::onEncodingChanged); } - qSort(actions.begin(), actions.end(), [](QAction* lhs, QAction* rhs) { - return lhs->text().compare(rhs->text(), Qt::CaseInsensitive) < 0; - }); + std::sort(actions.begin(), actions.end(), + [](QAction* lhs, QAction* rhs) + { + return lhs->text().compare(rhs->text(), Qt::CaseInsensitive) < 0; + }); submenu->addActions(actions); } - - submenu = menu->addMenu("Appearance"); actionGroup = new QActionGroup(this); @@ -1618,9 +1620,9 @@ void MainWindow::onDescTreeDialogClose(int) void MainWindow::validateLineEdits() { - m_addressEdit->setFixedWidth((m_addressEdit->fontMetrics().width(QString("255.255.255.255")) * 3) / 2); - m_portEdit->setFixedWidth(m_portEdit->fontMetrics().width(QString("000000")) + 10); - m_frameTimeEdit->setFixedWidth(m_frameTimeEdit->fontMetrics().width(QString("000.000")) + 5); + m_addressEdit->setFixedWidth((m_addressEdit->fontMetrics().boundingRect(QString("255.255.255.255")).width() * 3) / 2); + m_portEdit->setFixedWidth(m_portEdit->fontMetrics().boundingRect(QString("000000")).width() + 10); + m_frameTimeEdit->setFixedWidth(m_frameTimeEdit->fontMetrics().boundingRect(QString("000.000")).width() + 5); } ////////////////////////////////////////////////////////////////////////// diff --git a/profiler_gui/round_progress_widget.cpp b/profiler_gui/round_progress_widget.cpp index 12c3946..34ec29b 100644 --- a/profiler_gui/round_progress_widget.cpp +++ b/profiler_gui/round_progress_widget.cpp @@ -434,7 +434,7 @@ void RoundProgressIndicator::updateSize() const QFontMetrics fm(font()); const QString text = QStringLiteral("100%"); const int margins = m_indicatorWidth * 4 + px(2); - const int size = static_cast(std::max(fm.width(text), fm.height()) * profiler_gui::FONT_METRICS_FACTOR) + margins; + const int size = static_cast(std::max(fm.boundingRect(text).width(), fm.height()) * profiler_gui::FONT_METRICS_FACTOR) + margins; setFixedSize(size, size); @@ -514,7 +514,7 @@ void RoundProgressIndicator::paintEvent(QPaintEvent* /*event*/) { // Draw text p.setWidth(px(1)); - p.setColor(palette().foreground().color()); + p.setColor(palette().window().color()); painter.setPen(p); painter.setFont(font()); painter.drawText(r, Qt::AlignCenter, m_text); @@ -555,7 +555,7 @@ void RoundProgressIndicator::paintStopButton(QPainter& painter, QRect& r) painter.drawRect(r); } -void RoundProgressIndicator::enterEvent(QEvent* event) { +void RoundProgressIndicator::enterEvent(QEnterEvent* event) { Parent::enterEvent(event); profiler_gui::updateProperty(this, "hover", true); } diff --git a/profiler_gui/round_progress_widget.h b/profiler_gui/round_progress_widget.h index 0e1ea54..9a0a559 100644 --- a/profiler_gui/round_progress_widget.h +++ b/profiler_gui/round_progress_widget.h @@ -153,7 +153,7 @@ protected: void showEvent(QShowEvent* event) override; void paintEvent(QPaintEvent* event) override; - void enterEvent(QEvent* event) override; + void enterEvent(QEnterEvent* event) override; void leaveEvent(QEvent* event) override; void mousePressEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; diff --git a/profiler_gui/text_highlighter.cpp b/profiler_gui/text_highlighter.cpp index 0102a6c..5dd29b7 100644 --- a/profiler_gui/text_highlighter.cpp +++ b/profiler_gui/text_highlighter.cpp @@ -88,14 +88,14 @@ void TextHighlighter::highlightBlock(const QString& text) } QRegExp expression(m_pattern, m_caseSensitivity); - int index = text.indexOf(expression); + int index = text.indexOf(expression.pattern()); while (index >= 0) { const auto length = expression.cap().length(); setFormat(index, length, m_textCharFormat); auto prevIndex = index; - index = text.indexOf(expression, index + length); + index = text.indexOf(expression.pattern(), index + length); if (index <= prevIndex) { break; diff --git a/profiler_gui/tree_widget_item.cpp b/profiler_gui/tree_widget_item.cpp index 27f539b..c0be4dd 100644 --- a/profiler_gui/tree_widget_item.cpp +++ b/profiler_gui/tree_widget_item.cpp @@ -623,7 +623,7 @@ QSize TreeWidgetItemDelegate::sizeHint(const QStyleOptionViewItem& option, const // unfortunately, Qt does not take padding into account, so have to add it manually... const auto padding = px(15); auto text = displayData.toString(); - const auto width = static_cast((m_treeWidget->fontMetrics().width(text) + padding) * 1.05); + const auto width = static_cast((m_treeWidget->fontMetrics().boundingRect(text).width() + padding) * 1.05); const auto brushData = m_treeWidget->model()->data(index, BlockColorRole); if (brushData.isNull()) diff --git a/profiler_gui/window_header.cpp b/profiler_gui/window_header.cpp index 91bbc98..61ef09b 100644 --- a/profiler_gui/window_header.cpp +++ b/profiler_gui/window_header.cpp @@ -333,7 +333,7 @@ void WindowHeader::showEvent(QShowEvent* event) if (!m_pixmap->windowIcon().isNull()) { const int size = std::max(m_title->fontMetrics().height(), 16); - if (m_pixmap->pixmap()->height() != size) + if (m_pixmap->pixmap().height() != size) m_pixmap->setPixmap(m_pixmap->windowIcon().pixmap(size, size)); }