Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QBoxLayout composition

QBoxLayout composition

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kirsanov
    wrote on last edited by
    #1

    One of widgets (playground) is invisible:
    @ QHBoxLayout *colLayout = new QHBoxLayout;
    colLayout->addWidget(colLabel);
    colLayout->addWidget(colSlider);
    colLayout->addWidget(colSpinBox);

    QHBoxLayout *rowLayout = new QHBoxLayout;
    rowLayout->addWidget(rowLabel);
    rowLayout->addWidget(rowSlider);
    rowLayout->addWidget(rowSpinBox);
    
    QHBoxLayout *genIntevalLayout = new QHBoxLayout;
    genIntevalLayout->addWidget(genIntervalSlider);
    genIntevalLayout->addWidget(genIntervalLineEdit);
    
    QVBoxLayout *editLayout = new QVBoxLayout;
    editLayout->addWidget(sizeLabel, 0, Qt::AlignCenter);
    editLayout->addLayout(colLayout);
    editLayout->addLayout(rowLayout);
    editLayout->addWidget(genIntervalLabel, 0, Qt::AlignCenter);
    editLayout->addLayout(genIntevalLayout);
    editLayout->addStretch();
    editLayout->addLayout(buttonLayout);
    
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(playground);
    mainLayout->addLayout(editLayout);
    
    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(mainLayout);
    
    setCentralWidget(mainWidget);
    

    @

    Please tell me, where is my mistake.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      What is playground? Does it have a reasonable size hint and/or minimum size?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kirsanov
        wrote on last edited by
        #3

        it's widget's son
        here is the code:
        @class Playground : public QWidget {
        Q_OBJECT

        public:
        Playground();
        int cols(){return colCount;}
        int rows(){return rowCount;}
        private:
        int colCount;
        int rowCount;
        int interval;
        bool **table;
        QColor lineColor;
        QColor rectColor;
        QTimer *timer;

        void paintEvent(QPaintEvent *);
        void mousePressEvent(QMouseEvent *event);
        void drawTable(QPainter &painter);
        void drawWorld(QPainter &painter);
        

        private slots:
        void newGeneration();
        void startGame();
        void pauseGame();
        void resetGame();
        signals:
        void gameOver();
        public:
        bool isActive();
        };@

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kirsanov
          wrote on last edited by
          #4

          ok, i solved this problem? by adding @setMinimumSize(rowCount3, colCount3);@ into the constructor of the Playground.
          Thank you)

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kirsanov
            wrote on last edited by
            #5

            but how can I fix width of the sideLayout?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved