推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Leon6868
V2EX  ›  Python

大佬们,请问如何让 PyQt5 的控件悬浮在子窗口上方?

  •  
  •   Leon6868 · Jun 13, 2020 · 2856 views
    This topic created in 2301 days ago, the information mentioned may be changed or developed.

    控件.png
    这个 sublime 是使用SetParent(hwnd, int(self.winId()))实现的
    我让这个蓝色的按钮悬浮在 sublime 上方,请问如何实现?

    3 replies  •  2020-06-13 20:30:38 +08:00
    imn1
        1
    imn1  
       Jun 13, 2020
    没看懂
    做成 QDock 不行么?
    march1993
        2
    march1993  
       Jun 13, 2020 via iPhone
    setparent 应该不够?应该变成内嵌的一个 document 才行?
    imn1
        3
    imn1  
       Jun 13, 2020
    几个方案
    把蓝色按钮做成 ——
    1.overlay widget,背景透明,下层可见,但可见部分是覆盖性质,不能点击穿透,估计你不是要这种
    2.QDockWidget,并设置为浮动
    3.一个单独的无边框可拖动的 window/widget,设置 windowFlag 为 ontop

    我理解 parent 主要作用是座标、控件属性、父类子类方法相互调用,诸如此类继承
    想你这个实际蓝色按钮和子窗口并无什么座标或属性继承,无必要用 parent,代码中理清 namespace 能传递信号就够了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2565 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 14:15 · PVG 22:15 · LAX 07:15 · JFK 10:15
    ♥ Do have faith in what you're doing.