Home > Mobile >  Qt resolution adaptive problems
Qt resolution adaptive problems

Time:11-20

Everyone a great god, and what about Qt resolution adaptive method to deal with, such as our interface are now under 1920 x1080 resolution adjust good, but if can appear under 4 k display screen button interface under the question, how can adaptive zoom pictures and frame,

CodePudding user response:

Layout is according to the percentage distribution is good, don't use fixed size control

CodePudding user response:

It can only be used to implement the layout, but a lot of places not with the layout can be done, as a map interface, size are dead, Qt is there any global properties can be amplified and to reduce the size of the interface

CodePudding user response:

refer to the second floor wangjidong198612 response:
so can only be used to implement the layout, but a lot of places not with the layout can be done, as a map interface, size are dead, Qt is there any global properties can be amplified and to reduce the size of the whole interface

QT itself layout is to zoom, map picked the big pixels of the image is good, big or small distortion

CodePudding user response:

Mean the start when designing interface should be used to do to achieve the resolution adaptive layout? Because now we have interface development basic forming, began to did not consider different resolution under the display problem, had done a lot of interface also write the size of the die, what is the way to deal with this kind of circumstance,

CodePudding user response:

reference 4 floor wangjidong198612 response:
means the start when designing interface should be used to do to achieve the resolution adaptive layout? Because now we have interface development basic forming, began to did not consider different resolution under the display problem, had done a lot of interface also write the size of the die, what is the way to deal with this kind of circumstance,

Fixed interface size graph save trouble, actually with layout under management also won't too much trouble, before sure some of them are OK

CodePudding user response:

With q

CodePudding user response:

In your main window, set setMaxSize () will automatically adapt to the window

CodePudding user response:

4 k screen, is certainly no problem when dpi=1, otherwise as long as have fixed size control, needs to be multiplied by the dpi

QScreen * screen=app. PrimaryScreen ();
Qreal dpi=screen - & gt; LogicalDotsPerInch ()/96;

CodePudding user response:

The eighth floor + 1

CodePudding user response:

Eighth floor master!!!!!!

CodePudding user response:

Qt start with 5.6.0, support High - DPI,
Int main (int arg c, char * argv [])
{
# if (QT_VERSION & gt;=QT_VERSION_CHECK (5, 6, 0))
QCoreApplication: : setAttribute (Qt: : AA_EnableHighDpiScaling);
# endif
QApplication a (arg c, argv);
.
}

Note that QCoreApplication: : setAttribute (Qt: : AA_EnableHighDpiScaling); Must add before QApplication create,

# if (QT_VERSION & gt;=QT_VERSION_CHECK (5, 6, 0)) ensure that only in Qt5.6.0 and above versions available,
Personally experiment can be realized

CodePudding user response:

I don't know what 4 k, but if you can, in the interface design and debug, first put their own computer set to 4 k, or close to,
So that it can simulate run in that environment,

CodePudding user response:

Private slots:
Void resizeEvent (QResizeEvent * size);

This writing code inside, adaptive, I can do it, or use of layout

CodePudding user response:

Void Dialog_web_html5Test: : resizeEvent (QResizeEvent * size)
{
//QSize size (this - & gt; Width (), and this - & gt; Height () - 60);
The UI - & gt; The webView - & gt; The resize (this - & gt; Width (), and this - & gt; Height () - 60);
}

CodePudding user response:


Qt start with 5.6.0, support High - DPI,
Int main (int arg c, char * argv [])
{
# if (QT_VERSION & gt;=QT_VERSION_CHECK (5, 6, 0))
QCoreApplication: : setAttribute (Qt: : AA_EnableHighDpiScaling);
# endif
QApplication a (arg c, argv);

QFont font (QStringLiteral (" new song typeface "));
The font. SetPixelSize (12);
A.s etFont (font);

.
Return a.e xec ();
}

Plus high screen support, plus font

CodePudding user response:

Use QScrollArea, very easy to solve the problem!

CodePudding user response:

Set the minimum width control work, QScrollArea automatic scroll bar

CodePudding user response:

decisive leave a mark

CodePudding user response:

https://blog.csdn.net/a844651990/article/details/83963669
  •  Tags:  
  • Qt
  • Related