Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, June 2007
QSplitter/QMainWindow and dockwidget


Message 1 in thread

Im wondering if this is feasable to do or would be more
work than it is worth.

I have 2 QMainWindows currently which work fine. (QT4.3.0)
I know I can put them into a QSplitter and use it that
way, however, how hard would it be to  make it so that the QSplitter
can be used as a splitter OR as 2 seperate QMainWindows
if the user chooses to switch between either mode on the fly?
Or is this a lot of work...or not even possible?

A coworker suggested putting both of the QMainwindows
into seperate dockwidgets, and then each dockwidget
into the QSplitter, so the user could undock it if he
wanted to.  Im unsure that will even work.

Comments?

Thanks,
Jeff

--
 [ signature omitted ] 

Message 2 in thread

Its actually pretty easy....


If its "all or nothing" then have three windows, 2 being the
qmainwindows 1 being the splitter.

Have a toggle slot, that removes the widgets from the splitter and sets
the parents to NULL, and does a show/move , and hides the splitter (or
deletes it depending on your exact needs)

When its recombining them, recreate (or show) the splitter, and read add
the qmainwindows.

The docking method could also work, but would change the frames, and
would leave the splitter around.

Scott

> -----Original Message-----
> From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> Sent: Thursday, June 14, 2007 9:00 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: QSplitter/QMainWindow and dockwidget
> 
> 
> Im wondering if this is feasable to do or would be more
> work than it is worth.
> 
> I have 2 QMainWindows currently which work fine. (QT4.3.0)
> I know I can put them into a QSplitter and use it that
> way, however, how hard would it be to  make it so that the QSplitter
> can be used as a splitter OR as 2 seperate QMainWindows
> if the user chooses to switch between either mode on the fly?
> Or is this a lot of work...or not even possible?
> 
> A coworker suggested putting both of the QMainwindows
> into seperate dockwidgets, and then each dockwidget
> into the QSplitter, so the user could undock it if he
> wanted to.  Im unsure that will even work.
> 
> Comments?
> 
> Thanks,
> Jeff
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 3 in thread

I have a related question.
I am tring to put a mainWindow inside another widget in the following
way but 
the main window is opening as a seperate window and not insode the
parent widget.

What am I doing wrong here ?

MainQtWindow::MainQtWindow(QWidget *parent)   
{
	m_bIsWindowCreated = false;

	main = new QMainWindow(parent);

	m_scene = new QGraphicsScene();
	m_scene->setSceneRect(0,0,600,800);
	m_view = new GraphicsView(m_scene, main);
		
	QDockWidget *dock = new QDockWidget(("Property View"), main);
      dock->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);

	QListWidget *customerList = new QListWidget(dock);
      customerList->addItems(QStringList()
            << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
            << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
            << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
            << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
            << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
            << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
      dock->setWidget(customerList);
    
	main->setCentralWidget(m_view);
	main->addDockWidget(Qt::RightDockWidgetArea, dock);

	main->show();


	m_bIsWindowCreated = true;
}

Thnx
Prateek 

-----Original Message-----
From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx] 
Sent: Friday, June 15, 2007 9:35 AM
To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
Subject: RE: QSplitter/QMainWindow and dockwidget

Its actually pretty easy....


If its "all or nothing" then have three windows, 2 being the
qmainwindows 1 being the splitter.

Have a toggle slot, that removes the widgets from the splitter and sets
the parents to NULL, and does a show/move , and hides the splitter (or
deletes it depending on your exact needs)

When its recombining them, recreate (or show) the splitter, and read add
the qmainwindows.

The docking method could also work, but would change the frames, and
would leave the splitter around.

Scott

> -----Original Message-----
> From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> Sent: Thursday, June 14, 2007 9:00 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: QSplitter/QMainWindow and dockwidget
> 
> 
> Im wondering if this is feasable to do or would be more work than it 
> is worth.
> 
> I have 2 QMainWindows currently which work fine. (QT4.3.0) I know I 
> can put them into a QSplitter and use it that way, however, how hard 
> would it be to  make it so that the QSplitter can be used as a 
> splitter OR as 2 seperate QMainWindows if the user chooses to switch 
> between either mode on the fly?
> Or is this a lot of work...or not even possible?
> 
> A coworker suggested putting both of the QMainwindows into seperate 
> dockwidgets, and then each dockwidget into the QSplitter, so the user 
> could undock it if he wanted to.  Im unsure that will even work.
> 
> Comments?
> 
> Thanks,
> Jeff
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with

> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 4 in thread

Your child QMainWindow's parent is probably NULL..

Your setting it to QMainWindow( parent) ie, its parent will be the same
as MainQtWindow's parent (probably null)

Instead, change main=new QMainWindow( parent ) to new QMainWindow( this
)

Scott

