开发者

Need help on basic Qt structure

Hi I am a Qt beginner. I want to make something like a column of icons on the left, after click the icons different forms and results appear o开发者_运维问答n the right, how can I do this? Should I choose QMainWindow or QWidget for this project?


should I choose mainwindow or widget for this project?

If what you described are the only things present in the window, you should use a QMainWindow. If you think you will want to re-use this arrangement in the future, I'd use a QWidget. It will probably be easier to implement each set of forms as a separate QWidget (in Designer; if you're building the GUI programmatically, just add the forms to a QLayout in a QFrame).

a column of icons on the left, after click the icons different forms and results appear on the right

For the column of icons, you should look at QListWidget. It provides a vertical list of QListWidgetItems, and the items can contain icons, and nothing else. Your main window can then connect to the list widget's currentItemChanged signal (or itemChanged or something else; there are several choices), and modify the forms in the right-hand side of the window appropriately.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