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

The Archive Base Latest Questions

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

I am embedding some QTableWidget(s) recursively inside of each other. The final GUI will

  • 0

I am embedding some QTableWidget(s) recursively inside of each other. The final GUI will have 4 to a couple thousand squares. Here is an example screenshot only showing 16 squares.:

...

Because there are so many squares (thousands) that need to be displayed I need the minimum size of each square to be something like 5×5 pixels.

The problem is that I used my mouse to size the window as small as possible… and then I got to what you see in the screenshot! The screenshot has each square being about 18×18 pixels… which isn’t small enough to fit thousands of squares on a screen. Something is preventing me from using my mouse to size the squares smaller!

How can I make the squares in this screenshot have a smaller minimum size?

main.cpp:

#include "TableWidget.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    TableWidget *x1 = new TableWidget(2,2);
    for(int i = 0; i < x1->rowCount(); i++) {
        for(int j = 0; j < x1->columnCount(); j++) {
            x1->setCellWidget(i,j,new TableWidget(2,2));
        }
    }

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(x1, 0, 0);

    QWidget *window = new QWidget;
    window->setLayout(layout);
    window->show();

    return a.exec();
}

TableWidget.h:

class TableWidget : public QTableWidget
{
    Q_OBJECT
public:
    TableWidget(int rows, int columns, QWidget *parent = 0);
private:
signals:
public slots:
};

TableWidget.cpp:

TableWidget::TableWidget(int rows, int columns, QWidget *parent) :
    QTableWidget(rows,columns,parent)
{
    //------
    QTableWidget::horizontalHeader()->hide();
    QTableWidget::verticalHeader()->hide();
    //------
    QTableWidget::horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    QTableWidget::verticalHeader()->setResizeMode(QHeaderView::Stretch);
    //------
    QTableWidget::setEditTriggers(QAbstractItemView::NoEditTriggers);
    //------
    QTableWidget::setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QTableWidget::setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //------
    QTableWidget::horizontalHeader()->setMinimumSectionSize(1);
    QTableWidget::verticalHeader()->setMinimumSectionSize(1);
    QTableWidget::horizontalHeader()->setDefaultSectionSize(1);
    QTableWidget::verticalHeader()->setDefaultSectionSize(1);
    // FIXME, the minimum size is not 1 pixel... it is like 10 pixels...
    //------
    QTableWidget::setSelectionMode(QAbstractItemView::NoSelection);
}

UPDATE – As per comments below I tried rendering many more squares and here is 1024:

enter image description here

  • 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-26T06:38:36+00:00Added an answer on May 26, 2026 at 6:38 am

    On my WindowsXP, I can’t shrink most programs lower than 148×96. It might have absolutely nothing to do with your Widgets.

    Test with 256+ squares, and tell us how big each square is.

    Windows (and whatever it is you’re using) have this limitation to guarantee the users are able to see the bottons on the top, a few letters of the title, and enough room for scrollbars. And so the user doesn’t lose the program they shrunk to 3x2px.

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

Sidebar

Related Questions

I have some site where I am embedding a couple of youtube videos in
I am developing a GUI application in Qt, and I have some difficulties embedding
I've got some YouTube embedding code (I will paste only code which is causing
Have tried all the embedding approaches listed on W3 schools and then some more.
I am embedding Lua in a C++ application. I have some modules (for now,
Is there any helper (perhaps, an interface to some other video embedding framework) that
I have some video embedding code generated for one of the videos on a
I have a webapp embedding some flash content in an iframe. The flash part
I'm developing a free application and would like to make some money by embedding
I need to convert some images to base64 for embedding into my CSS... anyone

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.