> -----Original Message-----
> From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> Sent: Thursday, June 14, 2007 9:32 PM
> To: Scott Aron Bloom; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> I have a related question.
> I am tring to put a mainWindow inside another widget in the following
> way but
> the main window is opening as a seperate window and not insode the
> parent widget.
> 
> What am I doing wrong here ?
> 
> MainQtWindow::MainQtWindow(QWidget *parent)
> {
> 	m_bIsWindowCreated = false;
> 
> 	main = new QMainWindow(parent);
> 
> 	m_scene = new QGraphicsScene();
> 	m_scene->setSceneRect(0,0,600,800);
> 	m_view = new GraphicsView(m_scene, main);
> 
> 	QDockWidget *dock = new QDockWidget(("Property View"), main);
>       dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> Qt::RightDockWidgetArea);
> 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> 
> 	QListWidget *customerList = new QListWidget(dock);
>       customerList->addItems(QStringList()
>             << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
>             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
>             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
>             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
>             << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
>             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
>       dock->setWidget(customerList);
> 
> 	main->setCentralWidget(m_view);
> 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> 
> 	main->show();
> 
> 
> 	m_bIsWindowCreated = true;
> }
> 
> Thnx
> Prateek
> 
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 9:35 AM
> To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> Its actually pretty easy....
> 
> 
> If its "all or nothing" then have three windows, 2 being the
> qmainwindows 1 being the splitter.
> 
> Have a toggle slot, that removes the widgets from the splitter and
sets
> the parents to NULL, and does a show/move , and hides the splitter (or
> deletes it depending on your exact needs)
> 
> When its recombining them, recreate (or show) the splitter, and read
add
> the qmainwindows.
> 
> The docking method could also work, but would change the frames, and
> would leave the splitter around.
> 
> Scott
> 
> > -----Original Message-----
> > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > Sent: Thursday, June 14, 2007 9:00 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: QSplitter/QMainWindow and dockwidget
> >
> >
> > Im wondering if this is feasable to do or would be more work than it
> > is worth.
> >
> > I have 2 QMainWindows currently which work fine. (QT4.3.0) I know I
> > can put them into a QSplitter and use it that way, however, how hard
> > would it be to  make it so that the QSplitter can be used as a
> > splitter OR as 2 seperate QMainWindows if the user chooses to switch
> > between either mode on the fly?
> > Or is this a lot of work...or not even possible?
> >
> > A coworker suggested putting both of the QMainwindows into seperate
> > dockwidgets, and then each dockwidget into the QSplitter, so the
user
> > could undock it if he wanted to.  Im unsure that will even work.
> >
> > Comments?
> >
> > Thanks,
> > Jeff
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> 
> > "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 5 in thread

That too dosent work :-( . Incidently, If I put the QMainWindow inside a
QSplitter, it works fine..

MainQtWindow::MainQtWindow(QWidget *parent) : QWidget(parent)
{
	m_bIsWindowCreated = false;

	//splitter = new QSplitter(Qt::Horizontal, parent);
	main = new QMainWindow(this);

	m_scene = new QGraphicsScene();
	m_scene->setSceneRect(0,0,600,800);
	m_view = new GraphicsView(m_scene, main);
		
	QDockWidget *dock = new QDockWidget(("Property View"), main);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);

	QListWidget *customerList = new QListWidget(dock);
    customerList->addItems(QStringList()
            << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
            << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
            << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
            << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
            << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
            << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
    dock->setWidget(customerList);
    
	main->setCentralWidget(m_view);
	main->addDockWidget(Qt::RightDockWidgetArea, dock);
	
//	splitter->addWidget(main);
//	splitter->show();

	main->show();

	m_bIsWindowCreated = true;
} 


Thnx
Prateek
-----Original Message-----
From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx] 
Sent: Friday, June 15, 2007 10:10 AM
To: Prateek Tiwari; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
Subject: RE: QSplitter/QMainWindow and dockwidget

Your child QMainWindow's parent is probably NULL..

Your setting it to QMainWindow( parent) ie, its parent will be the same
as MainQtWindow's parent (probably null)

Instead, change main=new QMainWindow( parent ) to new QMainWindow( this
)

Scott

> -----Original Message-----
> From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> Sent: Thursday, June 14, 2007 9:32 PM
> To: Scott Aron Bloom; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> I have a related question.
> I am tring to put a mainWindow inside another widget in the following 
> way but the main window is opening as a seperate window and not insode

