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

  • Home
  • SEARCH
  • 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 7080293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:46:38+00:00 2026-05-28T06:46:38+00:00

Here is a pruned version of a problem I have using QT/linux. The program

  • 0

Here is a pruned version of a problem I have using QT/linux. The program runs, but the size of the displayed widget is wrong (the contents, frame + labels, does not fit).

I understood that the size of a windows should be computed fron its contents (children). Why is that not happening properly here?

So the first question is, of course why this is happening.

The real program actually updates the contents of the widget at run-time. I have tried to simulate that behavior by the insertion of the main_window->show() (commented //SHOW1). If this first show() call is made, then the second show() does not show the new contents the widget. I have tried with update without success…

 #include <QApplication>
 #include <QtCore>
 #include <QMainWindow>
 #include <QTabWidget>
 #include <QWidget>
 #include <QGroupBox>
 #include <QVBoxLayout>
 #include <QLabel>

 #include <stdlib.h>


 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     QMainWindow* main_window = new(QMainWindow);
    main_window->setObjectName("main_window");
    main_window->resize(800, 600);
    main_window->setWindowTitle("Hello");

    QTabWidget* node_tab_widget = new QTabWidget(main_window);
 //    node_tab_widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
 //    node_tab_widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    node_tab_widget->setObjectName(QString::fromUtf8("tab_widget"));
    node_tab_widget->resize(500, 400);

     QWidget* w= new QWidget(node_tab_widget);
     node_tab_widget->addTab(w, "TAB");

     //main_window->show();  //SHOW1
     QGroupBox* group_widget = new QGroupBox("GROUPNAME", w);
     QVBoxLayout*  group_layout = new QVBoxLayout;
     group_widget->setLayout(group_layout);
     group_layout->addWidget((QLabel*)new QLabel(">>>>>>>>>>>>>>>>>>>>>>>>>here1"));
     group_layout->addWidget((QLabel*)new QLabel("here2"));
 //     group_widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);


     main_window->update();
     main_window->show();
     return app.exec();
 }
  • 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-28T06:46:39+00:00Added an answer on May 28, 2026 at 6:46 am

    I don’t really understand what is the result you expect, can be something like what you get from this code:

    #include <QApplication>
    #include <QtCore>
    #include <QMainWindow>
    #include <QTabWidget>
    #include <QWidget>
    #include <QGroupBox>
    #include <QVBoxLayout>
    #include <QLabel>
    #include <stdlib.h>
    
    int main(int argc, char *argv[]) {
    
     QApplication app(argc, argv);
     QMainWindow* main_window = new(QMainWindow);
     main_window->setObjectName("main_window");
     main_window->resize(800, 600);
     main_window->setWindowTitle("Hello");
    
     QTabWidget* node_tab_widget = new QTabWidget();
     node_tab_widget->setObjectName(QString::fromUtf8("tab_widget"));
     node_tab_widget->resize(500, 400);
    
     QWidget* w= new QWidget();
     node_tab_widget->addTab(w, "TAB");
    
     QGroupBox* group_widget = new QGroupBox("GROUPNAME", w);
     QVBoxLayout*  group_layout = new QVBoxLayout;
     group_widget->setLayout(group_layout);
     group_layout->addWidget((QLabel*)new QLabel(">>>>>>>>>>>>>>>>>>>>>>>>>here1"));
     group_layout->addWidget((QLabel*)new QLabel("here2"));
    
     QVBoxLayout*  gl = new QVBoxLayout;
     gl->addWidget(group_widget);
    
     main_window->setCentralWidget(node_tab_widget);
     main_window->show();
     return app.exec();
    }
    

    which add the QTabWidget node_tab_widget as central widget, with a tab TAB.

    The tab contain the QGroupBox GROUPNAME with the two labels (vertical aligned)

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

Sidebar

Related Questions

Here's a problem I ran into recently. I have attributes strings of the form
Here is my problem : I have a post controller with the action create.
Here is the problem I'm trying to solve for my game. I have this
Here's the scenario: I have a local git repository that mirrors the contents of
Here's the problem....I have three components...A Page that contains a User Control and a
Here is my problem...I have a page that loads a list of clients and
I have a problem with hashCode() that delegates to uninitialized objects using hibernate. My
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is my code, which takes two version identifiers in the form 1, 5,

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.