Unsolved How to do with resolution adaptation?
Limer last edited by Limer
For better layout, I often use plain number to layout, such as
setPixelSize()to get better adaptation, here is just a example, ignore it.)
So, if you use plain numbers to layout your app interface, it will lost it's adaptation.
I think it deeply for some time, finally find a way: by using resolution proportion.
QSize currentResolution = getResolution(); double resolutionProportion = currentResolution.width() / 1920.0; // 1920 is the resolution's width of your pc on which develop this app ... ... ... layout->setSpacing(20 * resolutionProportion );
Is this a good solution? If not, could you tell me the better or best solution?
Thanks a lot.
You are using an int for resolutionProportion so i fear it will be truncated and zero
for most cases.
To have effect, i think you need something like
double resolutionProportion = (double )currentResolution.width() / 1920.0;
layout->setSpacing( ceil(20 * resolutionProportion ));
(or floor or round )
Other than that, i think the idea is fine enough.
Limer last edited by
@mrjj Yes, yes....I wrote it wrong, sorry, thanks for your response.