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 9021481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:15:57+00:00 2026-06-16T05:15:57+00:00

I am developing an application in Qt 4.8.4, in which I do the following:

  • 0

I am developing an application in Qt 4.8.4, in which I do the following:

I subclass QGridLayout as follows:

class Viewer : public QGridLayout
{
    Q_OBJECT
    ...................
private:
    // Objects
    /// Maximize button object
    ViewerGeneric* viewerGeneric;

    /// Maximize button object
    QPushButton* btnMaximize;

    /// Close button object
    QPushButton* btnClose;

    /// Connect button object
    QPushButton* btnConnect;

    /// Central viewer layout object
    QGridLayout* viewer;

    /// Indicates the row position in the main grid
    unsigned int row;

    /// Indicates the column position in the main grid
    unsigned int col;
};

Then in the constructor I do something like this:

// Create the objects
btnMaximize = new QPushButton("max");
btnClose = new QPushButton("close");
btnConnect = new QPushButton("connect");

// Add the horizontal toolbar
QHBoxLayout* toolbar = new QHBoxLayout();
toolbar->setSizeConstraint(QLayout::SetMinimumSize);
toolbar->addItem(new QSpacerItem(0, 0, 
                     QSizePolicy::Expanding, QSizePolicy::Minimum));
toolbar->addWidget(btnMaximize);
toolbar->addWidget(btnClose);

// Add the 'Connect' button
viewer = new QGridLayout();
viewer->addWidget(btnConnect);

// Add the widgets
this->addItem(toolbar, 0, 0);
this->addItem(viewer, 0, 0, 2);

But, in the end, when I show the Viewer class in my main window the window is completely blank! Hope anybody can help me. Thank you.

Cheers,

  • 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-06-16T05:15:58+00:00Added an answer on June 16, 2026 at 5:15 am

    Finally I have found the solution:

    For adding layouts into layouts, use addLayout() function instead of addItem(). I do not really know which is the difference but it works.

    Thanks for your comments!

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

Sidebar

Related Questions

I am developing an application which has around 8 Activities, and a class which
I'm having the following problem: I'm developing a C# application which requires unsafe code
I'm developing an application which has a Settings pane, following the AppPrefs sample by
I am developing android application. I am finding following problem which isdisplayed by output
I am developing a application which requires to invoke a class function which is
I'm developing an application for which i'm decoding the JSON response using java. Following
I am developing a soundboard application which extends ListActivity. I have a play button
I am developing an application which have the following windows If the information entered
i developing an application in which i found memory leak in following method how
I am developing one android application which use transparent activity.. I used the following

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.