From 00dffae11583b0413a981c70f9331d9c839ca72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20O=2E=20Cordero=20P=C3=A9rez?= Date: Sat, 11 Jan 2025 01:22:24 -0400 Subject: [PATCH] Have ModelInspectorWidget make better use of space By turning a few labels into lineEdits we can not only make more more efficient use of space, but we also allow people to copy information more easily. Allows GammaRay to be used on low resolution screen with high DPI. Helps solve #358 --- .../modelinspector/modelinspectorwidget.cpp | 9 +- .../modelinspector/modelinspectorwidget.ui | 128 ++++++++++++++---- 2 files changed, 110 insertions(+), 27 deletions(-) diff --git a/plugins/modelinspector/modelinspectorwidget.cpp b/plugins/modelinspector/modelinspectorwidget.cpp index 7bad420800..209e55fc97 100644 --- a/plugins/modelinspector/modelinspectorwidget.cpp +++ b/plugins/modelinspector/modelinspectorwidget.cpp @@ -123,12 +123,13 @@ static const MetaEnum::Value item_flag_table[] = { void ModelInspectorWidget::cellDataChanged() { const auto cellData = m_interface->currentCellData(); - ui->indexLabel->setText(cellData.row != -1 + ui->indexLineEdit->setText(cellData.row != -1 ? tr("Row: %1 Column: %2").arg(cellData.row).arg(cellData.column) : tr("Invalid")); - ui->internalIdLabel->setText(cellData.internalId); - ui->internalPtrLabel->setText(cellData.internalPtr); - ui->flagsLabel->setText(MetaEnum::flagsToString(cellData.flags, item_flag_table)); + ui->internalIdLineEdit->setText(cellData.internalId); + ui->internalPtrLineEdit->setText(cellData.internalPtr); + ui->flagsPlainTextEdit->selectAll(); + ui->flagsPlainTextEdit->insertPlainText(MetaEnum::flagsToString(cellData.flags, item_flag_table)); } void ModelInspectorWidget::objectRegistered(const QString &objectName) diff --git a/plugins/modelinspector/modelinspectorwidget.ui b/plugins/modelinspector/modelinspectorwidget.ui index 58ef27aef5..496f2ed83d 100644 --- a/plugins/modelinspector/modelinspectorwidget.ui +++ b/plugins/modelinspector/modelinspectorwidget.ui @@ -14,11 +14,11 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - Qt::Vertical + Qt::Orientation::Vertical @@ -28,7 +28,7 @@ Models - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -38,7 +38,7 @@ - Qt::CustomContextMenu + Qt::ContextMenuPolicy::CustomContextMenu true @@ -47,7 +47,7 @@ - + @@ -55,14 +55,14 @@ Selection Models - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter - Qt::CustomContextMenu + Qt::ContextMenuPolicy::CustomContextMenu false @@ -75,7 +75,7 @@ - + @@ -83,20 +83,20 @@ Model Content - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter - QAbstractItemView::SelectItems + QAbstractItemView::SelectionBehavior::SelectItems - + @@ -104,7 +104,7 @@ Cell Content - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -112,55 +112,137 @@ + + + 55 + 0 + + - Model Index: + Model index: + + + true - + + + + 72 + 0 + + Invalid + + true + + + + 55 + 0 + + - Internal Id: + Internal id: + + + true - - - + + + + 72 + 0 + + + + true + + + 55 + 0 + + - Internal Pointer: + Internal pointer: + + + true - - - + + + + 72 + 0 + + + + true + + + 55 + 0 + + Flags: - + + + + 0 + 0 + + + + + 72 + 0 + + + + false + + + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents + + + false + + + true + + + + +