debugger: Make inspector widget smaller
Make inspector widget a bit smaller by letting the Qt widget system layout the widgets. Let the inspector widget calculate its own smallest size. Use stretch factor of 0 for inspector, 1 for picture canvas. Group the matrix and clip widgets in groups. Put the text edits in a grid layout instead of a handwritted column layout containing row layouts. This commit is part of work that tries to make the debugger window to be a bit more resizeable, so that it would fit 1900x1200 screen. Review URL: https://codereview.chromium.org/830743002
This commit is contained in:
parent
2fe9c97601
commit
7c339ae1e3
@ -609,10 +609,6 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
|
||||
|
||||
fDrawCommandGeometryWidget.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
fInspectorWidget.setSizePolicy(QSizePolicy::Expanding,
|
||||
QSizePolicy::Expanding);
|
||||
fInspectorWidget.setMaximumHeight(300);
|
||||
|
||||
fSettingsAndImageLayout.addWidget(&fSettingsWidget);
|
||||
|
||||
// View state group, part of inspector.
|
||||
@ -654,8 +650,8 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
|
||||
fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0);
|
||||
|
||||
fMainAndRightColumnLayout.setSpacing(6);
|
||||
fMainAndRightColumnLayout.addLayout(&fCanvasSettingsAndImageLayout);
|
||||
fMainAndRightColumnLayout.addWidget(&fInspectorWidget);
|
||||
fMainAndRightColumnLayout.addLayout(&fCanvasSettingsAndImageLayout, 1);
|
||||
fMainAndRightColumnLayout.addWidget(&fInspectorWidget, 0);
|
||||
fMainAndRightColumnWidget.setLayout(&fMainAndRightColumnLayout);
|
||||
|
||||
fCentralSplitter.addWidget(&fLeftColumnSplitter);
|
||||
|
@ -10,16 +10,12 @@
|
||||
#include "SkInspectorWidget.h"
|
||||
#include <iostream>
|
||||
|
||||
static const int kSignificantNumbersInFields = 5;
|
||||
|
||||
SkInspectorWidget::SkInspectorWidget() : QWidget()
|
||||
, fHorizontalLayout(this)
|
||||
, fMatrixAndClipWidget(this)
|
||||
, fVerticalLayout(&fMatrixAndClipWidget)
|
||||
, fMatrixLabel(this)
|
||||
, fClipLabel(this) {
|
||||
|
||||
fHorizontalLayout.setSpacing(6);
|
||||
fHorizontalLayout.setContentsMargins(11, 11, 11, 11);
|
||||
|
||||
, fVerticalLayout(&fMatrixAndClipWidget) {
|
||||
QString tabNames[kTotalTabCount];
|
||||
tabNames[kOverview_TabType] = "Overview";
|
||||
tabNames[kDetail_TabType] = "Details";
|
||||
@ -27,8 +23,6 @@ SkInspectorWidget::SkInspectorWidget() : QWidget()
|
||||
|
||||
for (int i = 0; i < kTotalTabCount; i++) {
|
||||
fTabTexts[i].setReadOnly(true);
|
||||
fTabLayouts[i].setSpacing(6);
|
||||
fTabLayouts[i].setContentsMargins(11, 11, 11, 11);
|
||||
fTabLayouts[i].addWidget(&fTabTexts[i]);
|
||||
fTabs[i].setLayout(&fTabLayouts[i]);
|
||||
fTabWidget.addTab(&fTabs[i], tabNames[i]);
|
||||
@ -37,17 +31,13 @@ SkInspectorWidget::SkInspectorWidget() : QWidget()
|
||||
fHorizontalLayout.setAlignment(Qt::AlignTop);
|
||||
fHorizontalLayout.addWidget(&fTabWidget);
|
||||
|
||||
/* NOTE(chudy): We add all the line edits to (this). Then we lay them out
|
||||
* by adding them to horizontal layouts.
|
||||
*
|
||||
* We will have 1 big vertical layout, 3 horizontal layouts and then 3
|
||||
* line edits in each horizontal layout. */
|
||||
fMatrixAndClipWidget.setFixedSize(260,300);
|
||||
fMatrixAndClipWidget.setFrameStyle(QFrame::Panel);
|
||||
fMatrixAndClipWidget.setDisabled(true);
|
||||
|
||||
fVerticalLayout.setAlignment(Qt::AlignVCenter);
|
||||
fVerticalLayout.addLayout(setupMatrix());
|
||||
fVerticalLayout.addLayout(setupClip());
|
||||
this->setupMatrix();
|
||||
this->setupClip();
|
||||
fVerticalLayout.addWidget(&fMatrixGroup);
|
||||
fVerticalLayout.addWidget(&fClipGroup);
|
||||
fHorizontalLayout.addWidget(&fMatrixAndClipWidget);
|
||||
}
|
||||
|
||||
@ -57,59 +47,39 @@ void SkInspectorWidget::setText(QString text, TabType type) {
|
||||
|
||||
void SkInspectorWidget::setMatrix(const SkMatrix& matrix) {
|
||||
for(int i=0; i<9; i++) {
|
||||
fMatrixEntry[i].setText(QString::number(matrix.get(i)));
|
||||
fMatrixEntry[i].setText(QString::number(matrix.get(i), 'g', kSignificantNumbersInFields));
|
||||
}
|
||||
}
|
||||
|
||||
void SkInspectorWidget::setClip(const SkIRect& clip) {
|
||||
fClipEntry[0].setText(QString::number(clip.left()));
|
||||
fClipEntry[1].setText(QString::number(clip.top()));
|
||||
fClipEntry[2].setText(QString::number(clip.right()));
|
||||
fClipEntry[3].setText(QString::number(clip.bottom()));
|
||||
fClipEntry[0].setText(QString::number(clip.left(), 'g', kSignificantNumbersInFields));
|
||||
fClipEntry[1].setText(QString::number(clip.top(), 'g', kSignificantNumbersInFields));
|
||||
fClipEntry[2].setText(QString::number(clip.right(), 'g', kSignificantNumbersInFields));
|
||||
fClipEntry[3].setText(QString::number(clip.bottom(), 'g', kSignificantNumbersInFields));
|
||||
}
|
||||
|
||||
QVBoxLayout* SkInspectorWidget::setupMatrix() {
|
||||
fMatrixLabel.setText("Current Matrix");
|
||||
fMatrixLabel.setAlignment(Qt::AlignHCenter);
|
||||
|
||||
fMatrixLayout.setSpacing(6);
|
||||
fMatrixLayout.setContentsMargins(11,11,11,0);
|
||||
fMatrixLayout.setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
fMatrixLayout.addWidget(&fMatrixLabel);
|
||||
|
||||
for(int i =0; i<9; i++) {
|
||||
fMatrixEntry[i].setMinimumSize(QSize(70,25));
|
||||
fMatrixEntry[i].setMaximumSize(QSize(70,16777215));
|
||||
fMatrixEntry[i].setReadOnly(true);
|
||||
|
||||
fMatrixRow[i/3].addWidget(&fMatrixEntry[i]);
|
||||
if(i%3 == 2) {
|
||||
fMatrixLayout.addLayout(&fMatrixRow[i/3]);
|
||||
void SkInspectorWidget::setupMatrix() {
|
||||
fMatrixGroup.setTitle("Current Matrix");
|
||||
fMatrixGroup.setLayout(&fMatrixLayout);
|
||||
for (int r = 0; r < 3; ++r) {
|
||||
for(int c = 0; c < 3; c++) {
|
||||
QLineEdit* entry = &fMatrixEntry[r * 3 + c];
|
||||
fMatrixLayout.addWidget(entry, r, c, Qt::AlignTop | Qt::AlignHCenter);
|
||||
entry->setReadOnly(true);
|
||||
entry->setFixedWidth(70);
|
||||
}
|
||||
}
|
||||
|
||||
return &fMatrixLayout;
|
||||
}
|
||||
|
||||
QVBoxLayout* SkInspectorWidget::setupClip() {
|
||||
fClipLabel.setText("Current Clip");
|
||||
fClipLabel.setAlignment(Qt::AlignHCenter);
|
||||
|
||||
fClipLayout.setSpacing(6);
|
||||
fClipLayout.setContentsMargins(11,11,11,0);
|
||||
fClipLayout.setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
fClipLayout.addWidget(&fClipLabel);
|
||||
|
||||
for(int i =0; i<4; i++) {
|
||||
fClipEntry[i].setMinimumSize(QSize(70,25));
|
||||
fClipEntry[i].setMaximumSize(QSize(70,16777215));
|
||||
fClipEntry[i].setReadOnly(true);
|
||||
|
||||
fClipRow[i/2].addWidget(&fClipEntry[i]);
|
||||
if(i%2 == 1) {
|
||||
fClipLayout.addLayout(&fClipRow[i/2]);
|
||||
void SkInspectorWidget::setupClip() {
|
||||
fClipGroup.setTitle("Current Clip");
|
||||
fClipGroup.setLayout(&fClipLayout);
|
||||
for(int r = 0; r < 2; r++) {
|
||||
for(int c = 0; c < 2; c++) {
|
||||
QLineEdit* entry = &fClipEntry[r * 2 + c];
|
||||
fClipLayout.addWidget(entry, r, c, Qt::AlignTop | Qt::AlignHCenter);
|
||||
entry->setReadOnly(true);
|
||||
entry->setFixedWidth(70);
|
||||
}
|
||||
}
|
||||
|
||||
return &fClipLayout;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QGroupBox>
|
||||
#include <QGridLayout>
|
||||
|
||||
/** \class SkInspectorWidget
|
||||
|
||||
@ -71,8 +73,6 @@ public:
|
||||
|
||||
Tab(const char* name) {
|
||||
fTabText.setReadOnly(true);
|
||||
fTabLayout.setSpacing(6);
|
||||
fTabLayout.setContentsMargins(11, 11, 11, 11);
|
||||
fTabLayout.addWidget(&fTabText);
|
||||
fTab.setLayout(&fTabLayout);
|
||||
fName = QString(name);
|
||||
@ -87,21 +87,19 @@ private:
|
||||
QHBoxLayout fTabLayouts[kTotalTabCount];
|
||||
QTextEdit fTabTexts[kTotalTabCount];
|
||||
|
||||
QWidget fMatrixAndClipWidget;
|
||||
QFrame fMatrixAndClipWidget;
|
||||
QVBoxLayout fVerticalLayout;
|
||||
|
||||
QLabel fMatrixLabel;
|
||||
QVBoxLayout fMatrixLayout;
|
||||
QHBoxLayout fMatrixRow[3];
|
||||
QGroupBox fMatrixGroup;
|
||||
QGridLayout fMatrixLayout;
|
||||
QLineEdit fMatrixEntry[9];
|
||||
|
||||
QLabel fClipLabel;
|
||||
QVBoxLayout fClipLayout;
|
||||
QHBoxLayout fClipRow[2];
|
||||
QGroupBox fClipGroup;
|
||||
QGridLayout fClipLayout;
|
||||
QLineEdit fClipEntry[4];
|
||||
|
||||
QVBoxLayout* setupMatrix();
|
||||
QVBoxLayout* setupClip();
|
||||
void setupMatrix();
|
||||
void setupClip();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user