开发者

What is the "main widget" in QT?

开发者 https://www.devze.com 2023-03-15 02:43 出处:网络
I\'ve seen the main widget referenced in a few QT docs. Does this simply refer to the first widget created after QApplication?

I've seen the main widget referenced in a few QT docs. Does this simply refer to the first widget created after QApplication?

If so, is it automatically the widget to which all user events are sent by def开发者_JAVA技巧ault?

If not, could you explain what i'm missing?


They probably refer to the QMainWindow class.


In Qt, any parentless widget is a top-level window by default. Any widget type could be your "main" window. You can have more than one. It's a convention, not a technicality.

QMainWindow incorporates a lot of common features and I recommend you start there unless you want something unusual.


The mainWidget is a Qt 3 relic, and is no longer actively supported. Its Qt 4 counterpart is the QMainWindow class.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号