您现在的位置是:主页 > news > 淘宝网站怎么做的/搜索引擎排名影响因素有哪些
淘宝网站怎么做的/搜索引擎排名影响因素有哪些
admin2025/5/21 21:42:14【news】
简介淘宝网站怎么做的,搜索引擎排名影响因素有哪些,在线客服人工服务,做兼职用什么网站最好我有一个固定大小的窗口,当Windows应用程序设置用于扩展所有文本大小时,窗口不够大,无法容纳它所包含的所有文本 . Windows通过dpi增加来实现这一点 . 我通过检索os缩放因子然后调整了我的窗口的大小和它的一些布局(由于某种原因我无法自动缩…
我有一个固定大小的窗口,当Windows应用程序设置用于扩展所有文本大小时,窗口不够大,无法容纳它所包含的所有文本 . Windows通过dpi增加来实现这一点 . 我通过检索os缩放因子然后调整了我的窗口的大小和它的一些布局(由于某种原因我无法自动缩放)来解决这个问题 .
以下是我获得dpi比例的方法(在名为“WindowsDpiScale.h”的文件中):
#ifndef WINDOWSDPISCALE_H
#define WINDOWSDPISCALE_H
#include
#ifdef Q_OS_WIN
#include
const float DEFAULT_DPI = 96.0;
float windowsDpiScale()
{
HDC screen = GetDC( 0 );
FLOAT dpiX = static_cast( GetDeviceCaps( screen, LOGPIXELSX ) );
ReleaseDC( 0, screen );
return dpiX / DEFAULT_DPI;
}
#endif //Q_OS_WIN
#endif // WINDOWSDPISCALE_H
然后,我在我的案例中如何应用它:
...
#include "WindowsDpiScale.h"
MainWindow::MainWindow( QWidget *parent )
: QMainWindow( parent )
{
...
// Enlarge the window and various child widgets to accomendate
// OS display scaling (i.e. accessibily options)
setScaleToOsSettings();
...
}
void MainWindow::setScaleToOsSettings()
{
#ifdef Q_OS_WIN
setScale( windowsDpiScale() );
#endif
}
void MainWindow::setScale( float scale )
{
// Resize the window
this->setFixedSize( (int)(scale * this->maximumWidth()),
(int)(scale * this->maximumHeight()) );
// Resize the layouts within the stacked widget
foreach( QVBoxLayout * layout,
windowUi_->pagerStackedWidget->findChildren() )
layout->parentWidget()->setFixedSize(
(int)(scale * layout->parentWidget()->contentsRect().width()),
(int)(scale * layout->parentWidget()->contentsRect().height()) );
}