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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:13:30+00:00 2026-05-17T15:13:30+00:00

Greetings all, Is there any widget to separate two QWidgets and also give full

  • 0

Greetings all,

Is there any widget to separate two QWidgets and also give full focus to a one widget.
As shown in following figure ?
alt text

Thanks in advance,
umanga

  • 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-17T15:13:31+00:00Added an answer on May 17, 2026 at 3:13 pm

    How about QSplitter?

    QWidget 1, for exmaple, QListView. QWidget 2 is a combination of QWidgets (the left part is simple QPushButton with show/hide caption, and the right part another widget)… All you have to do, is to hide your QWidget2 when user clicked on QPushButton…

    If you need an example, I may post it.


    Updated

    main.cpp

    #include "splitter.h"
    #include <QtGui/QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        splitter w;
        w.show();
        return a.exec();
    }
    

    splitter.h

    #ifndef SPLITTER_H
    #define SPLITTER_H
    
    #include <QtGui/QDialog>
    
    class splitter : public QDialog
    {
        Q_OBJECT;
    
        QWidget*        widget1;
        QWidget*        widget2;
    
        QPushButton*    button;
    
    public:
        splitter(QWidget *parent = 0, Qt::WFlags flags = 0);
        ~splitter();
    
    private slots:
        void    showHide(void);
    };
    
    #endif // SPLITTER_H
    

    splitter.cpp

    #include <QtGui>
    
    #include "splitter.h"
    
    splitter::splitter(QWidget *parent, Qt::WFlags flags)
        : QDialog(parent, flags)
    {
        QApplication::setStyle("plastique");
    
        QListView*      listView = new QListView;
        QTableView*     tableView = new QTableView;
        button = new QPushButton("Hide >");
    
        widget1 = new QWidget;
        QHBoxLayout*    w1Layout = new QHBoxLayout;
        w1Layout->addWidget(listView);
        w1Layout->addWidget(button);
        widget1->setLayout(w1Layout);
    
        widget2 = new QWidget;
        QHBoxLayout*    w2Layout = new QHBoxLayout; 
        w2Layout->addWidget(tableView);
        widget2->setLayout(w2Layout);
    
        QSplitter *mainSplitter = new QSplitter(this);
        mainSplitter->addWidget(widget1);
        mainSplitter->addWidget(widget2);
    
        connect(button, SIGNAL(clicked()), this, SLOT(showHide()));
    
        QVBoxLayout *mainLayout = new QVBoxLayout;
        mainLayout->addWidget(mainSplitter);
    
        setLayout(mainLayout);
    }
    splitter::~splitter()
    {}
    void splitter::showHide(void)
    {
        if (widget2->isVisible())
        {   // hide     
            widget2->setVisible(false);
            button->setText("< Show");
        }
        else
        {   // show     
            widget2->setVisible(true);
            button->setText("Hide >");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings all, Is there any issue in the following logic for allocating 2D array:
Greetings, Is there any way to show JQuery Nice Confirm Dialog Box in MVC,
Greetings all, I have a wxPython project (created with wxFormBuilder) that contains two panels,
Greetings all Currently working on assessing a project, and wondered if there was a
Greetings all, I need help combining some htaccess rewrites, these crazy regular expressions screw
Greetings all, I'm trying to localize a .NET/C# project. I'm using string resource files
Greetings all, I have a question. On my MOSS 2007 dev box, I created
Greetings all, I have a question. I am trying to build a parametrized query
Greetings all, I'm trying to implement middleware (driver) for an embedded device with generic
Greetings to all! This is my first question here on stackoverflow. I have a

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.