Qt Widgets全屏保证金 [英] Qt Widgets FullScreen Margin
问题描述
我想创建一个程序以完全全屏方式加载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屋!