Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for side panel widget out of screen #3522 #3550

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Windows-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/
Qt5_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt5\
QTDIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\
# 2022.06.15.1
VCPKG_VERSION: cef0b3ec767df6e83806899fe9525f6cf8d7bc91
# 2024.03.25
VCPKG_VERSION: a34c873a9717a888f58dc05268dea15592c2f0ff
VCPKG_PACKAGES: openssl-windows
OPENSSL_ROOT_DIR: ${{ github.workspace }}\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}\
strategy:
Expand Down
29 changes: 18 additions & 11 deletions src/widgets/capture/capturewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,20 +1062,29 @@ void CaptureWidget::initContext(bool fullscreen, const CaptureRequest& req)
void CaptureWidget::initPanel()
{
QRect panelRect = rect();

if (m_context.fullscreen) {
QScreen* currentScreen = nullptr;
qreal devicePixelRatio = 0;

#if (defined(Q_OS_MACOS) || defined(Q_OS_LINUX))
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
currentScreen = QGuiAppCurrentScreen().currentScreen();
panelRect = currentScreen->geometry();
auto devicePixelRatio = currentScreen->devicePixelRatio();
panelRect.moveTo(static_cast<int>(panelRect.x() / devicePixelRatio),
static_cast<int>(panelRect.y() / devicePixelRatio));
devicePixelRatio = currentScreen->devicePixelRatio();
#else
panelRect = QGuiApplication::primaryScreen()->geometry();
auto devicePixelRatio =
QGuiApplication::primaryScreen()->devicePixelRatio();
panelRect.moveTo(panelRect.x() / devicePixelRatio,
panelRect.y() / devicePixelRatio);
currentScreen = QGuiApplication::primaryScreen();
panelRect = currentScreen->geometry();
devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio();
#endif
QRect virtualGeometry = currentScreen->virtualGeometry();
QPoint screenOffset = panelRect.topLeft() - virtualGeometry.topLeft();

// Move panelRect by the offset
// of the primary display to the virtual display
panelRect.moveTo(screenOffset);

panelRect.moveTo(static_cast<int>(panelRect.x() / devicePixelRatio),
static_cast<int>(panelRect.y() / devicePixelRatio));
}

if (ConfigHandler().showSidePanelButton()) {
Expand Down Expand Up @@ -1108,11 +1117,9 @@ void CaptureWidget::initPanel()
makeChild(m_panel);
#if defined(Q_OS_MACOS)
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
panelRect.moveTo(mapFromGlobal(panelRect.topLeft()));
m_panel->setFixedWidth(static_cast<int>(m_colorPicker->width() * 1.5));
m_panel->setFixedHeight(currentScreen->geometry().height());
#else
panelRect.moveTo(mapFromGlobal(panelRect.topLeft()));
panelRect.setWidth(m_colorPicker->width() * 1.5);
m_panel->setGeometry(panelRect);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/panel/sidepanelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
m_layout->addWidget(m_colorWheel);
m_layout->addWidget(m_colorHex);

QHBoxLayout* gridHBoxLayout = new QHBoxLayout(this);
QHBoxLayout* gridHBoxLayout = new QHBoxLayout();
m_gridCheck = new QCheckBox(tr("Display grid"), this);
m_gridSizeSpin = new QSpinBox(this);
m_gridSizeSpin->setRange(5, 50);
Expand Down
7 changes: 1 addition & 6 deletions src/widgets/panel/utilitypanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ UtilityPanel::UtilityPanel(CaptureWidget* captureWidget)
m_internalPanel,
&QWidget::hide);

#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
move(0, 0);
#endif
hide();
}

Expand Down Expand Up @@ -87,9 +84,7 @@ void UtilityPanel::show()
m_showAnimation->setEndValue(QRect(0, 0, width(), height()));
m_internalPanel->show();
m_showAnimation->start();
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
move(0, 0);
#endif

QWidget::show();
}

Expand Down
Loading