Next revision
|
Previous revision
Next revision
Both sides next revision
|
dev:layout_code [2009/06/27 20:27] michael created |
dev:layout_code [2009/06/27 22:15] michael |
Much of our existing layout code started when KDE and Qt were at version 2.x, and it has survived the transition to Qt and KDE 3.x and then finally to Qt 4.x. Adding to the amount of legacy cruft present in this code, much of the transition to Qt 4 was done by automatic conversion scripts. This has left us with a lot of layout code that gets the job done, but it is a terrible mess, and full of all kinds of inconsistencies. | Much of our existing layout code started when KDE and Qt were at version 2.x, and it has survived the transition to Qt and KDE 3.x and then finally to Qt 4.x. Adding to the amount of legacy cruft present in this code, much of the transition to Qt 4 was done by automatic conversion scripts. This has left us with a lot of layout code that gets the job done, but it is a terrible mess, and full of all kinds of inconsistencies. |
| |
After doing a lot of work on these legacy layouts, I think it is time to set out some guidelines for new work so that people will be encouraged to follow best practices going forward, and not look back at bad old examples. Some of the strange things I've been dealing with have been from scripts that could only do so much automated work, and some it is actually from the initial conversion guidelines that were published at the start of the porting effort, which recommended practices that seem bizarre and confusing to me today. | After doing a lot of work on these legacy layouts, I think it is time to set out some guidelines for new work so that people will be encouraged to follow best practices going forward, and not look back at bad old examples. Some of the strange things I've been dealing with have been from scripts that could only do so much automated work, and some it is actually from the initial conversion guidelines that were published at the start of the porting effort, which recommended practices that seem bizarre and confusing to me today, but probably seemed like sensible best guesses to make at a time when all of this was months away from compiling, and there was no way to get immediate feedback and try different ideas. |
| |
===== A dialog box IS a QWidget ===== | ===== A dialog box IS a QWidget ===== |
| |
It is true that in order to add a layout in Qt 4 you have to have a QWidget, but if you have a QDialog, you **have** a QWidget. You do **not** need to create a new QWidget inside the dialog and add a layout to that. | It is true that in order to add a layout in Qt 4 you have to have a QWidget, but if you have a QDialog (for example), you **have** a QWidget. You do **not** need to create a new QWidget inside the dialog and add a layout to that. |
| |
We have a lot of old legacy code like: | We have a lot of old legacy code like: |