> the parent widget.
> 
> What am I doing wrong here ?
> 
> MainQtWindow::MainQtWindow(QWidget *parent) {
> 	m_bIsWindowCreated = false;
> 
> 	main = new QMainWindow(parent);
> 
> 	m_scene = new QGraphicsScene();
> 	m_scene->setSceneRect(0,0,600,800);
> 	m_view = new GraphicsView(m_scene, main);
> 
> 	QDockWidget *dock = new QDockWidget(("Property View"), main);
>       dock->setAllowedAreas(Qt::LeftDockWidgetArea | 
> Qt::RightDockWidgetArea);
> 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> 
> 	QListWidget *customerList = new QListWidget(dock);
>       customerList->addItems(QStringList()
>             << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
>             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
>             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
>             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
>             << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
>             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
>       dock->setWidget(customerList);
> 
> 	main->setCentralWidget(m_view);
> 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> 
> 	main->show();
> 
> 
> 	m_bIsWindowCreated = true;
> }
> 
> Thnx
> Prateek
> 
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 9:35 AM
> To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> Its actually pretty easy....
> 
> 
> If its "all or nothing" then have three windows, 2 being the 
> qmainwindows 1 being the splitter.
> 
> Have a toggle slot, that removes the widgets from the splitter and
sets
> the parents to NULL, and does a show/move , and hides the splitter (or

> deletes it depending on your exact needs)
> 
> When its recombining them, recreate (or show) the splitter, and read
add
> the qmainwindows.
> 
> The docking method could also work, but would change the frames, and 
> would leave the splitter around.
> 
> Scott
> 
> > -----Original Message-----
> > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > Sent: Thursday, June 14, 2007 9:00 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: QSplitter/QMainWindow and dockwidget
> >
> >
> > Im wondering if this is feasable to do or would be more work than it

> > is worth.
> >
> > I have 2 QMainWindows currently which work fine. (QT4.3.0) I know I 
> > can put them into a QSplitter and use it that way, however, how hard

> > would it be to  make it so that the QSplitter can be used as a 
> > splitter OR as 2 seperate QMainWindows if the user chooses to switch

> > between either mode on the fly?
> > Or is this a lot of work...or not even possible?
> >
> > A coworker suggested putting both of the QMainwindows into seperate 
> > dockwidgets, and then each dockwidget into the QSplitter, so the
user
> > could undock it if he wanted to.  Im unsure that will even work.
> >
> > Comments?
> >
> > Thanks,
> > Jeff
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> 
> > "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with

> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 6 in thread

Maybe this is a silly question, based on not knowing your full
project...

Why not have MainQTWindow derive from QMainWindow, and skip the top
level QWidget....

Scott

> -----Original Message-----
> From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> Sent: Thursday, June 14, 2007 10:05 PM
> To: Scott Aron Bloom; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> That too dosent work :-( . Incidently, If I put the QMainWindow inside
a
> QSplitter, it works fine..
> 
> MainQtWindow::MainQtWindow(QWidget *parent) : QWidget(parent)
> {
> 	m_bIsWindowCreated = false;
> 
> 	//splitter = new QSplitter(Qt::Horizontal, parent);
> 	main = new QMainWindow(this);
> 
> 	m_scene = new QGraphicsScene();
> 	m_scene->setSceneRect(0,0,600,800);
> 	m_view = new GraphicsView(m_scene, main);
> 
> 	QDockWidget *dock = new QDockWidget(("Property View"), main);
>     dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> Qt::RightDockWidgetArea);
> 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> 
> 	QListWidget *customerList = new QListWidget(dock);
>     customerList->addItems(QStringList()
>             << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
>             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
>             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
>             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
>             << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
>             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
>     dock->setWidget(customerList);
> 
> 	main->setCentralWidget(m_view);
> 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> 
> //	splitter->addWidget(main);
> //	splitter->show();
> 
> 	main->show();
> 
> 	m_bIsWindowCreated = true;
> }
> 
> 
> Thnx
> Prateek
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 10:10 AM
> To: Prateek Tiwari; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> Your child QMainWindow's parent is probably NULL..
> 
> Your setting it to QMainWindow( parent) ie, its parent will be the
same
> as MainQtWindow's parent (probably null)
> 
> Instead, change main=new QMainWindow( parent ) to new QMainWindow(
this
> )
> 
> Scott
> 
> > -----Original Message-----
> > From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> > Sent: Thursday, June 14, 2007 9:32 PM
> > To: Scott Aron Bloom; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > I have a related question.
> > I am tring to put a mainWindow inside another widget in the
following
> > way but the main window is opening as a seperate window and not
insode
> 
> > the parent widget.
> >
> > What am I doing wrong here ?
> >
> > MainQtWindow::MainQtWindow(QWidget *parent) {
> > 	m_bIsWindowCreated = false;
> >
> > 	main = new QMainWindow(parent);
> >
> > 	m_scene = new QGraphicsScene();
> > 	m_scene->setSceneRect(0,0,600,800);
> > 	m_view = new GraphicsView(m_scene, main);
> >
> > 	QDockWidget *dock = new QDockWidget(("Property View"), main);
> >       dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> > Qt::RightDockWidgetArea);
> > 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> >
> > 	QListWidget *customerList = new QListWidget(dock);
> >       customerList->addItems(QStringList()
> >             << "John Doe, Harmony Enterprises, 12 Lakeside,
Ambleton"
> >             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
> >             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
> >             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
> >             << "Sol Harvey, Chicos Coffee, 53 New Springs,
Eccleston"
> >             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
> >       dock->setWidget(customerList);
> >
> > 	main->setCentralWidget(m_view);
> > 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> >
> > 	main->show();
> >
> >
> > 	m_bIsWindowCreated = true;
> > }
> >
> > Thnx
> > Prateek
> >
> > -----Original Message-----
> > From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> > Sent: Friday, June 15, 2007 9:35 AM
> > To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > Its actually pretty easy....
> >
> >
> > If its "all or nothing" then have three windows, 2 being the
> > qmainwindows 1 being the splitter.
> >
> > Have a toggle slot, that removes the widgets from the splitter and
> sets
> > the parents to NULL, and does a show/move , and hides the splitter
(or
> 
> > deletes it depending on your exact needs)
> >
> > When its recombining them, recreate (or show) the splitter, and read
> add
> > the qmainwindows.
> >
> > The docking method could also work, but would change the frames, and
> > would leave the splitter around.
> >
> > Scott
> >
> > > -----Original Message-----
> > > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > > Sent: Thursday, June 14, 2007 9:00 PM
> > > To: qt-interest@xxxxxxxxxxxxx
> > > Subject: QSplitter/QMainWindow and dockwidget
> > >
> > >
> > > Im wondering if this is feasable to do or would be more work than
it
> 
> > > is worth.
> > >
> > > I have 2 QMainWindows currently which work fine. (QT4.3.0) I know
I
> > > can put them into a QSplitter and use it that way, however, how
hard
> 
> > > would it be to  make it so that the QSplitter can be used as a
> > > splitter OR as 2 seperate QMainWindows if the user chooses to
switch
> 
> > > between either mode on the fly?
> > > Or is this a lot of work...or not even possible?
> > >
> > > A coworker suggested putting both of the QMainwindows into
seperate
> > > dockwidgets, and then each dockwidget into the QSplitter, so the
> user
> > > could undock it if he wanted to.  Im unsure that will even work.
> > >
> > > Comments?
> > >
> > > Thanks,
> > > Jeff
> > >
> > > --
> > > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with
> >
> > > "unsubscribe" in the subject or the body.
> > > List archive and information:
> http://lists.trolltech.com/qt-interest/
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> 
> > "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 7 in thread

That is because, this would be a QT dll which would be hosted from an
MFC dll,
so the parent would be a QWinWidget which would then host a QT view...

I tried making the QMainWindow directly a child of "parent", but that
dosent work either :-( 

It seems to me, from trying out various combinations, that Mainwindow
should not have a parent.
(even though the constructor allows it). Conceptually also makes sense,
since MainWindow 
should be the Top-level window.

R's
Prateek

-----Original Message-----
From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx] 
Sent: Friday, June 15, 2007 11:09 AM
To: Prateek Tiwari; qt-interest@xxxxxxxxxxxxx
Subject: RE: QSplitter/QMainWindow and dockwidget

Maybe this is a silly question, based on not knowing your full
project...

Why not have MainQTWindow derive from QMainWindow, and skip the top
level QWidget....

Scott

> -----Original Message-----
> From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> Sent: Thursday, June 14, 2007 10:05 PM
> To: Scott Aron Bloom; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> That too dosent work :-( . Incidently, If I put the QMainWindow inside
a
> QSplitter, it works fine..
> 
> MainQtWindow::MainQtWindow(QWidget *parent) : QWidget(parent) {
> 	m_bIsWindowCreated = false;
> 
> 	//splitter = new QSplitter(Qt::Horizontal, parent);
> 	main = new QMainWindow(this);
> 
> 	m_scene = new QGraphicsScene();
> 	m_scene->setSceneRect(0,0,600,800);
> 	m_view = new GraphicsView(m_scene, main);
> 
> 	QDockWidget *dock = new QDockWidget(("Property View"), main);
>     dock->setAllowedAreas(Qt::LeftDockWidgetArea | 
> Qt::RightDockWidgetArea);
> 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> 
> 	QListWidget *customerList = new QListWidget(dock);
>     customerList->addItems(QStringList()
>             << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
>             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
>             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
>             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
>             << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
>             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
>     dock->setWidget(customerList);
> 
> 	main->setCentralWidget(m_view);
> 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> 
> //	splitter->addWidget(main);
> //	splitter->show();
> 
> 	main->show();
> 
> 	m_bIsWindowCreated = true;
> }
> 
> 
> Thnx
> Prateek
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 10:10 AM
> To: Prateek Tiwari; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> Your child QMainWindow's parent is probably NULL..
> 
> Your setting it to QMainWindow( parent) ie, its parent will be the
same
> as MainQtWindow's parent (probably null)
> 
> Instead, change main=new QMainWindow( parent ) to new QMainWindow(
this
> )
> 
> Scott
> 
> > -----Original Message-----
> > From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> > Sent: Thursday, June 14, 2007 9:32 PM
> > To: Scott Aron Bloom; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > I have a related question.
> > I am tring to put a mainWindow inside another widget in the
following
> > way but the main window is opening as a seperate window and not
insode
> 
> > the parent widget.
> >
> > What am I doing wrong here ?
> >
> > MainQtWindow::MainQtWindow(QWidget *parent) {
> > 	m_bIsWindowCreated = false;
> >
> > 	main = new QMainWindow(parent);
> >
> > 	m_scene = new QGraphicsScene();
> > 	m_scene->setSceneRect(0,0,600,800);
> > 	m_view = new GraphicsView(m_scene, main);
> >
> > 	QDockWidget *dock = new QDockWidget(("Property View"), main);
> >       dock->setAllowedAreas(Qt::LeftDockWidgetArea | 
> > Qt::RightDockWidgetArea);
> > 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> >
> > 	QListWidget *customerList = new QListWidget(dock);
> >       customerList->addItems(QStringList()
> >             << "John Doe, Harmony Enterprises, 12 Lakeside,
Ambleton"
> >             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
> >             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
> >             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
> >             << "Sol Harvey, Chicos Coffee, 53 New Springs,
Eccleston"
> >             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
> >       dock->setWidget(customerList);
> >
> > 	main->setCentralWidget(m_view);
> > 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> >
> > 	main->show();
> >
> >
> > 	m_bIsWindowCreated = true;
> > }
> >
> > Thnx
> > Prateek
> >
> > -----Original Message-----
> > From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> > Sent: Friday, June 15, 2007 9:35 AM
> > To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > Its actually pretty easy....
> >
> >
> > If its "all or nothing" then have three windows, 2 being the 
> > qmainwindows 1 being the splitter.
> >
> > Have a toggle slot, that removes the widgets from the splitter and
> sets
> > the parents to NULL, and does a show/move , and hides the splitter
(or
> 
> > deletes it depending on your exact needs)
> >
> > When its recombining them, recreate (or show) the splitter, and read
> add
> > the qmainwindows.
> >
> > The docking method could also work, but would change the frames, and

> > would leave the splitter around.
> >
> > Scott
> >
> > > -----Original Message-----
> > > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > > Sent: Thursday, June 14, 2007 9:00 PM
> > > To: qt-interest@xxxxxxxxxxxxx
> > > Subject: QSplitter/QMainWindow and dockwidget
> > >
> > >
> > > Im wondering if this is feasable to do or would be more work than
it
> 
> > > is worth.
> > >
> > > I have 2 QMainWindows currently which work fine. (QT4.3.0) I know
I
> > > can put them into a QSplitter and use it that way, however, how
hard
> 
> > > would it be to  make it so that the QSplitter can be used as a 
> > > splitter OR as 2 seperate QMainWindows if the user chooses to
switch
> 
> > > between either mode on the fly?
> > > Or is this a lot of work...or not even possible?
> > >
> > > A coworker suggested putting both of the QMainwindows into
seperate
> > > dockwidgets, and then each dockwidget into the QSplitter, so the
> user
> > > could undock it if he wanted to.  Im unsure that will even work.
> > >
> > > Comments?
> > >
> > > Thanks,
> > > Jeff
> > >
> > > --
> > > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with
> >
> > > "unsubscribe" in the subject or the body.
> > > List archive and information:
> http://lists.trolltech.com/qt-interest/
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> 
> > "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 8 in thread

No... QMainwindow can have a parent with no problems...

Im looking at the code closer... Ill let you know if I see anything...

Scott

> -----Original Message-----
> From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> Sent: Thursday, June 14, 2007 10:55 PM
> To: Scott Aron Bloom; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> That is because, this would be a QT dll which would be hosted from an
> MFC dll,
> so the parent would be a QWinWidget which would then host a QT view...
> 
> I tried making the QMainWindow directly a child of "parent", but that
> dosent work either :-(
> 
> It seems to me, from trying out various combinations, that Mainwindow
> should not have a parent.
> (even though the constructor allows it). Conceptually also makes
sense,
> since MainWindow
> should be the Top-level window.
> 
> R's
> Prateek
> 
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 11:09 AM
> To: Prateek Tiwari; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
> 
> Maybe this is a silly question, based on not knowing your full
> project...
> 
> Why not have MainQTWindow derive from QMainWindow, and skip the top
> level QWidget....
> 
> Scott
> 
> > -----Original Message-----
> > From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> > Sent: Thursday, June 14, 2007 10:05 PM
> > To: Scott Aron Bloom; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > That too dosent work :-( . Incidently, If I put the QMainWindow
inside
> a
> > QSplitter, it works fine..
> >
> > MainQtWindow::MainQtWindow(QWidget *parent) : QWidget(parent) {
> > 	m_bIsWindowCreated = false;
> >
> > 	//splitter = new QSplitter(Qt::Horizontal, parent);
> > 	main = new QMainWindow(this);
> >
> > 	m_scene = new QGraphicsScene();
> > 	m_scene->setSceneRect(0,0,600,800);
> > 	m_view = new GraphicsView(m_scene, main);
> >
> > 	QDockWidget *dock = new QDockWidget(("Property View"), main);
> >     dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> > Qt::RightDockWidgetArea);
> > 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> >
> > 	QListWidget *customerList = new QListWidget(dock);
> >     customerList->addItems(QStringList()
> >             << "John Doe, Harmony Enterprises, 12 Lakeside,
Ambleton"
> >             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
> >             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
> >             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
> >             << "Sol Harvey, Chicos Coffee, 53 New Springs,
Eccleston"
> >             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
> >     dock->setWidget(customerList);
> >
> > 	main->setCentralWidget(m_view);
> > 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> >
> > //	splitter->addWidget(main);
> > //	splitter->show();
> >
> > 	main->show();
> >
> > 	m_bIsWindowCreated = true;
> > }
> >
> >
> > Thnx
> > Prateek
> > -----Original Message-----
> > From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> > Sent: Friday, June 15, 2007 10:10 AM
> > To: Prateek Tiwari; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > Subject: RE: QSplitter/QMainWindow and dockwidget
> >
> > Your child QMainWindow's parent is probably NULL..
> >
> > Your setting it to QMainWindow( parent) ie, its parent will be the
> same
> > as MainQtWindow's parent (probably null)
> >
> > Instead, change main=new QMainWindow( parent ) to new QMainWindow(
> this
> > )
> >
> > Scott
> >
> > > -----Original Message-----
> > > From: Prateek Tiwari [mailto:ptiwari@xxxxxxxxxxx]
> > > Sent: Thursday, June 14, 2007 9:32 PM
> > > To: Scott Aron Bloom; Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > > Subject: RE: QSplitter/QMainWindow and dockwidget
> > >
> > > I have a related question.
> > > I am tring to put a mainWindow inside another widget in the
> following
> > > way but the main window is opening as a seperate window and not
> insode
> >
> > > the parent widget.
> > >
> > > What am I doing wrong here ?
> > >
> > > MainQtWindow::MainQtWindow(QWidget *parent) {
> > > 	m_bIsWindowCreated = false;
> > >
> > > 	main = new QMainWindow(parent);
> > >
> > > 	m_scene = new QGraphicsScene();
> > > 	m_scene->setSceneRect(0,0,600,800);
> > > 	m_view = new GraphicsView(m_scene, main);
> > >
> > > 	QDockWidget *dock = new QDockWidget(("Property View"), main);
> > >       dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> > > Qt::RightDockWidgetArea);
> > > 	dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
> > >
> > > 	QListWidget *customerList = new QListWidget(dock);
> > >       customerList->addItems(QStringList()
> > >             << "John Doe, Harmony Enterprises, 12 Lakeside,
> Ambleton"
> > >             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
> > >             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
> > >             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
> > >             << "Sol Harvey, Chicos Coffee, 53 New Springs,
> Eccleston"
> > >             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
> > >       dock->setWidget(customerList);
> > >
> > > 	main->setCentralWidget(m_view);
> > > 	main->addDockWidget(Qt::RightDockWidgetArea, dock);
> > >
> > > 	main->show();
> > >
> > >
> > > 	m_bIsWindowCreated = true;
> > > }
> > >
> > > Thnx
> > > Prateek
> > >
> > > -----Original Message-----
> > > From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> > > Sent: Friday, June 15, 2007 9:35 AM
> > > To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> > > Subject: RE: QSplitter/QMainWindow and dockwidget
> > >
> > > Its actually pretty easy....
> > >
> > >
> > > If its "all or nothing" then have three windows, 2 being the
> > > qmainwindows 1 being the splitter.
> > >
> > > Have a toggle slot, that removes the widgets from the splitter and
> > sets
> > > the parents to NULL, and does a show/move , and hides the splitter
> (or
> >
> > > deletes it depending on your exact needs)
> > >
> > > When its recombining them, recreate (or show) the splitter, and
read
> > add
> > > the qmainwindows.
> > >
> > > The docking method could also work, but would change the frames,
and
> 
> > > would leave the splitter around.
> > >
> > > Scott
> > >
> > > > -----Original Message-----
> > > > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > > > Sent: Thursday, June 14, 2007 9:00 PM
> > > > To: qt-interest@xxxxxxxxxxxxx
> > > > Subject: QSplitter/QMainWindow and dockwidget
> > > >
> > > >
> > > > Im wondering if this is feasable to do or would be more work
than
> it
> >
> > > > is worth.
> > > >
> > > > I have 2 QMainWindows currently which work fine. (QT4.3.0) I
know
> I
> > > > can put them into a QSplitter and use it that way, however, how
> hard
> >
> > > > would it be to  make it so that the QSplitter can be used as a
> > > > splitter OR as 2 seperate QMainWindows if the user chooses to
> switch
> >
> > > > between either mode on the fly?
> > > > Or is this a lot of work...or not even possible?
> > > >
> > > > A coworker suggested putting both of the QMainwindows into
> seperate
> > > > dockwidgets, and then each dockwidget into the QSplitter, so the
> > user
> > > > could undock it if he wanted to.  Im unsure that will even work.
> > > >
> > > > Comments?
> > > >
> > > > Thanks,
> > > > Jeff
> > > >
> > > > --
> > > > To unsubscribe - send a mail to
qt-interest-request@xxxxxxxxxxxxx
> > with
> > >
> > > > "unsubscribe" in the subject or the body.
> > > > List archive and information:
> > http://lists.trolltech.com/qt-interest/
> > >
> > > --
> > > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with
> >
> > > "unsubscribe" in the subject or the body.
> > > List archive and information:
> http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 9 in thread

For what its worth, I had a similar problem. If I remember correctly, I had
to add a layout to the parent widget (a QVBoxLayout is fine) and construct
the QMainWindow with a NULL parent pointer and then use
QBoxLayout::addWidget() to put the QMainWindow in the parent.

Let me know if this works for you,
Tom

On 6/15/07, Prateek Tiwari <ptiwari@xxxxxxxxxxx> wrote:
>
> I have a related question.
> I am tring to put a mainWindow inside another widget in the following
> way but
> the main window is opening as a seperate window and not insode the
> parent widget.
>
> What am I doing wrong here ?
>
> MainQtWindow::MainQtWindow(QWidget *parent)
> {
>         m_bIsWindowCreated = false;
>
>         main = new QMainWindow(parent);
>
>         m_scene = new QGraphicsScene();
>         m_scene->setSceneRect(0,0,600,800);
>         m_view = new GraphicsView(m_scene, main);
>
>         QDockWidget *dock = new QDockWidget(("Property View"), main);
>       dock->setAllowedAreas(Qt::LeftDockWidgetArea |
> Qt::RightDockWidgetArea);
>         dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
>
>         QListWidget *customerList = new QListWidget(dock);
>       customerList->addItems(QStringList()
>             << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
>             << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
>             << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
>             << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
>             << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
>             << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
>       dock->setWidget(customerList);
>
>         main->setCentralWidget(m_view);
>         main->addDockWidget(Qt::RightDockWidgetArea, dock);
>
>         main->show();
>
>
>         m_bIsWindowCreated = true;
> }
>
> Thnx
> Prateek
>
> -----Original Message-----
> From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
> Sent: Friday, June 15, 2007 9:35 AM
> To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
> Subject: RE: QSplitter/QMainWindow and dockwidget
>
> Its actually pretty easy....
>
>
> If its "all or nothing" then have three windows, 2 being the
> qmainwindows 1 being the splitter.
>
> Have a toggle slot, that removes the widgets from the splitter and sets
> the parents to NULL, and does a show/move , and hides the splitter (or
> deletes it depending on your exact needs)
>
> When its recombining them, recreate (or show) the splitter, and read add
> the qmainwindows.
>
> The docking method could also work, but would change the frames, and
> would leave the splitter around.
>
> Scott
>
> > -----Original Message-----
> > From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> > Sent: Thursday, June 14, 2007 9:00 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: QSplitter/QMainWindow and dockwidget
> >
> >
> > Im wondering if this is feasable to do or would be more work than it
> > is worth.
> >
> > I have 2 QMainWindows currently which work fine. (QT4.3.0) I know I
> > can put them into a QSplitter and use it that way, however, how hard
> > would it be to  make it so that the QSplitter can be used as a
> > splitter OR as 2 seperate QMainWindows if the user chooses to switch
> > between either mode on the fly?
> > Or is this a lot of work...or not even possible?
> >
> > A coworker suggested putting both of the QMainwindows into seperate
> > dockwidgets, and then each dockwidget into the QSplitter, so the user
> > could undock it if he wanted to.  Im unsure that will even work.
> >
> > Comments?
> >
> > Thanks,
> > Jeff
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>
> > "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

Message 10 in thread

Yeah. I have tried smthg similar. I put the QMainWindow() (without a
parent) inside a QSpliitter and it works...
 
Cheers!
Prateek


________________________________

	From: Tom Panning [mailto:lurchvt@xxxxxxxxx] 
	Sent: Friday, June 15, 2007 5:58 PM
	To: qt-interest@xxxxxxxxxxxxx
	Subject: Re: QSplitter/QMainWindow and dockwidget
	
	
	For what its worth, I had a similar problem. If I remember
correctly, I had to add a layout to the parent widget (a QVBoxLayout is
fine) and construct the QMainWindow with a NULL parent pointer and then
use QBoxLayout::addWidget() to put the QMainWindow in the parent.
	
	Let me know if this works for you,
	Tom
	
	
	On 6/15/07, Prateek Tiwari <ptiwari@xxxxxxxxxxx> wrote: 

		I have a related question.
		I am tring to put a mainWindow inside another widget in
the following
		way but
		the main window is opening as a seperate window and not
insode the
		parent widget.
		
		What am I doing wrong here ? 
		
		MainQtWindow::MainQtWindow(QWidget *parent)
		{
		        m_bIsWindowCreated = false;
		
		        main = new QMainWindow(parent);
		
		        m_scene = new QGraphicsScene();
		        m_scene->setSceneRect(0,0,600,800); 
		        m_view = new GraphicsView(m_scene, main);
		
		        QDockWidget *dock = new QDockWidget(("Property
View"), main);
		      dock->setAllowedAreas(Qt::LeftDockWidgetArea |
		Qt::RightDockWidgetArea); 
	
dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
		
		        QListWidget *customerList = new
QListWidget(dock);
		      customerList->addItems(QStringList()
		            << "John Doe, Harmony Enterprises, 12
Lakeside, Ambleton"
		            << "Jane Doe, Memorabilia, 23 Watersedge,
Beaton"
		            << "Tammy Shea, Tiblanka, 38 Sea Views,
Carlton" 
		            << "Tim Sheen, Caraba Gifts, 48 Ocean Way,
Deal"
		            << "Sol Harvey, Chicos Coffee, 53 New
Springs, Eccleston"
		            << "Sally Hobart, Tiroli Tea, 67 Long River,
Fedula");
		      dock->setWidget(customerList);
		
		        main->setCentralWidget(m_view);
		        main->addDockWidget(Qt::RightDockWidgetArea,
dock); 
		
		        main->show();
		
		
		        m_bIsWindowCreated = true;
		}
		
		Thnx
		Prateek
		
		-----Original Message-----
		From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx ]
		Sent: Friday, June 15, 2007 9:35 AM
		To: Jeff Lacki; qt-interest@xxxxxxxxxxxxx
		Subject: RE: QSplitter/QMainWindow and dockwidget
		
		Its actually pretty easy.... 
		
		
		If its "all or nothing" then have three windows, 2 being
the
		qmainwindows 1 being the splitter.
		
		Have a toggle slot, that removes the widgets from the
splitter and sets
		the parents to NULL, and does a show/move , and hides
the splitter (or 
		deletes it depending on your exact needs)
		
		When its recombining them, recreate (or show) the
splitter, and read add
		the qmainwindows.
		
		The docking method could also work, but would change the
frames, and 
		would leave the splitter around.
		
		Scott
		
		> -----Original Message-----
		> From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
		> Sent: Thursday, June 14, 2007 9:00 PM
		> To: qt-interest@xxxxxxxxxxxxx
		> Subject: QSplitter/QMainWindow and dockwidget
		>
		>
		> Im wondering if this is feasable to do or would be
more work than it 
		> is worth.
		>
		> I have 2 QMainWindows currently which work fine.
(QT4.3.0) I know I
		> can put them into a QSplitter and use it that way,
however, how hard
		> would it be to  make it so that the QSplitter can be
used as a 
		> splitter OR as 2 seperate QMainWindows if the user
chooses to switch
		> between either mode on the fly?
		> Or is this a lot of work...or not even possible?
		>
		> A coworker suggested putting both of the QMainwindows
into seperate 
		> dockwidgets, and then each dockwidget into the
QSplitter, so the user
		> could undock it if he wanted to.  Im unsure that will
even work.
		>
		> Comments?
		>
		> Thanks,
		> Jeff
		> 
		> --
		> To unsubscribe - send a mail to
qt-interest-request@xxxxxxxxxxxxx with
		
		> "unsubscribe" in the subject or the body.
		> List archive and information:
http://lists.trolltech.com/qt-interest/
		
		--
		To unsubscribe - send a mail to
qt-interest-request@xxxxxxxxxxxxx with
		"unsubscribe" in the subject or the body.
		List archive and information:
http://lists.trolltech.com/qt-interest/
		
		--
		To unsubscribe - send a mail to
qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or
the body.
		List archive and information:
http://lists.trolltech.com/qt-interest/
		
		



Message 11 in thread

Prateek Tiwari wrote:
> I have a related question.
> I am tring to put a mainWindow inside another widget in the following
> way but 
> the main window is opening as a seperate window and not insode the
> parent widget.

Why are you trying to use the mainWindow? It seems to be designed to be
a top level widget. It has a menubar, toolbar, and a status bar
basically built in. You don't seem to want them in this app, so why not
just use a layout. You seem to be trying to force a mainWindow to
function as a layout anyway.

Aside from the oddness of starting a qt app from a mfc app, exactly what
is the parent widget?

--
 [ signature omitted ] 

Message 12 in thread

Thanks Scott, Im glad to know it can be done relatively
easily, however I need some clarification on the following:

On Thu, 2007-06-14 at 21:05 -0700, Scott Aron Bloom wrote:

> Have a toggle slot, that removes the widgets from the splitter and sets
> the parents to NULL, and does a show/move , and hides the splitter (or
> deletes it depending on your exact needs)

- I see no 'removeWidget' etc in the QSplitter class
- Im assuming you mean sets both QMainWindow parents to NULL
- showing or hiding I understand, whats the move() for?

Thanks again Scott.
Jeff

--
 [ signature omitted ] 

Message 13 in thread

> Thanks Scott, Im glad to know it can be done relatively
> easily, however I need some clarification on the following:
> 
> On Thu, 2007-06-14 at 21:05 -0700, Scott Aron Bloom wrote:
> 
> > Have a toggle slot, that removes the widgets from the splitter and
sets
> > the parents to NULL, and does a show/move , and hides the splitter
(or
> > deletes it depending on your exact needs)
> 
> - I see no 'removeWidget' etc in the QSplitter class
> - Im assuming you mean sets both QMainWindow parents to NULL
> - showing or hiding I understand, whats the move() for?
> 
> Thanks again Scott.
> Jeff
1) Its probably not remove widget... just reparent the widget
(setParent)
2) Yes
3) Incase you needed to set the initial placement of the QMainWindows...
Since you may not want to have them in the OS defaults location for a
new top level window

Scott

--
 [ signature omitted ] 

Message 14 in thread

Scott-

Thanks again.  I tried this.  I triggered a button in my window to 
switch modes,
set both QMainWindow parents to 0 and they both disappear.  Their icons 
arent
in the bottom bar and I even tried move()ing them but dont see them.  I 
assume
setting them to 0 is the same as before I used the splitter since their 
parent defaults
to 0, which should be the top level.

This is my flow:

main:
  QSplitter *split = new QSPlitter();
  Qmain1 win1(args);
  Qmain2 win2(args);

QMain1:
   - set Action/buttons and connect to togWin()
   togWin():
        m_win1->setParent(0);
        m_win2->setParent(0);
        m_split->hide();
        
QMain2:

Sorry if Im not understanding something, I appreciate your patience.
Jeff

>1) Its probably not remove widget... just reparent the widget
>(setParent)
>2) Yes
>3) Incase you needed to set the initial placement of the QMainWindows...
>Since you may not want to have them in the OS defaults location for a
>new top level window
>
>
>  
>


--
 [ signature omitted ] 

Message 15 in thread

Ok... Ive attached a VERY simple app that does what Im talking about...

Let me know if you have any questions.
Scott

> -----Original Message-----
> From: Jeff Lacki [mailto:jeep@xxxxxxxxx]
> Sent: Sunday, June 17, 2007 10:42 AM
> To: Scott Aron Bloom
> Cc: qt-interest@xxxxxxxxxxxxx
> Subject: Re: QSplitter/QMainWindow and dockwidget
> 
> Scott-
> 
> Thanks again.  I tried this.  I triggered a button in my window to
> switch modes,
> set both QMainWindow parents to 0 and they both disappear.  Their
icons
> arent
> in the bottom bar and I even tried move()ing them but dont see them.
I
> assume
> setting them to 0 is the same as before I used the splitter since
their
> parent defaults
> to 0, which should be the top level.
> 
> This is my flow:
> 
> main:
>   QSplitter *split = new QSPlitter();
>   Qmain1 win1(args);
>   Qmain2 win2(args);
> 
> QMain1:
>    - set Action/buttons and connect to togWin()
>    togWin():
>         m_win1->setParent(0);
>         m_win2->setParent(0);
>         m_split->hide();
> 
> QMain2:
> 
> Sorry if Im not understanding something, I appreciate your patience.
> Jeff
> 
> >1) Its probably not remove widget... just reparent the widget
> >(setParent)
> >2) Yes
> >3) Incase you needed to set the initial placement of the
QMainWindows...
> >Since you may not want to have them in the OS defaults location for a
> >new top level window
> >
> >
> >
> >
> 
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

Attachment:

Attachment: topsplitter.zip
Description: topsplitter.zip