Tracing: Follow the active toolbar style

This makes sure that the toolbar and toolbuttons in the trace resemble
the look of the widget based UI in compact and relaxed toolbar style.

This comes with the restriction that an already open tracing scene does
only adapt to that change after an IDE restart.

Task-number: QTCREATORBUG-29082
Change-Id: I6422227256d8e13658ff5565ae640e15c5e61229
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2023-04-24 18:24:11 +02:00
parent 0430aaeac8
commit 09a58ddd12
6 changed files with 21 additions and 6 deletions

View File

@@ -22,10 +22,12 @@ ToolButton {
smooth: false
}
background: Rectangle {
background: PaddedRectangle {
padding: Theme.compactToolbar() ? 0 : 3
radius: Theme.compactToolbar() ? 0 : 5
color: (parent.checked || parent.pressed)
? Theme.color(Theme.FancyToolButtonSelectedColor)
: parent.hovered
: (parent.hovered && parent.enabled)
? Theme.color(Theme.FancyToolButtonHoverColor)
: "#00000000"
}

View File

@@ -156,7 +156,7 @@ Rectangle {
anchors.top: parent.top
anchors.left: parent.left
width: 150
height: 24
height: Theme.toolBarHeight()
onZoomControlChanged: zoomSliderToolBar.visible = !zoomSliderToolBar.visible
onJumpToNext: {
var next = timelineModelAggregator.nextItem(root.selectedModel, root.selectedItem,

View File

@@ -9,7 +9,7 @@ import QtCreator.Tracing
Item {
id: rangeDetails
property real titleBarHeight: 20
property real titleBarHeight: Theme.toolBarHeight() / 1.2
property real borderWidth: 1
property real outerMargin: 10
property real innerMargin: 5

View File

@@ -11,7 +11,7 @@ Item {
property double rangeDuration
property int textMargin: 5
property int labelsHeight: 24
property int labelsHeight: Theme.toolBarHeight()
property int fontSize: 8
property int initialBlockLength: 120
property double spacing: width / rangeDuration

View File

@@ -5,8 +5,9 @@
#include <utils/icon.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
#include <utils/stylehelper.h>
#include <utils/theme/theme.h>
#include <utils/utilsicons.h>
#include <QIcon>
#include <QQmlContext>
@@ -92,4 +93,14 @@ void TimelineTheme::setupTheme(QQmlEngine *engine)
engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider);
}
bool TimelineTheme::compactToolbar() const
{
return StyleHelper::toolbarStyle() == StyleHelper::ToolbarStyleCompact;
}
int TimelineTheme::toolBarHeight() const
{
return StyleHelper::navigationWidgetHeight();
}
} // namespace Timeline

View File

@@ -22,6 +22,8 @@ public:
explicit TimelineTheme(QObject *parent = nullptr);
static void setupTheme(QQmlEngine* engine);
Q_INVOKABLE bool compactToolbar() const;
Q_INVOKABLE int toolBarHeight() const;
};
} // namespace Timeline