Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1106477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:47:58+00:00 2026-05-17T01:47:58+00:00

I have a problem with a QGridLayout. One row of my layout contains an

  • 0

I have a problem with a QGridLayout. One row of my layout contains an element (QProgressbar) that is normaly hidden. When there is some progress to report i call show on it. The problem is that when i call show on the QProgressbar the row above the row containing it will be slightly resized in height (1-3 px). So the whole layout does a little “jump” which looks ugly.

I have given a minimalRowHeight to the row that contains the QProgressbar that is much larger then the height of the QProgressbar but still the height of the row will increase on show().

I have attached a very minimal version of my program that demonstrates the problem. Can anyone give me a hint what is going on there?

Header:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QLineEdit>
#include <QtWebKit/QWebView>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);

private:
    QLineEdit* input;
    QWebView *webview;

private slots:
    void slotLoadButton();
};

#endif // MAINWINDOW_H

Source:
#include “mainwindow.h”

#include <QProgressBar>
#include <QPushButton>
#include <QGridLayout>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QGridLayout *grid = new QGridLayout;

    input = new QLineEdit;

    QPushButton *loadButton = new QPushButton("load");
    connect(loadButton, SIGNAL(clicked()),
            this, SLOT(slotLoadButton()));

    webview = new QWebView;
    QProgressBar *progress = new QProgressBar;
    progress->setFixedHeight(25);
    progress->hide();

    connect(webview, SIGNAL(loadStarted()),
            progress, SLOT(show()));

    connect(webview, SIGNAL(loadProgress(int)),
            progress, SLOT(setValue(int)));

    connect(webview, SIGNAL(loadFinished(bool)),
            progress, SLOT(hide()));

    grid->addWidget(input, 0, 0);
    grid->addWidget(loadButton, 0, 1);
    grid->addWidget(webview, 1, 0, 1, -1);
    grid->setRowMinimumHeight(2, 35);
    grid->addWidget(progress, 2, 1);

    QWidget* widget = new QWidget;
    widget->setLayout(grid);
    setCentralWidget(widget);
}

void MainWindow::slotLoadButton()
{
    QUrl url = input->text();
    webview->load(url);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:47:59+00:00Added an answer on May 17, 2026 at 1:47 am

    This is likely caused by the vertical spacing and/or margins of the layout. You should try playing with those properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem in some JavaScript that I am writing where the Switch statement
I have another problem with PyQT, this time I have an example that will
I have problem with the CSS. I'm changing dynamically one div's content. The problem
I have a problem with when setting my centralwidget with QGridLayout. I have three
My current problem is that I have a JFrame with a 2x2 GridLayout. And
Good morning, I have to layout some QWidgets and layouts into a main layout,
I realsie that similar questions have been answered here about this problem but im
Hello I have a Problem with some Buttons I would like to create a
Description of the problem: I have a JFrame, inside this JFrame there is a
I have a portion of code that takes the text of a TextField (there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.