|
void | frameMarginsChanged () |
| 信号会在 frameMargins 属性的值改变时被发送.
|
|
void | windowRadiusChanged () |
| 信号会在 windowRadius 属性的值改变时被发送
|
|
void | borderWidthChanged () |
| 信号会在 borderWidth 属性的值改变时被发送
|
|
void | borderColorChanged () |
| 信号会在 borderColor 属性的值改变时被发送
|
|
void | shadowRadiusChanged () |
| 信号会在 shadowRadius 属性的值改变时被发送
|
|
void | shadowOffsetChanged () |
| 信号会在 shadowOffset 属性的值改变时被发送
|
|
void | shadowColorChanged () |
| 信号会在 shadowColor 属性的值改变时被发送
|
|
void | clipPathChanged () |
| 信号会在 clipPath 属性的值改变时被发送
|
|
void | frameMaskChanged () |
| 信号会在 frameMask 属性的值改变时被发送
|
|
void | translucentBackgroundChanged () |
| 信号会在 translucentBackground 属性的值改变时被发送
|
|
void | enableSystemResizeChanged () |
| 信号会在 enableSystemResize 属性的值改变时被发送
|
|
void | enableSystemMoveChanged () |
| 信号会在 enableSystemMove 属性的值改变时被发送
|
|
void | enableBlurWindowChanged () |
| 信号会在 enableBlurWindow 属性的值改变时被发送
|
|
void | autoInputMaskByClipPathChanged () |
| 信号会在 autoInputMaskByClipPath 属性的值改变时被发送
|
|
|
| DPlatformHandle (QWindow *window, QObject *parent=0) |
| DPlatformHandle::DPlatformHandle 将 window 对象传递给 enableDXcbForWindow window 要开启DTK风格的主窗口 parent DPlatformHandle 对象的父对象 更多...
|
|
bool | setWindowBlurAreaByWM (const QVector< WMBlurArea > &area) |
| DPlatformHandle::setWindowBlurAreaByWM 这只是一个重载的函数,将调用 setWindowBlurAreaByWM(const QList<QPainterPath> &paths) 并将构造对象时传递的主窗口当做第一个参数 area 更多...
|
|
bool | setWindowBlurAreaByWM (const QList< QPainterPath > &paths) |
| DPlatformHandle::setWindowBlurAreaByWM 这只是一个重载的函数,将调用 setWindowBlurAreaByWM(const QVector<DPlatformHandle::WMBlurArea> &area) 并将构造对象时传递的主窗口当做第一个参数 paths 更多...
|
|
int | windowRadius () const |
|
int | borderWidth () const |
|
QColor | borderColor () const |
|
int | shadowRadius () const |
|
QPoint | shadowOffset () const |
|
QColor | shadowColor () const |
|
QPainterPath | clipPath () const |
|
QRegion | frameMask () const |
|
QMargins | frameMargins () const |
|
bool | translucentBackground () const |
|
bool | enableSystemResize () const |
|
bool | enableSystemMove () const |
|
bool | enableBlurWindow () const |
|
bool | autoInputMaskByClipPath () const |
|
WId | realWindowId () const |
|
virtual const QMetaObject * | metaObject () const const |
|
| QObject (QObject *parent) |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
QString | objectName () const const |
|
void | setObjectName (const QString &name) |
|
bool | isWidgetType () const const |
|
bool | isWindowType () const const |
|
bool | signalsBlocked () const const |
|
bool | blockSignals (bool block) |
|
QThread * | thread () const const |
|
void | moveToThread (QThread *targetThread) |
|
int | startTimer (int interval, Qt::TimerType timerType) |
|
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
|
void | killTimer (int id) |
|
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
|
const QObjectList & | children () const const |
|
void | setParent (QObject *parent) |
|
void | installEventFilter (QObject *filterObj) |
|
void | removeEventFilter (QObject *obj) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
|
bool | disconnect (const QObject *receiver, const char *method) const const |
|
void | dumpObjectTree () |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () const const |
|
void | dumpObjectInfo () const const |
|
bool | setProperty (const char *name, const QVariant &value) |
|
QVariant | property (const char *name) const const |
|
QList< QByteArray > | dynamicPropertyNames () const const |
|
void | destroyed (QObject *obj) |
|
void | objectNameChanged (const QString &objectName) |
|
QObject * | parent () const const |
|
bool | inherits (const char *className) const const |
|
void | deleteLater () |
|
| Q_DISABLE_COPY (Class) |
|
| Q_DISABLE_MOVE (Class) |
|
| Q_DISABLE_COPY_MOVE (Class) |
|
T | qobject_cast (QObject *object) |
|
T | qobject_cast (const QObject *object) |
|
T | qFindChild (const QObject *obj, const QString &name) |
|
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
|
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
|
| Q_CLASSINFO (Name, Value) |
|
| Q_INTERFACES (...) |
|
| Q_PROPERTY (...) |
|
| Q_ENUMS (...) |
|
| Q_FLAGS (...) |
|
| Q_ENUM (...) |
|
| Q_FLAG (...) |
|
| Q_ENUM_NS (...) |
|
| Q_FLAG_NS (...) |
|
| Q_OBJECT Q_OBJECT |
|
| Q_GADGET Q_GADGET |
|
| Q_NAMESPACE Q_NAMESPACE |
|
| Q_NAMESPACE_EXPORT (EXPORT_MACRO) |
|
| Q_SIGNALS Q_SIGNALS |
|
| Q_SIGNAL Q_SIGNAL |
|
| Q_SLOTS Q_SLOTS |
|
| Q_SLOT Q_SLOT |
|
| Q_EMIT Q_EMIT |
|
| Q_INVOKABLE Q_INVOKABLE |
|
| Q_REVISION Q_REVISION |
|
| Q_SET_OBJECT_NAME (Object) |
|
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT |
|
|
static QString | pluginVersion () |
| DPlatformHandle::pluginVersion 更多...
|
|
static bool | isDXcbPlatform () |
| DPlatformHandle::isDXcbPlatform 检查当前程序是否使用了dxcb平台插件。 更多...
|
|
static void | enableDXcbForWindow (QWindow *window) |
| DPlatformHandle::enableDXcbForWindow 将 QWindow 的窗口装饰设置为 DTK 风格,这将使用 Qt::FramelessWindowHint 去除本地窗口管理器 给窗口附加的边框修饰以及窗口阴影效果,并且,会创建一个对应的本地窗口(在X11平台就是指X Window) 作为此窗口的父窗口,父窗口(Frame Window)中将根据子窗口(Sub Window)的有效区域绘制阴影和边 框等效果,默认情况下,子窗口的有效区域为一个圆角矩形,结构如下: \raw HTML 更多...
|
|
static void | enableDXcbForWindow (QWindow *window, bool redirectContent) |
| DPlatformHandle::enableDXcbForWindow 功能上和 DPlatformHandle::enableDXcbForWindow(QWindow *) 一致. 更多...
|
|
static bool | isEnabledDXcb (const QWindow *window) |
| DPlatformHandle::isEnabledDXcb. 更多...
|
|
static bool | setEnabledNoTitlebarForWindow (QWindow *window, bool enable) |
| DPlatformHandle::setEnabledNoTitlebarForWindow. 更多...
|
|
static bool | isEnabledNoTitlebar (const QWindow *window) |
| DPlatformHandle::isEnableNoTitlebar window 更多...
|
|
static bool | setWindowBlurAreaByWM (QWindow *window, const QVector< WMBlurArea > &area) |
| DPlatformHandle::setWindowBlurAreaByWM 设置窗口背景的模糊区域,示例: 更多...
|
|
static bool | setWindowBlurAreaByWM (QWindow *window, const QList< QPainterPath > &paths) |
| DPlatformHandle::setWindowBlurAreaByWM 设置窗口背景的模糊区域,使用 QPainterPath 描述模糊区域,使用起来更加的灵活,可以 实现任何形状,但是性能要低于使用 QVector<DPlatformHandle::WMBlurArea> 描述模糊区域。示例: 更多...
|
|
static bool | setWindowWallpaperParaByWM (QWindow *window, const QRect &area, WallpaperScaleMode sMode, WallpaperFillMode fMode) |
| DPlatformHandle::setWindowWallpaperParaByWM 设置窗口背景壁纸,示例: 更多...
|
|
static bool | connectWindowManagerChangedSignal (QObject *object, std::function< void()> slot) |
| DPlatformHandle::connectWindowManagerChangedSignal 将窗口管理器变化的信号链接到 object 对象的 slot 槽,建议使用 DWindowManager::windowManagerChanged object slot 更多...
|
|
static bool | connectHasBlurWindowChanged (QObject *object, std::function< void()> slot) |
| DPlatformHandle::connectHasBlurWindowChanged 将窗口管理器是否支持背景模糊的信号链接到 object 对象的 slot 槽,建议使用 DWindowManager::hasBlurWindowChanged object slot 更多...
|
|
static void | setDisableWindowOverrideCursor (QWindow *window, bool disable) |
| DPlatformHandle::setDisableWindowOverrideCursor 如果 disable 为 true,则禁止窗口 window 改变光标样式,否则允许改变光标样式。 窗口被禁止改变光标样式后,使用 QWindow::setCursor 将不会产生任何效果。 window disable
|
|
static WId | windowLeader () |
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
bool | disconnect (const QMetaObject::Connection &connection) |
|
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
|
一个和Qt dxcb平台插件交互的工具类.
\inmodule dtkgui
实质性的功能皆在dxcb插件中实现,此插件目前只 支持X11平台,在其它平台上使用这个类不会有任何效果。关于dxcb:它介于Qt应用和Qt xcb平台 插件之间,通过覆写xcb插件中某些对象的虚函数来改变它的一些行为,本质上来讲是Qt xcb插件的 扩展,在X11平台上为DTK应用提供了一些改变窗口效果的功能(比如自定义窗口的边框)、其它和平 台密切相关的实现(比如修复Qt应用在X11平台的一些bug),不能脱离Qt xcb插件独立运行。dxcb 通过重载 QPlatformNativeInterface 提供接口,DPlatformHandle 中使用 QGuiApplication::platformFunction 调用这些接口。Application、dxcb、qt xcb 之间 的关系: \raw HTML
┏━━━━━━━━━━━━━━━━┓
┃ Application ┃
┗━━━━━━━━━━━━━━━━┛
⇅
┏━━━━━━━━━━━━━━━━━━━━┓
┃ dxcb plugin ┃
┗━━━━━━━━━━━━━━━━━━━━┛
⇅
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ qt xcb platform ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
\endraw
\l {http://doc.qt.io/qt-5/qpa.html}{QPA} \l {https://github.com/linuxdeepin/qt5dxcb-plugin/}{dxcb插件}
- 参见
- Dtk::Gui::DPlatformHandle::isDXcbPlatform
-
QGuiApplication::platformNativeInterface
-
Dtk::Widget::DMainWindow
-
DWindowManagerHelper
- 警告
- 使用此工具前要确保应用加载了dxcb插件
-
因为 QGuiApplication::platformFunction 是在 Qt 5.4.0 版本引入的新接口, 所以 DPlatformHandle 不支持 Qt 5.4.0 以下版本。
void Dtk::Gui::DPlatformHandle::enableDXcbForWindow |
( |
QWindow * |
window | ) |
|
|
static |
DPlatformHandle::enableDXcbForWindow 将 QWindow 的窗口装饰设置为 DTK 风格,这将使用 Qt::FramelessWindowHint 去除本地窗口管理器 给窗口附加的边框修饰以及窗口阴影效果,并且,会创建一个对应的本地窗口(在X11平台就是指X Window) 作为此窗口的父窗口,父窗口(Frame Window)中将根据子窗口(Sub Window)的有效区域绘制阴影和边 框等效果,默认情况下,子窗口的有效区域为一个圆角矩形,结构如下: \raw HTML
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Frame Window ┃
┃ ┃
┃ ┃
┃ ╭┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅╮ ┃
┃ ┋ Sub Window ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ┋ ┋ ┃
┃ ╰┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅╯ ┃
┃ ┃
┃ ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
\endraw
但是,如果窗口管理器自身支持隐藏窗口标题栏,则此方法将优先调用 enableNoTitlebarForWindow 实现同样的效果。
例子:
QWidget w1;
w1.setWindowTitle("使用系统边框的窗口");
w1.show();
DMainWindow w2;
QWidget w3;
w2.titlebar()->setTitle("使用DTK风格边框带标题栏的窗口");
w3.setWindowTitle("使用DTK风格边框没有标题栏的窗口");
w2.show();
w3.show();
开启了dxcb的窗口,在窗口外边缘10像素的范围按下鼠标左键可以触发改变窗口大小的行为, 而且会自动将鼠标吸附到对应的窗口边缘,增强了拖拽改变窗口大小的体验。效果: 另外,所有到达主窗口的鼠标移动事件如果没有调用 QEvent::accepted ,则会触发主窗 口的移动效果,默认情况下,一个没有子控件的DTK窗口,如果没有重写 QWidget::mouseMoveEvent , 则使用鼠标左键在窗口的任意地方按住并移动都会触发移动窗口的动作。如:
{
public:
}
protected:
void mouseMoveEvent(QMouseEvent *
event)
override {
event->accept();
}
};
virtual bool event(QEvent *e)
将无法使用鼠标移动窗口w
窗口管理器(如X11平台上的Window Manager)是否支持混成会影响dxcb插件对窗口添加的默认装饰。
- 注解
- 在 Deepin 桌面环境中,打开窗口特效则支持混成,关闭窗口特效则不支持混成
支持混成: 不支持混成: 并且,在不支持混成的窗口管理器中,上述“窗口边缘的鼠标吸附”效果也会被禁用。可以使用 DWindowManagerHelper::hasComposite 或 QX11Info::isCompositingManagerRunning 判断当前运行的窗口管理器是否支持混成。 window
- 参见
- Dtk::Gui::DPlatformHandle::setEnabledNoTitlebarForWindow()