0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 16:11:02 +08:00

#106 [UI] Rising a tooltip when passing cursor over a bookmark; #0 [UI] Minor fixes

This commit is contained in:
Victor Zarubkin 2018-06-13 21:43:16 +03:00
parent 0ae430410d
commit c85d15a4e2
15 changed files with 229 additions and 54 deletions

View File

@ -137,7 +137,8 @@ BoldLabel::~BoldLabel()
//////////////////////////////////////////////////////////////////////////
BackgroundItem::BackgroundItem() : AuxItem()
, m_bookmark(std::numeric_limits<size_t>::max())
, m_tooltip(nullptr)
, m_bookmark(profiler_gui::numeric_max<decltype(m_bookmark)>())
, m_bButtonPressed(false)
{
m_bookmarkSign.lineTo(px(BOOKMARK_WIDTH), 0);
@ -151,6 +152,11 @@ BackgroundItem::BackgroundItem() : AuxItem()
connect(&m_idleTimer, &QTimer::timeout, this, &BackgroundItem::onIdleTimeout);
}
BackgroundItem::~BackgroundItem()
{
delete m_tooltip;
}
void BackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*, QWidget*)
{
auto const sceneView = static_cast<BlocksGraphicsView*>(scene()->parent());
@ -295,27 +301,32 @@ void BackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*,
pen.setColor(Qt::black);
pen.setWidth(px(1));
_painter->setPen(borderColor);
_painter->setBrush(Qt::transparent);
_painter->setRenderHint(QPainter::Antialiasing);
const int minWidth = px(BOOKMARK_WIDTH);
const int half = minWidth >> 1;
QBrush brush(Qt::transparent);
qreal prevPos = -offset * currentScale;
const int half = px(BOOKMARK_WIDTH) >> 1;
auto color = QColor(Qt::transparent).rgb();
qreal prevPos = -1e300;
for (auto it = first_it; it != bookmarks.cend() && it->pos <= endTime; ++it)
{
const qreal pos =
(PROF_MICROSECONDS(it->pos - EASY_GLOBALS.begin_time) - offset) * currentScale - half;
const bool isSelectedBookmark = m_bookmark == static_cast<size_t>(std::distance(bookmarks.cbegin(), it));
const auto delta = fabs(pos - prevPos);
if (delta < minWidth)
if (delta < half && !isSelectedBookmark)
continue;
if (brush.color().rgb() != it->color)
brush.setColor(QColor::fromRgb(it->color));
if (color != it->color)
_painter->setBrush(QColor::fromRgb(it->color));
_painter->fillPath(m_bookmarkSign.translated(pos, h), brush);
if (m_bookmark == static_cast<size_t>(std::distance(bookmarks.cbegin(), it)))
_painter->strokePath(m_bookmarkSign.translated(pos, h), pen);
const auto path = m_bookmarkSign.translated(pos, h);
_painter->drawPath(path);
if (isSelectedBookmark)
_painter->strokePath(path, pen);
prevPos = pos;
}
@ -330,13 +341,16 @@ bool BackgroundItem::mouseMove(const QPointF& scenePos)
{
const auto prev = m_bookmark;
delete m_tooltip;
m_tooltip = nullptr;
auto& bookmarks = EASY_GLOBALS.bookmarks;
if (bookmarks.empty())
{
if (m_idleTimer.isActive())
m_idleTimer.stop();
m_bookmark = std::numeric_limits<size_t>::max();
profiler_gui::set_max(m_bookmark);
if (prev != m_bookmark)
{
qApp->restoreOverrideCursor();
@ -357,7 +371,7 @@ bool BackgroundItem::mouseMove(const QPointF& scenePos)
if (m_idleTimer.isActive())
m_idleTimer.stop();
m_bookmark = std::numeric_limits<size_t>::max();
profiler_gui::set_max(m_bookmark);
if (prev != m_bookmark)
{
qApp->restoreOverrideCursor();
@ -374,7 +388,7 @@ bool BackgroundItem::mouseMove(const QPointF& scenePos)
if (!m_bButtonPressed)
{
m_bookmark = std::numeric_limits<size_t>::max();
profiler_gui::set_max(m_bookmark);
auto first_it = std::lower_bound(bookmarks.cbegin(), bookmarks.cend(), timestamp,
[](const profiler::Bookmark& bookmark, profiler::timestamp_t value)
@ -442,6 +456,10 @@ bool BackgroundItem::mouseMove(const QPointF& scenePos)
bool BackgroundItem::mousePress(const QPointF& scenePos)
{
m_bButtonPressed = m_bookmark < EASY_GLOBALS.bookmarks.size() && contains(scenePos);
delete m_tooltip;
m_tooltip = nullptr;
return false;
}
@ -508,6 +526,23 @@ bool BackgroundItem::mouseDoubleClick(const QPointF& scenePos)
return true;
}
void BackgroundItem::mouseLeave()
{
delete m_tooltip;
m_tooltip = nullptr;
if (m_idleTimer.isActive())
m_idleTimer.stop();
if (m_bookmark < EASY_GLOBALS.bookmarks.size())
{
profiler_gui::set_max(m_bookmark);
qApp->restoreOverrideCursor();
emit bookmarkChanged(m_bookmark);
update();
}
}
bool BackgroundItem::contains(const QPointF& scenePos) const
{
auto const sceneView = static_cast<BlocksGraphicsView*>(scene()->parent());
@ -520,14 +555,40 @@ void BackgroundItem::onIdleTimeout()
{
if (m_bookmark < EASY_GLOBALS.bookmarks.size())
{
/// TODO: show tooltip
delete m_tooltip;
m_tooltip = nullptr;
const auto& text = EASY_GLOBALS.bookmarks[m_bookmark].text;
if (text.empty())
return;
auto parent = static_cast<QWidget*>(scene()->parent());
m_tooltip = new QLabel(QString::fromStdString(text),
parent, Qt::ToolTip | Qt::WindowTransparentForInput);
if (m_tooltip == nullptr)
return;
const auto delta = px(10);
m_tooltip->setObjectName(QStringLiteral("BookmarkPopup"));
m_tooltip->setAttribute(Qt::WA_ShowWithoutActivating, true);
m_tooltip->setFocusPolicy(Qt::NoFocus);
m_tooltip->setWordWrap(true);
m_tooltip->move(QCursor::pos() + QPoint(delta >> 1, delta));
m_tooltip->show();
const int bottom = m_tooltip->mapToParent(m_tooltip->pos()).y() + m_tooltip->height();
const int parentBottom = parent->y() + parent->height();
if (bottom > parentBottom)
m_tooltip->move(m_tooltip->pos() - QPoint(delta >> 1, m_tooltip->height() + delta));
}
}
//////////////////////////////////////////////////////////////////////////
ForegroundItem::ForegroundItem() : AuxItem()
, m_bookmark(std::numeric_limits<size_t>::max())
, m_bookmark(profiler_gui::numeric_max<decltype(m_bookmark)>())
{
}
@ -592,7 +653,7 @@ void ForegroundItem::onMoved()
BlocksGraphicsView::BlocksGraphicsView(QWidget* _parent)
: Parent(_parent)
, m_beginTime(std::numeric_limits<decltype(m_beginTime)>::max())
, m_beginTime(profiler_gui::numeric_max<decltype(m_beginTime)>())
, m_sceneWidth(0)
, m_scale(1)
, m_offset(0)
@ -696,7 +757,7 @@ void BlocksGraphicsView::clear()
m_selectedBlocks.clear();
m_backgroundItem = nullptr;
m_beginTime = std::numeric_limits<decltype(m_beginTime)>::max(); // reset begin time
profiler_gui::set_max(m_beginTime); // reset begin time
m_scale = 1; // scale back to initial 100% scale
m_timelineStep = 1;
m_offset = 0; // scroll back to the beginning of the scene
@ -757,7 +818,7 @@ void BlocksGraphicsView::notifyVisibleRegionPosChange()
void BlocksGraphicsView::notifyVisibleRegionPosChange(qreal _pos)
{
if (m_sceneWidth < m_visibleRegionWidth)
if (m_sceneWidth <= m_visibleRegionWidth)
m_offset = 0;
else
m_offset = estd::clamp(0., _pos, m_sceneWidth - m_visibleRegionWidth);
@ -889,11 +950,11 @@ void BlocksGraphicsView::setTree(const profiler::thread_blocks_tree_t& _blocksTr
EASY_GLOBALS.scene.empty = false;
// Center view on the beginning of the scene
updateVisibleSceneRect();
//setScrollbar(m_pScrollbar);
const int vbar_width = updateVisibleSceneRect();
const auto windowWidth = (m_visibleSceneRect.width() + vbar_width) / m_scale;
notifySceneSizeChange();
notifyVisibleRegionSizeChange();
notifyVisibleRegionSizeChange(windowWidth);
// Create new chronometer item (previous item was destroyed by scene on scene()->clear()).
// It will be shown on mouse right button click.
@ -925,12 +986,38 @@ void BlocksGraphicsView::setTree(const profiler::thread_blocks_tree_t& _blocksTr
scrollTo(longestItem);
m_pScrollbar->setHistogramSource(longestItem->threadId(), longestItem->items(0));
if (!longestItem->items(0).empty())
{
notifyVisibleRegionPosChange(longestItem->items(0).front().left() - m_visibleRegionWidth * 0.25);
// Scale to fit all items
const auto right = longestItem->items(0).back().right() - m_offset;
const auto currentScale = m_scale + std::numeric_limits<decltype(m_scale)>::epsilon();
auto scale = m_scale;
while (scale < MAX_SCALE && right < (m_visibleSceneRect.width() + vbar_width) / scale)
{
m_scale = scale;
scale *= profiler_gui::SCALING_COEFFICIENT;
}
if (currentScale < m_scale)
scaleTo(m_scale);
}
}
if (m_bHovered && !m_idleTimer.isActive())
m_idleTimer.start();
// Workaround for valid scene painting after setting a new tree
QTimer::singleShot(0, this, &This::revalidateOffset);
}
void BlocksGraphicsView::revalidateOffset()
{
notifyVisibleRegionPosChange(m_offset);
repaintScene();
}
const BlocksGraphicsView::Items &BlocksGraphicsView::getItems() const
@ -1150,7 +1237,6 @@ void BlocksGraphicsView::scaleTo(qreal _scale)
notifyVisibleRegionSizeChange(windowWidth);
updateTimelineStep(windowWidth);
repaintScene();
}
//////////////////////////////////////////////////////////////////////////
@ -1175,6 +1261,9 @@ void BlocksGraphicsView::leaveEvent(QEvent* _event)
if (!needToIgnoreMouseEvent())
removePopup();
if (m_backgroundItem != nullptr)
m_backgroundItem->mouseLeave();
}
//////////////////////////////////////////////////////////////////////////
@ -1241,7 +1330,7 @@ void BlocksGraphicsView::onWheel(qreal _scenePos, int _wheelDelta)
notifyVisibleRegionSizeChange();
// Calculate new offset to simulate QGraphicsView::AnchorUnderMouse scaling behavior
if (m_sceneWidth < m_visibleRegionWidth)
if (m_sceneWidth <= m_visibleRegionWidth)
m_offset = 0;
else
m_offset = clamp(0., initialPosition - _scenePos / m_scale, m_sceneWidth - m_visibleRegionWidth);

View File

@ -122,13 +122,14 @@ class BackgroundItem : public AuxItem
QTimer m_idleTimer;
QPainterPath m_bookmarkSign;
QLabel* m_tooltip;
size_t m_bookmark;
bool m_bButtonPressed;
public:
explicit BackgroundItem();
~BackgroundItem() override {}
~BackgroundItem() override;
void paint(QPainter* _painter, const QStyleOptionGraphicsItem* _option, QWidget* _widget = nullptr) override;
@ -136,6 +137,7 @@ public:
bool mousePress(const QPointF& scenePos);
bool mouseRelease(const QPointF& scenePos);
bool mouseDoubleClick(const QPointF& scenePos);
void mouseLeave();
bool contains(const QPointF& scenePos) const;
@ -291,6 +293,8 @@ private:
void onWheel(qreal _scenePos, int _wheelDelta);
qreal setTree(GraphicsBlockItem* _item, const ::profiler::BlocksTree::children_t& _children, qreal& _height, uint32_t& _maxDepthChild, qreal _y, short _level);
void revalidateOffset();
void addSelectionToHierarchy();
private slots:

View File

@ -1211,7 +1211,6 @@ HierarchyWidget::HierarchyWidget(QWidget* _parent) : Parent(_parent)
{
loadSettings();
m_searchBox->setFixedWidth(300);
m_searchBox->setContentsMargins(5, 0, 0, 0);
m_searchBox->setClearButtonEnabled(true);
m_searchBox->setPlaceholderText("Search by name");
@ -1316,6 +1315,12 @@ void HierarchyWidget::contextMenuEvent(QContextMenuEvent* _event)
m_tree->contextMenuEvent(_event);
}
void HierarchyWidget::showEvent(QShowEvent* event)
{
Parent::showEvent(event);
m_searchBox->setFixedWidth(px(300));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BlocksTreeWidget* HierarchyWidget::tree()

View File

@ -196,6 +196,12 @@ public:
void contextMenuEvent(QContextMenuEvent* _event) override;
void dragEnterEvent(QDragEnterEvent*) override {}
protected:
// Protected virtual methods
void showEvent(QShowEvent* event) override;
public:
// Public non-virtual methods

View File

@ -57,6 +57,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QSettings>
#include <QStyle>
#include <QTextEdit>
@ -68,6 +69,7 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent
, m_isNewBookmark(isNew)
{
setAttribute(Qt::WA_DeleteOnClose, true);
setSizeGripEnabled(EASY_GLOBALS.use_custom_window_header);
setModal(true);
const auto& bookmark = EASY_GLOBALS.bookmarks[m_bookmarkIndex];
@ -94,6 +96,7 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent
m_textEdit = new QTextEdit();
m_textEdit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
m_textEdit->setPlaceholderText(QStringLiteral("Add a description for the bookmark..."));
m_textEdit->setText(QString::fromStdString(bookmark.text));
m_colorButton = new QPushButton();
@ -135,18 +138,20 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent
mainLayout->addWidget(buttonBox, 0, Qt::AlignBottom);
connect(this, &QDialog::rejected, this, &This::onReject);
loadSettings();
}
BookmarkEditor::~BookmarkEditor()
{
saveSettings();
}
void BookmarkEditor::onSaveClicked(bool)
{
auto& bookmark = EASY_GLOBALS.bookmarks[m_bookmarkIndex];
bookmark.text = m_textEdit->toPlainText().toStdString();
bookmark.text = m_textEdit->toPlainText().trimmed().toStdString();
bookmark.color = m_colorButton->palette().brush(QPalette::Background).color().rgb();
EASY_GLOBALS.bookmark_default_color = bookmark.color;
EASY_GLOBALS.has_local_changes = true;
@ -186,3 +191,23 @@ void BookmarkEditor::onReject()
emit bookmarkRemoved(m_bookmarkIndex);
}
}
void BookmarkEditor::loadSettings()
{
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
settings.beginGroup("BookmarkEditor");
auto geometry = settings.value("geometry").toByteArray();
if (!geometry.isEmpty())
restoreGeometry(geometry);
settings.endGroup();
}
void BookmarkEditor::saveSettings()
{
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
settings.beginGroup("BookmarkEditor");
settings.setValue("geometry", saveGeometry());
settings.endGroup();
}

View File

@ -81,6 +81,11 @@ private slots:
void onColorButtonClicked(bool);
void onReject();
private:
void loadSettings();
void saveSettings();
}; // class BookmarkEditor.
#endif // EASY_PROFILER_BOOKMARKS_EDITOR_H

View File

@ -766,7 +766,6 @@ BlockDescriptorsWidget::BlockDescriptorsWidget(QWidget* _parent) : Parent(_paren
m_splitter->setStretchFactor(0, 1);
m_splitter->setStretchFactor(1, 1);
m_searchBox->setFixedWidth(300);
m_searchBox->setContentsMargins(5, 0, 0, 0);
m_searchBox->setClearButtonEnabled(true);
m_searchBox->setPlaceholderText("Search");
@ -912,6 +911,12 @@ void BlockDescriptorsWidget::contextMenuEvent(QContextMenuEvent* _event)
m_tree->contextMenuEvent(_event);
}
void BlockDescriptorsWidget::showEvent(QShowEvent* event)
{
Parent::showEvent(event);
m_searchBox->setFixedWidth(px(300));
}
void BlockDescriptorsWidget::build()
{
m_tree->clearSilent(false);

View File

@ -209,6 +209,12 @@ public:
void keyPressEvent(QKeyEvent* _event) override;
void contextMenuEvent(QContextMenuEvent* _event) override;
protected:
// Protected virtual methods
void showEvent(QShowEvent* event) override;
public:
// Public non-virtual methods

View File

@ -49,16 +49,22 @@
************************************************************************/
#include "dialog.h"
#include "globals.h"
#include "window_header.h"
#include <QApplication>
#include <QDebug>
#include <QHBoxLayout>
#include <QLabel>
#include <QMouseEvent>
#include <QPixmap>
#include <QPushButton>
#include <QSizePolicy>
#include <QStyle>
#include <QVBoxLayout>
#include <easy/utility.h>
Dialog::Dialog(QWidget* parent, const QString& title, QWidget* content, WindowHeader::Buttons headerButtons,
QMessageBox::StandardButtons buttons)
: QDialog(parent)
@ -67,7 +73,7 @@ Dialog::Dialog(QWidget* parent, const QString& title, QWidget* content, WindowHe
, m_rejectRoleButton(QMessageBox::NoButton)
, m_acceptRoleButton(QMessageBox::NoButton)
{
setSizeGripEnabled(true);
setSizeGripEnabled(EASY_GLOBALS.use_custom_window_header);
m_header = new WindowHeader(title, headerButtons, this);
@ -99,6 +105,7 @@ Dialog::Dialog(QWidget* parent, QMessageBox::Icon icon, const QString& title, co
setSizeGripEnabled(false);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setFixedSize(sizeHint());
setMouseTracking(false);
}
Dialog::~Dialog()

View File

@ -219,8 +219,8 @@ GraphicsSliderArea::GraphicsSliderArea(QWidget* _parent)
auto globalEvents = &EASY_GLOBALS.events;
connect(globalEvents, &profiler_gui::GlobalSignals::sceneCleared, this, &This::clear);
connect(globalEvents, &profiler_gui::GlobalSignals::sceneVisibleRegionSizeChanged, this, &This::setSliderWidth);
connect(globalEvents, &profiler_gui::GlobalSignals::sceneVisibleRegionPosChanged, this, &This::setValue);
connect(globalEvents, &profiler_gui::GlobalSignals::sceneVisibleRegionSizeChanged, this, &This::onExternalSliderWidthChanged);
connect(globalEvents, &profiler_gui::GlobalSignals::sceneVisibleRegionPosChanged, this, &This::onExternalChartSliderChanged);
connect(globalEvents, &profiler_gui::GlobalSignals::chartSliderChanged, this, &This::onExternalChartSliderChanged);
connect(globalEvents, &profiler_gui::GlobalSignals::sceneSizeChanged, this, &This::onSceneSizeChanged);
connect(globalEvents, &profiler_gui::GlobalSignals::lockCharts, this, &This::lock);
@ -263,6 +263,15 @@ void GraphicsSliderArea::validateScene()
}
}
void GraphicsSliderArea::onExternalSliderWidthChanged(qreal _width)
{
if (!m_bUpdatingPos)
{
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
setSliderWidth(_width);
}
}
void GraphicsSliderArea::onExternalChartSliderChanged(qreal _pos)
{
if (!m_bUpdatingPos)
@ -360,7 +369,10 @@ void GraphicsSliderArea::setValue(qreal _value)
const auto newValue = estd::clamp(m_minimumValue, _value, std::max(m_minimumValue, m_maximumValue - m_slider->width()));
if (fabs(m_value - newValue) < 2 * std::numeric_limits<decltype(m_value)>::epsilon())
{
m_slider->setX(m_value + m_slider->halfwidth());
return;
}
m_value = newValue;
m_slider->setX(m_value + m_slider->halfwidth());

View File

@ -164,6 +164,7 @@ public slots:
protected slots:
void onExternalSliderWidthChanged(qreal _width);
void onExternalChartSliderChanged(qreal _pos);
void onSceneSizeChanged(qreal _left, qreal _right);
void onWindowWidthChange(qreal _width);

View File

@ -267,7 +267,7 @@ void MainWindow::configureSizes()
size.graphics_row_spacing = 0;
size.graphics_row_full = size.graphics_row_height;
size.threads_row_spacing = size.graphics_row_full >> 1;
size.timeline_height = size.font_height + px(9);
size.timeline_height = size.font_height + px(10);
size.icon_size = size.font_height + px(11);
const auto fontFamily = w.font().family();
@ -288,6 +288,7 @@ void MainWindow::configureSizes()
updateFont(fonts.selected_item);
fonts.ruler.setFamily(fontFamily);
/*
printf("Viewport info:\n");
printf("- device pixel ratio = %f\n", size.pixelRatio);
printf("- font height = %dpx\n", size.font_height);
@ -295,6 +296,7 @@ void MainWindow::configureSizes()
printf("- diagram row = %dpx\n", size.graphics_row_height);
printf("- diagram spacing = %dpx\n", size.threads_row_spacing);
printf("- icon size = %dx%d px\n", size.icon_size, size.icon_size);
*/
w.hide();
}
@ -634,8 +636,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
auto spinbox = new QSpinBox(w);
spinbox->setRange(0, 400);
spinbox->setValue(EASY_GLOBALS.blocks_spacing);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onSpacingChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onSpacingChange);
l->addWidget(spinbox);
w->setLayout(l);
auto waction = new QWidgetAction(submenu);
@ -649,8 +651,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
spinbox = new QSpinBox(w);
spinbox->setRange(1, 400);
spinbox->setValue(EASY_GLOBALS.blocks_size_min);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onMinSizeChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onMinSizeChange);
l->addWidget(spinbox);
w->setLayout(l);
waction = new QWidgetAction(submenu);
@ -664,8 +666,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
spinbox = new QSpinBox(w);
spinbox->setRange(1, 400);
spinbox->setValue(EASY_GLOBALS.blocks_narrow_size);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onNarrowSizeChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onNarrowSizeChange);
l->addWidget(spinbox);
w->setLayout(l);
waction = new QWidgetAction(submenu);
@ -683,8 +685,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
spinbox = new QSpinBox(w);
spinbox->setRange(1, 600000);
spinbox->setValue(EASY_GLOBALS.fps_timer_interval);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsIntervalChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onFpsIntervalChange);
l->addWidget(spinbox);
w->setLayout(l);
waction = new QWidgetAction(submenu);
@ -698,8 +700,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
spinbox = new QSpinBox(w);
spinbox->setRange(2, 200);
spinbox->setValue(EASY_GLOBALS.max_fps_history);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsHistoryChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onFpsHistoryChange);
l->addWidget(spinbox);
w->setLayout(l);
waction = new QWidgetAction(submenu);
@ -713,8 +715,8 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
spinbox = new QSpinBox(w);
spinbox->setRange(1, 6);
spinbox->setValue(EASY_GLOBALS.fps_widget_line_width);
spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsMonitorLineWidthChange(int)));
spinbox->setFixedWidth(px(70));
connect(spinbox, Overload<int>::of(&QSpinBox::valueChanged), this, &This::onFpsMonitorLineWidthChange);
l->addWidget(spinbox);
w->setLayout(l);
waction = new QWidgetAction(submenu);
@ -864,7 +866,7 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
toolbar->addWidget(lbl);
m_frameTimeEdit = new QLineEdit();
m_frameTimeEdit->setFixedWidth(70);
m_frameTimeEdit->setFixedWidth(px(70));
auto val = new QDoubleValidator(m_frameTimeEdit);
val->setLocale(QLocale::c());
val->setBottom(0);
@ -1796,7 +1798,7 @@ void MainWindow::createProgressDialog(const QString& text)
m_progress = new QProgressDialog(text, QStringLiteral("Cancel"), 0, 100, this);
connect(m_progress, &QProgressDialog::canceled, this, &This::onFileReaderCancel);
m_progress->setFixedWidth(300);
m_progress->setFixedWidth(px(300));
m_progress->setWindowTitle(EASY_DEFAULT_WINDOW_TITLE);
m_progress->setModal(true);
m_progress->setValue(0);
@ -2126,6 +2128,7 @@ void MainWindow::onSavingFinish()
}
else
{
if (!m_reader.isSnapshot())
EASY_GLOBALS.has_local_changes = false;
addFileToList(m_reader.filename(), !m_reader.isSnapshot());
}

