Skip to content

Commit 4da9f53

Browse files
committed
Changes for hiDPI Windows machines
1 parent c0443c5 commit 4da9f53

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

src/Interface/Application/ModuleWidget.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,18 @@ void ModuleWidgetDisplay::setupFrame(QStackedWidget* stacked)
161161

162162
void ModuleWidgetDisplay::setupTitle(const QString& name)
163163
{
164-
QFont titleFont(scirunModuleFontName(), titleFontSize, QFont::Bold);
164+
auto hiDpi = ModuleWidget::highResolutionExpandFactor_ > 1;
165+
auto fontSize = titleFontSize;
166+
if (hiDpi)
167+
fontSize--;
168+
QFont titleFont(scirunModuleFontName(), fontSize, QFont::Bold);
169+
if (hiDpi)
170+
titleFont.setBold(false);
165171
titleLabel_->setFont(titleFont);
166172
titleLabel_->setText(name);
167-
QFont smallerTitleFont(scirunModuleFontName(), titleFontSize - buttonPageFontSizeDiff);
173+
if (hiDpi)
174+
titleLabel_->setMinimumHeight(1.2 * titleLabel_->minimumHeight());
175+
QFont smallerTitleFont(scirunModuleFontName(), fontSize - buttonPageFontSizeDiff);
168176
buttonGroup_->setFont(smallerTitleFont);
169177
buttonGroup_->setTitle(name);
170178
progressGroupBox_->setFont(smallerTitleFont);
@@ -1179,6 +1187,9 @@ void ModuleWidget::makeOptionsDialog()
11791187
//qDebug() << dialog_->size();
11801188
}
11811189

1190+
if (highResolutionExpandFactor_ > 1 && isViewScene_)
1191+
dialog_->adjustToolbar();
1192+
11821193
dialog_->pull();
11831194
}
11841195
}

src/Interface/Application/NetworkEditor.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,11 @@ ModuleProxyWidget* NetworkEditor::setupModuleWidget(ModuleWidget* module)
431431

432432
if (highResolutionExpandFactor_ > 1)
433433
{
434-
module->setFixedHeight(proxy->size().height() * highResolutionExpandFactor_);
435-
proxy->setMaximumHeight(proxy->size().height() * highResolutionExpandFactor_);
436-
module->setFixedWidth(proxy->size().width() * std::max(highResolutionExpandFactor_*0.9, 1.0));
437-
proxy->setMaximumWidth(proxy->size().width() * std::max(highResolutionExpandFactor_*0.9, 1.0));
434+
auto multiplier = std::min(highResolutionExpandFactor_, 1.5);
435+
module->setFixedHeight(proxy->size().height() * multiplier);
436+
proxy->setMaximumHeight(proxy->size().height() * multiplier);
437+
module->setFixedWidth(proxy->size().width() * std::max(multiplier*0.9, 1.0));
438+
proxy->setMaximumWidth(proxy->size().width() * std::max(multiplier*0.9, 1.0));
438439
}
439440

440441
scene_->addItem(proxy);

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ void SCIRunMainWindow::setupNetworkEditor()
537537
{
538538
auto screen = QApplication::desktop()->screenGeometry();
539539
if (screen.height() * screen.width() > 5000000)
540-
highResolutionExpandFactor *= 1.5;
540+
highResolutionExpandFactor = 1.7;
541541
}
542542
networkEditor_ = new NetworkEditor({ getter, defaultNotePositionGetter_, dialogErrorControl_, preexecuteFunc,
543543
tagColorFunc, tagNameFunc, highResolutionExpandFactor, dockManager_ }, scrollAreaWidgetContents_);

src/Interface/Modules/Base/ModuleDialogGeneric.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace Gui {
8080
void setupButtonBar();
8181
bool isCollapsed() const { return collapsed_; }
8282
virtual void createStartupNote() {}
83+
virtual void adjustToolbar() {}
8384
static void setExecutionDisablingServiceFunctionAdd(ExecutionDisablingServiceFunction add) { disablerAdd_ = add; }
8485
static void setExecutionDisablingServiceFunctionRemove(ExecutionDisablingServiceFunction remove) { disablerRemove_ = remove; }
8586
static const std::set<ModuleDialogGeneric*>& instances() { return instances_; }

src/Interface/Modules/Render/ViewScene.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ void ViewSceneDialog::pullSpecial()
160160
pulledSavedVisibility_ = true;
161161
}
162162

163+
void ViewSceneDialog::adjustToolbar()
164+
{
165+
for (auto& child : mToolBar->children())
166+
{
167+
auto button = qobject_cast<QPushButton*>(child);
168+
if (button)
169+
{
170+
button->setFixedSize(button->size() * 2);
171+
button->setIconSize(button->iconSize() * 2);
172+
}
173+
}
174+
}
175+
163176
void ViewSceneDialog::setInitialLightValues()
164177
{
165178
auto light0str = state_->getValue(Modules::Render::ViewScene::HeadLightColor).toString();

src/Interface/Modules/Render/ViewScene.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ namespace SCIRun {
6666
Dataflow::Networks::ModuleStateHandle state,
6767
QWidget* parent = nullptr);
6868

69+
void adjustToolbar() override;
6970
Q_SIGNALS:
7071
void newGeometryValueForwarder();
7172
void mousePressSignalForTestingGeometryObjectFeedback(int x, int y, const std::string& selName);

0 commit comments

Comments
 (0)