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. [Solved] QSplitter and QVBoxLayout problem
Forum Updated to NodeBB v4.3 + New Features

[Solved] QSplitter and QVBoxLayout problem

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 9.3k 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.
  • A Offline
    A Offline
    amban
    wrote on last edited by
    #1

    Hi,
    I have two QVBoxLayouts which have some widgets within them. I want to add a vertical splitter between the two. I am doing something wrong..please guide me. I am adding the code -

    @
    QSplitter *mysplitter = new QSplitter(Qt::Vertical);
    QVBoxLayout *mainLayout1 = new QVBoxLayout;

    QHBoxLayout *row1 = new QHBoxLayout;
    row1->addWidget(//a QLabel);
    row1->addWidget(// a QLineEdit);
    
    QHBoxLayout *row2 = new QHBoxLayout;
    row2->addWidget(//a QLabel);
    row2->addWidget(// a QLineEdit);
    
    mainLayout1->addLayout(row1);
    mainLayout1->addLayout(row2);
    
    QVBoxLayout *mainLayout2 = new QVBoxLayout;
    
    mainLayout2->addLayout(// a QTextBrowser);
    mainLayout2->addLayout(// a QPushButton);
    
    mysplitter->addWidget(mainLayout1);
    mysplitter->addWidget(mainLayout2);
    

    @

    As expected, the error is - no matching function for call to QSplitter::addWidget(QVBoxLayout...)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      your bug is that layouts != widgets
      you have to put each layout on a widget and put the widgets into the splitter.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      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