Skip to content

Commit 6f95421

Browse files
committed
gui: Makes the timing report settings window resizable
Signed-off-by: LucasYuki <[email protected]>
1 parent 1f974c3 commit 6f95421

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/gui/src/staGui.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,9 @@ TimingControlsDialog::TimingControlsDialog(QWidget* parent)
11301130
expand_clk_(new QCheckBox(this)),
11311131
from_(new PinSetWidget(false, this)),
11321132
thru_({}),
1133-
to_(new PinSetWidget(false, this))
1133+
to_(new PinSetWidget(false, this)),
1134+
scroll_(new QScrollArea(this)),
1135+
content_widget_(new QWidget)
11341136
{
11351137
setWindowTitle("Timing Controls");
11361138

@@ -1149,8 +1151,21 @@ TimingControlsDialog::TimingControlsDialog(QWidget* parent)
11491151
setUnconstrained(false);
11501152
layout_->addRow("Unconstrained:", unconstrained_);
11511153
layout_->addRow("One path per endpoint:", one_path_per_endpoint_);
1152-
1153-
setLayout(layout_);
1154+
content_widget_->setLayout(layout_);
1155+
1156+
scroll_->setLayout(new QVBoxLayout);
1157+
scroll_->setWidget(content_widget_);
1158+
scroll_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
1159+
scroll_->adjustSize();
1160+
scroll_->setMinimumWidth(
1161+
scroll_->size().width()
1162+
+ qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent));
1163+
1164+
setLayout(new QVBoxLayout);
1165+
layout()->addWidget(scroll_);
1166+
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
1167+
setMaximumWidth(layout()->sizeHint().width());
1168+
adjustSize();
11541169

11551170
connect(path_count_spin_box_,
11561171
QOverload<int>::of(&QSpinBox::valueChanged),
@@ -1182,6 +1197,24 @@ TimingControlsDialog::TimingControlsDialog(QWidget* parent)
11821197
sta_->setIncludeCapturePaths(true);
11831198
}
11841199

1200+
QSize TimingControlsDialog::sizeHint() const
1201+
{
1202+
int width = minimumWidth();
1203+
int top = 0, bottom = 0;
1204+
if (layout())
1205+
{
1206+
layout()->getContentsMargins(nullptr, &top, nullptr, &bottom);
1207+
}
1208+
int top2 = 0, bottom2 = 0;
1209+
if (scroll_->layout())
1210+
{
1211+
scroll_->layout()->getContentsMargins(nullptr, &top2, nullptr, &bottom2);
1212+
}
1213+
1214+
int height = content_widget_->size().height()+top+bottom+top2+bottom2;
1215+
return QSize(width, height);
1216+
}
1217+
11851218
void TimingControlsDialog::setupPinRow(const QString& label,
11861219
PinSetWidget* row,
11871220
int row_index)

src/gui/src/staGui.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <QHBoxLayout>
1515
#include <QHash>
1616
#include <QListWidget>
17+
#include <QScrollArea>
1718
#include <QSpinBox>
1819
#include <map>
1920
#include <memory>
@@ -413,6 +414,8 @@ class TimingControlsDialog : public QDialog
413414
sta::Corner* getCorner() const { return sta_->getCorner(); }
414415
void setCorner(sta::Corner* corner) { sta_->setCorner(corner); }
415416

417+
QSize sizeHint() const override;
418+
416419
signals:
417420
void inspect(const Selected& selected);
418421
void expandClock(bool expand);
@@ -440,6 +443,8 @@ class TimingControlsDialog : public QDialog
440443
std::vector<PinSetWidget*> thru_;
441444
PinSetWidget* to_;
442445
QHash<QString, sta::Clock*> qstring_to_clk_;
446+
QScrollArea* scroll_;
447+
QWidget* content_widget_;
443448

444449
static constexpr int kThruStartRow = 4;
445450

0 commit comments

Comments
 (0)