PDA

View Full Version : opening selected data details in a new window



namitha
22nd September 2016, 06:36
Hi,

I have a TableWidget where basic information about data is displayed. More details about this is given in a TreeWidget below. Now I want to open that information in a new window when the user double clicks on particular row in the table . Can you please suggest me to how to open Treewidget corresponding to particular row in a new window when the user double clicks on it.

Thanks in advance,
Namitha.

anda_skoa
22nd September 2016, 07:23
QTableWidget has a cellDoubleClicked() signal that contains the row index.

Since you already know how to handle the single click you shouldn't have a problem handle the double click in the same way

Cheers,
_

namitha
22nd September 2016, 10:00
Hi,
Thanks for the reply. But i know that i have to use celldoubleclicked() my doubt is how to open treewidget in a new window. Like whether should we use treewidget->show or something?
Regards,
Namitha

anda_skoa
23rd September 2016, 14:15
Yes, either the tree widget itself without a parent (parent == 0) or by putting the tree widget into a QDialog based sub window.

Cheers,
_

namitha
28th September 2016, 06:51
Hi,
Thanks for your reply. My treewidget is part of mainwindow.ui so is it possible to include it also as a subwindow based on QDialog. And can you explain me how to make treewidget without parent?
Thanks in advance
Namitha

anda_skoa
28th September 2016, 10:01
If it is part of mainwindow.ui it is part of the main window, not a separate window.

Create a separate for if you want to have a separate window.

Cheers,
_

namitha
29th September 2016, 05:57
Hi,
Thanks for the reply.
Actually my requirement is i want to see treewidget as part of mainwindow when i run the project. If the user double clicks on table only it should open as new window.
Regards
Namitha

anda_skoa
29th September 2016, 09:53
Not sure what you wanted to say with that, you already have the first part working, no?

Cheers,
_

namitha
29th September 2016, 11:13
Hi,
Actually my window is having a treewidget and tablewidget. For the data given in the table tree will give more information. now when the user double clicks on table tree should open as a new widget . this is my requirement.
Thanks in advance.
Regards
Namitha

anda_skoa
29th September 2016, 17:05
OK, then you are all settled, right?

The question regarding the secondary window has been answered, the view in the main window works, right?

Cheers,
_