michael
8th June 2006, 15:47
This isn't really that important as I ran into this problem in a program I was writing simply because I was bored. Ok, I admit, I have no life.
Anyway I was wondering if anyone else has ran into the same problem.
I have a QTabWidget with which I add tabs via a button on the toolbar like in Firefox. Also like firefox I added a close button to close the open tabs to the QTabWidget using a QToolButton and passing it to QTabWidget::setCornerWidget().
In Windows this works fine and the button shows up at the top right of the QTabWidget as expected. However in Linux it spits the following message out to the console and reparents the QToolButton causing the button to show up at the top right of the tab pages themselves instead of the top right of the entire QTabWidget. Imagine the button being where it should be then moving it straight down a distance of the height of the button and another half.
The information given in the console window is:
QLayout::addChildWidget: QToolButton in wrong parent; moved to correct parent
That above is what happens when I set the QTabWidget as the QToolButton's parent. If I try setting the QTabWidget::QTabBar as the parent it will issue the same error to the console except the button does not show up at all.
As I said this isn't an urgent matter or anything as I stumbled across this while writing something out of boredom. However, I am curious as to why it is working under Windows and not linux. Anyone know, or can at least tell me what the parent of the QToolButton should be for it to work?
This is using Qt 4.0.0 with gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
Knowing me it is probably something really stupid that makes me look like a moron. But hey, thats life. ;)
-Michael
Anyway I was wondering if anyone else has ran into the same problem.
I have a QTabWidget with which I add tabs via a button on the toolbar like in Firefox. Also like firefox I added a close button to close the open tabs to the QTabWidget using a QToolButton and passing it to QTabWidget::setCornerWidget().
In Windows this works fine and the button shows up at the top right of the QTabWidget as expected. However in Linux it spits the following message out to the console and reparents the QToolButton causing the button to show up at the top right of the tab pages themselves instead of the top right of the entire QTabWidget. Imagine the button being where it should be then moving it straight down a distance of the height of the button and another half.
The information given in the console window is:
QLayout::addChildWidget: QToolButton in wrong parent; moved to correct parent
That above is what happens when I set the QTabWidget as the QToolButton's parent. If I try setting the QTabWidget::QTabBar as the parent it will issue the same error to the console except the button does not show up at all.
As I said this isn't an urgent matter or anything as I stumbled across this while writing something out of boredom. However, I am curious as to why it is working under Windows and not linux. Anyone know, or can at least tell me what the parent of the QToolButton should be for it to work?
This is using Qt 4.0.0 with gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
Knowing me it is probably something really stupid that makes me look like a moron. But hey, thats life. ;)
-Michael