Qt Widgets全屏保证金 [英] Qt Widgets FullScreen Margin

查看:91
本文介绍了Qt Widgets全屏保证金的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个程序以完全全屏方式加载google,所以我实现了使用w.showFullScreen();全屏打开我的qt程序,它运行良好,但是当我添加QWebView并将其设置为像这样:

I want to create a program that loads google in literally full screen, so I achieved opening my qt program in full screen using w.showFullScreen(); and it works perfectly, however when I add the QWebView and set it to centralWidget like this:

但是当我运行程序时,我在窗口的两边有一些空白,换句话说,QWebView并不是与窗口和谐地全屏显示,它看起来像这样:

but when I run the program, I get some margins on the sides of the window, in other words the QWebView isn't literally in fullScreen harmoniously with the window which is, it looks like this:

我不认为我的代码有误,但在这里 untitled.pro:

I don't think my code is mistaken but here it is untitled.pro:

#-------------------------------------------------
#
# Project created by QtCreator 2015-02-07T21:25:42
#
#-------------------------------------------------

CONFIG   += release

QT       += core gui
QT       += webkitwidgets

main.cpp

w.showFullScreen();

mainwindow.cpp

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtWebKitWidgets>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->webView->load(QUrl("http://www.google.com"));
}

MainWindow::~MainWindow()
{
    delete ui;
}

谢谢.

推荐答案

您的中央窗口小部件具有布局. QtDesigner可能会出现layoutLeftMargin,layoutRightMargin,layoutTopMargin,layoutBottomMargin和其他值不为0的情况,请单击QtDesigner,然后单击中央小部件,然后在属性的下方将边距设置为0.

Your central widget have a layout. It's possible that you have layoutLeftMargin, layoutRightMargin, layoutTopMargin, layoutBottomMargin with others values than 0 got in you QtDesigner click on your central widget and at the down of you properties set the margins to 0.

这篇关于Qt Widgets全屏保证金的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