c++ - QT separator widget? -


greetings all,

is there widget separate 2 qwidgets , give full focus 1 widget. shown in following figure ? alt text

thanks in advance, umanga

how qsplitter?

qwidget 1, exmaple, qlistview. qwidget 2 combination of qwidgets (the left part simple qpushbutton show/hide caption, , right part widget)... have do, hide qwidget2 when user clicked on qpushbutton...

if need example, 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 >");     } } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -