Skip to content

Commit

Permalink
Fix #25457: Style dialog too big by default
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyMeAgain233 committed Jan 8, 2025
1 parent d1860d2 commit 4e8bb6a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/notation/view/widgets/editstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ EditStyle::EditStyle(QWidget* parent)

setObjectName("EditStyle");
setupUi(this);
resizeDialog();
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
setModal(true);

Expand Down Expand Up @@ -1282,6 +1283,20 @@ void EditStyle::changeEvent(QEvent* event)
}
}

//---------------------------------------------------------
// resizeDialog
//---------------------------------------------------------

void EditStyle::resizeDialog()
{
QScreen* screen = QGuiApplication::primaryScreen();
int screenHeight = screen->size().height();
int maximumHeight = static_cast<int>(0.9 * screenHeight);
if (this->height() > maximumHeight) {
this->resize(this->width(), maximumHeight);
}
}

//---------------------------------------------------------
// retranslate
/// NOTE: keep in sync with constructor.
Expand Down
1 change: 1 addition & 0 deletions src/notation/view/widgets/editstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public slots:
void changeEvent(QEvent*);
void keyPressEvent(QKeyEvent* event);

void resizeDialog();
void retranslate();
void setHeaderFooterToolTip();
void adjustPagesStackSize(int currentPageIndex);
Expand Down
2 changes: 1 addition & 1 deletion src/notation/view/widgets/editstyle.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>933</width>
<height>824</height>
<height>752</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down

0 comments on commit 4e8bb6a

Please sign in to comment.