View File

@ -46,10 +46,13 @@ ArbitraryValueToolTip {
selection-color: white;
selection-background-color: #3297FD; }
QWidget#DiagramPopup, QWidget#ThreadsPopup {
QWidget#DiagramPopup, QWidget#ThreadsPopup, QLabel#BookmarkPopup {
background-color: #ffeccc;
border: 1px solid #c4c4c4; }
QLabel#BookmarkPopup {
padding: 4ex; }
QGraphicsView {
border: 1px solid #c4c4c4; }
@ -241,7 +244,7 @@ QMenu {
QMenu::item {
height: 15ex;
padding-left: 15ex;
padding-left: 17ex;
padding-right: 5ex;
border: 1px solid transparent;
/* reserve space for selection border */ }

View File

@ -99,11 +99,15 @@ ArbitraryValueToolTip {
}
}
QWidget#DiagramPopup, QWidget#ThreadsPopup {
QWidget#DiagramPopup, QWidget#ThreadsPopup, QLabel#BookmarkPopup {
background-color: $TooltipColor;
border: 1px solid $BorderColor;
}
QLabel#BookmarkPopup {
padding: 4ex;
}
QGraphicsView {
border: 1px solid $BorderColor;
}
@ -335,7 +339,7 @@ QMenu {
QMenu::item {
height: $InputHeight;
padding-left: $InputHeight;
padding-left: 17ex;
padding-right: 5ex;
border: 1px solid transparent; /* reserve space for selection border */
}