mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 09:39:15 +00:00
UI: Reduce settings dialog height if greater than the desktop
Co-authored-by: Warchamp7 <warchamp2003@hotmail.com> Co-authored-by: derrod <dennis@obsproject.com> Co-authored-by: Ryan Foster <ryan@obsproject.com>
This commit is contained in:
parent
dcd1bd9a80
commit
d88e788f7f
|
@ -4279,6 +4279,20 @@ void OBSBasicSettings::closeEvent(QCloseEvent *event)
|
|||
event->ignore();
|
||||
}
|
||||
|
||||
void OBSBasicSettings::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
|
||||
/* Reduce the height of the widget area if too tall compared to the screen
|
||||
* size (e.g., 720p) with potential window decoration (e.g., titlebar). */
|
||||
const int titleBarHeight =
|
||||
QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight);
|
||||
const int maxHeight =
|
||||
round(screen()->availableGeometry().height() - titleBarHeight);
|
||||
if (size().height() >= maxHeight)
|
||||
resize(size().width(), maxHeight);
|
||||
}
|
||||
|
||||
void OBSBasicSettings::reject()
|
||||
{
|
||||
if (AskIfCanCloseSettings())
|
||||
|
|
|
@ -480,6 +480,7 @@ private slots:
|
|||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
void reject() override;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue