mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
Include QScreen.
This commit is contained in:
parent
b0ab36734c
commit
da5c3779c6
1 changed files with 6 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QScreen>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
SettingsPopupWidget::SettingsPopupWidget(QWidget *parent) : QWidget(parent, Qt::Popup | Qt::FramelessWindowHint)
|
SettingsPopupWidget::SettingsPopupWidget(QWidget *parent) : QWidget(parent, Qt::Popup | Qt::FramelessWindowHint)
|
||||||
|
|
@ -44,13 +45,16 @@ void SettingsPopupWidget::adjustSizeToFitScreen()
|
||||||
if (!scrollArea) {
|
if (!scrollArea) {
|
||||||
scrollArea = new QScrollArea(this);
|
scrollArea = new QScrollArea(this);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // No horizontal scrollbar
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // No horizontal scrollbar
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); // Enable vertical scrollbar when needed
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); // Enable vertical scrollbar when needed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set maximum height for the scroll area and show vertical scrollbar
|
// Set maximum height for the scroll area and show vertical scrollbar
|
||||||
scrollArea->setMaximumHeight(maxHeight);
|
scrollArea->setMaximumHeight(maxHeight);
|
||||||
setFixedHeight(maxHeight); // Set the popup height to maxHeight
|
|
||||||
|
// Resize the popup widget without squishing the content
|
||||||
|
resize(sizeHint().width(), maxHeight); // Ensure content width is kept intact
|
||||||
|
|
||||||
// Add scrollArea to layout if not already added
|
// Add scrollArea to layout if not already added
|
||||||
if (layout->count() == 1) { // We only have one widget (containerWidget) at the start
|
if (layout->count() == 1) { // We only have one widget (containerWidget) at the start
|
||||||
|
|
@ -68,7 +72,7 @@ void SettingsPopupWidget::adjustSizeToFitScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the containerWidget directly without scrollArea and adjust its height
|
// Set the containerWidget directly without scrollArea and adjust its height
|
||||||
setFixedHeight(contentHeight);
|
resize(sizeHint().width(), contentHeight); // Resize the widget based on content height
|
||||||
layout->addWidget(containerWidget); // Re-add the containerWidget without scroll area
|
layout->addWidget(containerWidget); // Re-add the containerWidget without scroll area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue