[SOLVED][Qt 4.8] New Window shows as a widget and doesn't have window buttons
-
Hi everyone, I'm trying to show a new window from another when the user presses a button. I've done that already by having a login window and then a main window after it. Everything works fine but for the last window I want to create. This is how it looks like:
!http://imgur.com/wtK1eZ5(http://imgur.com/wtK1eZ5.png)!
I'll explain a little more about the application work flow...
I have a main class called AppController, which manages all the work flow, starting with the login window, so the order of calls would be this...
[AppController] -> [SessionWindow]
if (OK)
[AppController] -> [MainWindow]if (User_calls_log_window) [MainWindow] -> [LogReporter]
Does the hierarchy have something to do with the way the different windows display? Is there something else to take into consideration?
Note:
Everytime I open a new window, I create a new instance of its class and then call
@class.show()@ -
From your explanation hierarchy is not issue. Also it is your logic to create. Looks like some logic is failing and it is creating some blank widget or layout is not applied to your last window.
Just trying create simple application and create only last window. See if all the buttons appear in it. If not it should be simple to fix for you. Also try to see if you can print lastWindow.dumpobjecttree()... See if you can see all the widgets you defined inside.
-
Hi Dheerendra, thanks for your answer.
Well I modified the app's work flow to make it call the [LogReporter] (the one that's having troubles) after the login window. It shows perfectly. Every button and form is there.
Right now I can't print the objecttree since I'm using another machine with compiling issues. But I'll try that tomorrow. Anyway, since the windows is showing properly calling it somewhere else, I think it must not be a problem with the object tree, isn't it?
-
My suspect is that object what you are getting when you really want to show may not have the required tree. Some other plain widget would have been passed and causing the issue. This is the reason I requested to print the object tree and see the components of that particular object.
-
This is the code I use to create, print the object tree and show the window that's acting weird:
@
LogRep= new LogReporter (this);LogRep->UpdateUser(UserID); LogRep->dumpObjectTree(); LogRep->show();
@
The object tree I'm getting is:
@
LogReporter::LogReporter
QVBoxLayout::verticalLayout
QTableWidget::EventsList
QWidget::qt_scrollarea_viewport
QWidget::qt_scrollarea_vcontainer
QScrollBar::
QBoxLayout::
QStyledItemDelegate::
QHeaderView::
QWidget::qt_scrollarea_viewport
QWidget::qt_scrollarea_hcontainer
QScrollBar::
QBoxLayout::
QWidget::qt_scrollarea_vcontainer
QScrollBar::
QBoxLayout::
QItemSelectionModel::
QHeaderView::
QWidget::qt_scrollarea_viewport
QWidget::qt_scrollarea_hcontainer
QScrollBar::
QBoxLayout::
QWidget::qt_scrollarea_vcontainer
QScrollBar::
QBoxLayout::
QItemSelectionModel::
QTableCornerButton::
QTableModel::
QItemSelectionModel::
QWidget::qt_scrollarea_hcontainer
QScrollBar::
QBoxLayout::
QFrame::OptionsFrame
QHBoxLayout::horizontalLayout
QFrame::UsersFrame
QHBoxLayout::horizontalLayout_2
QLabel::label
QComboBox::comboBox
QStandardItemModel::
QFrame::DeleteFrame
QHBoxLayout::horizontalLayout_3
QPushButton::pushButton
DBConnector::
@I printed the object tree when calling that window somewhere else (where it shows good) and is the same...
-
UPDATE: I just removed the parent on the LogRep's constructor like this:
@
LogRep= new LogReporter ();
@And it shows fine! Everything works as expected. I'm still unsure about why and I also want to use this thread to discuss something else but related. By changing the code, I got this:
!http://imgur.com/01ObT76(http://imgur.com/01ObT76)!
As you can see, there are 2 windows now. I would like to know, if possible, how can I control the number of separate windows on the task bar? I've been thinking about Qt Creator, as an example, where you can open multiple windows but you only get one on the taskbar.
-
Ok got it. You are trying to show the child window where you have set some visual widget as parent. That is expected behaviour. Looks like parent window of the LogReporter is not shown and you are trying to show only child.
For other question, I suggest you to open new request. This helps to solve the specific problem.
-
I understand, but the parent window was behind of LogReporter window all the time.
Meanwhile, I'm marking this as Solved, thank you Dheerendra. I hope I can be certified one day o/