Skip to content
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ include(DDEShellPackageMacros)
include(KDEClangFormat)
include(KDEGitCommitHooks)

find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Concurrent Quick WaylandClient WaylandCompositor DBus LinguistTools Sql)
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Concurrent Quick QuickTemplates2 WaylandClient WaylandCompositor DBus LinguistTools Sql)
if(Qt${QT_VERSION_MAJOR}_VERSION VERSION_GREATER_EQUAL 6.10)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClientPrivate WaylandCompositorPrivate REQUIRED)
endif()
Expand Down
1 change: 1 addition & 0 deletions frame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ PUBLIC
Qt${QT_VERSION_MAJOR}::Quick
PRIVATE
Qt${QT_VERSION_MAJOR}::QuickPrivate
Qt${QT_VERSION_MAJOR}::QuickTemplates2Private
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::GuiPrivate
Qt${QT_VERSION_MAJOR}::WaylandClientPrivate
Expand Down
36 changes: 36 additions & 0 deletions frame/popupwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "popupwindow.h"

#include <QtQuick/QQuickItem>

Check warning on line 7 in frame/popupwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtQuick/QQuickItem> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>

Check warning on line 8 in frame/popupwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtQuickTemplates2/private/qquickcontrol_p_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DS_BEGIN_NAMESPACE
PopupWindow::PopupWindow(QWindow *parent)
: QQuickWindowQmlImpl(parent)
Expand Down Expand Up @@ -49,4 +52,37 @@
return QQuickWindowQmlImpl::mouseMoveEvent(event);
}

QFont PopupWindow::font() const
{
return m_font;
}

void PopupWindow::setFont(const QFont &font)

Check warning on line 60 in frame/popupwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'setFont' is never used.
{
m_hasExplicitFont = true;
QFont resolved = font.resolve(QGuiApplication::font());
if (m_font.resolveMask() == resolved.resolveMask() && m_font == resolved)
return;
m_font = resolved;
propagateFontToContentItem(m_font);
emit fontChanged();
}

void PopupWindow::resetFont()

Check warning on line 71 in frame/popupwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'resetFont' is never used.
{
m_hasExplicitFont = false;
QFont defaultFont;
if (m_font == defaultFont)
return;
m_font = defaultFont;
propagateFontToContentItem(m_font);
emit fontChanged();
}

void PopupWindow::propagateFontToContentItem(const QFont &font)
{
if (QQuickItem *ci = contentItem())
QQuickControlPrivate::updateFontRecur(ci, font);
}

DS_END_NAMESPACE
13 changes: 13 additions & 0 deletions frame/popupwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@
#pragma once

#include "dsglobal.h"
#include <QtGui/qfont.h>

Check warning on line 8 in frame/popupwindow.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtGui/qfont.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <private/qquickwindowmodule_p.h>

Check warning on line 9 in frame/popupwindow.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <private/qquickwindowmodule_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DS_BEGIN_NAMESPACE
class PopupWindow : public QQuickWindowQmlImpl
{
Q_OBJECT
Q_PROPERTY(QWindow *transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged)
Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
QML_NAMED_ELEMENT(PopupWindow)

public:
PopupWindow(QWindow *parent = nullptr);

Check warning on line 20 in frame/popupwindow.h

View workflow job for this annotation

GitHub Actions / cppcheck

Class 'PopupWindow' has a constructor with 1 argument that is not explicit. Such, so called "Converting constructors", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.

QFont font() const;
void setFont(const QFont &font);
void resetFont();

Q_SIGNALS:
void fontChanged();

protected:
void mouseReleaseEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;

private:
void propagateFontToContentItem(const QFont &font);

bool m_dragging;
bool m_pressing;
QFont m_font;
bool m_hasExplicitFont = false;
};
DS_END_NAMESPACE
4 changes: 3 additions & 1 deletion frame/qml/PanelPopupWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ PopupWindow {
width: 10
height: 10
flags: (Qt.platform.pluginName === "xcb" ? (Qt.Tool | Qt.WindowStaysOnTopHint) : Qt.Popup)
font.family: D.DTK.fontManager.t6.family
font.pixelSize: D.DTK.fontManager.t6.pixelSize
// WM_NAME, used for kwin.
title: "dde-shell/panelpopup"
D.DWindow.enabled: true
Expand Down Expand Up @@ -152,4 +154,4 @@ PopupWindow {
DStyle.Style.behindWindowBlur.darkNoBlurColor)
}
}
}
}
Loading