Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在主窗口上有一个主窗口和两个以上的小部件。我想在整个主窗口上画线,当线应该在小部件上方而不是在这些小部件后面时。我试过覆盖主窗口的paintevent函数并直接画一条线,但这条线在小部件后面。我应该怎么办?
您需要有一个覆盖小部件,即覆盖主小部件区域但位于其上方的小部件。然后你paintEvent()在那个覆盖小部件中实现。有关更多详细信息,请参阅此问题。
paintEvent()