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. problem when Adding button in Horizontal layout
Forum Updated to NodeBB v4.3 + New Features

problem when Adding button in Horizontal layout

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 516 Views
  • 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.
  • H Offline
    H Offline
    hjohn
    wrote on last edited by hjohn
    #1

    my main Layout is vertical laout.
    I am adding 4 things on it:
    1.Widget
    2.button1
    3.scrollarea
    4.button 2.
    And first,I want to add widget and button 1 in to horizontal layout.and add that layout in vertical layout.so not senario is something like this:
    1.horizontal layout(Which contain widget and button1)
    2.scrollarea
    3.button2
    Now problem is that when I add widget or button1 in to horizontal layout,the program get crashed.

    Code:

       m_pVerticalTabWidget = new QWidget(this);
    
       m_pBucHeaderWidget = new QWidget();
       m_pVLayout = new QVBoxLayout();
        m_pVerticalTabWidget->setLayout(m_pVLayout);
    
       HLayout_TopButton=new QHBoxLayout();
     ButtonLabelAtTop= new QPushButton();
        ButtonLabelAtTop->setMaximumWidth(40);
        HLayout_TopButton->addWidget(ButtonLabelAtTop);
    
     m_pScrollArea = new QScrollArea;
         m_pScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    
        ButtonLabelAtButtom= new QPushButton();
    
      m_pVLayout->addLayout(HLayout_TopButton);
       m_pVLayout->addWidget(m_pScrollArea);
       m_pVLayout->addWidget(ButtonLabelAtButtom);
    
    JonBJ 1 Reply Last reply
    0
    • H hjohn

      my main Layout is vertical laout.
      I am adding 4 things on it:
      1.Widget
      2.button1
      3.scrollarea
      4.button 2.
      And first,I want to add widget and button 1 in to horizontal layout.and add that layout in vertical layout.so not senario is something like this:
      1.horizontal layout(Which contain widget and button1)
      2.scrollarea
      3.button2
      Now problem is that when I add widget or button1 in to horizontal layout,the program get crashed.

      Code:

         m_pVerticalTabWidget = new QWidget(this);
      
         m_pBucHeaderWidget = new QWidget();
         m_pVLayout = new QVBoxLayout();
          m_pVerticalTabWidget->setLayout(m_pVLayout);
      
         HLayout_TopButton=new QHBoxLayout();
       ButtonLabelAtTop= new QPushButton();
          ButtonLabelAtTop->setMaximumWidth(40);
          HLayout_TopButton->addWidget(ButtonLabelAtTop);
      
       m_pScrollArea = new QScrollArea;
           m_pScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
      
          ButtonLabelAtButtom= new QPushButton();
      
        m_pVLayout->addLayout(HLayout_TopButton);
         m_pVLayout->addWidget(m_pScrollArea);
         m_pVLayout->addWidget(ButtonLabelAtButtom);
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @hjohn said in problem when Adding button in Horizontal layout:

      Now problem is that when I add widget or button1 in to horizontal layout,the program get crashed.

      So in the code as shown above, which line are you claiming actually "crashes"?

      1 Reply Last reply
      1

      • Login

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