|
SVN commit 993339 by cgilles:
In event filter, return parent class event filter result, not always false. Move code from destructor to closeEvent() to prevent dumy expander box state settings saved to config file... but it doesn't work yet... Marcel, Andi, why closeEvent() is never called here ? CCMAIL: [hidden email] M +17 -11 imagedescedittab.cpp M +1 -0 imagedescedittab.h --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #993338:993339 @@ -406,19 +406,24 @@ KConfigGroup group = config->group(QString("Tag List View")); d->toggleAutoTags = (TagFilterView::ToggleAutoTags)(group.readEntry("Toggle Auto Tags", (int)TagFilterView::NoToggleAuto)); - group = config->group("Image Properties SideBar"); - d->tabWidget->setCurrentIndex(group.readEntry("ImageDescEditTab Tab", + KConfigGroup group2 = config->group("Image Properties SideBar"); + d->tabWidget->setCurrentIndex(group2.readEntry("ImageDescEditTab Tab", (int)ImageDescEditTabPriv::DESCRIPTIONS)); - d->templateViewer->readSettings(group); + d->templateViewer->readSettings(group2); } ImageDescEditTab::~ImageDescEditTab() { + delete d; +} + +void ImageDescEditTab::closeEvent(QCloseEvent* e) +{ // FIXME: this slot seems to be called several times, which can also be seen when changing the metadata of // an image and then switching to another one, because you'll get the dialog created by slotChangingItems() // twice, and this seems to be exactly the problem when called here. // We should disable the slot here at the moment, otherwise digikam crashes. -// slotChangingItems(); + //slotChangingItems(); /* AlbumList tList = AlbumManager::instance().allTAlbums(); @@ -432,12 +437,14 @@ KConfigGroup group = config->group(QString("Tag List View")); group.writeEntry("Toggle Auto Tags", (int)(d->toggleAutoTags)); group.sync(); - group = config->group("Image Properties SideBar"); - group.writeEntry("ImageDescEditTab Tab", d->tabWidget->currentIndex()); - d->templateViewer->writeSettings(group); - group.sync(); + KConfigGroup group2 = config->group("Image Properties SideBar"); + group2.writeEntry("ImageDescEditTab Tab", d->tabWidget->currentIndex()); + d->templateViewer->writeSettings(group2); + group2.sync(); - delete d; + kDebug() << "-------------> Close Event called !!!"; + + KVBox::closeEvent(e); } bool ImageDescEditTab::singleSelection() const @@ -765,9 +772,8 @@ return true; } } - return false; } - return false; + return KVBox::eventFilter(o, e); } void ImageDescEditTab::populateTags() --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #993338:993339 @@ -77,6 +77,7 @@ protected: bool eventFilter(QObject *o, QEvent *e); + void closeEvent(QCloseEvent*); private: _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
> In event filter, return parent class event filter result, not always false.
> Move code from destructor to closeEvent() to prevent dumy expander box > state settings saved to config file... but it doesn't work yet... > > Marcel, Andi, why closeEvent() is never called here ? > "This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system." "Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the X title bar button. They are also sent when you call QWidget::close() to close a widget programmatically." -> I think this applies to main windows only Marcel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
In reply to this post by Gilles Caulier-4
Hmm don't know. Sometimes it works, sometimes not. This is why I changed some
calls from the destructor in the past. We had such problems before. Maybe the close event must be forwarded from the main window? So that the widget is awre of this? I had to forward the windowMoved() signal in a similar way. Andi On Wednesday 08 July 2009 16:08:35 Gilles Caulier wrote: > SVN commit 993339 by cgilles: > > In event filter, return parent class event filter result, not always false. > Move code from destructor to closeEvent() to prevent dumy expander box > state settings saved to config file... but it doesn't work yet... > > Marcel, Andi, why closeEvent() is never called here ? > > CCMAIL: [hidden email] > > > > M +17 -11 imagedescedittab.cpp > M +1 -0 imagedescedittab.h > > > --- > trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp > #993338:993339 @@ -406,19 +406,24 @@ > KConfigGroup group = config->group(QString("Tag List View")); > d->toggleAutoTags = > (TagFilterView::ToggleAutoTags)(group.readEntry("Toggle Auto Tags", > (int)TagFilterView::NoToggleAuto)); - group = > config->group("Image Properties SideBar"); - > d->tabWidget->setCurrentIndex(group.readEntry("ImageDescEditTab Tab", + > KConfigGroup group2 = config->group("Image Properties SideBar"); + > d->tabWidget->setCurrentIndex(group2.readEntry("ImageDescEditTab Tab", > (int)ImageDescEditTabPriv::DESCRIPTIONS)); - > d->templateViewer->readSettings(group); > + d->templateViewer->readSettings(group2); > } > > ImageDescEditTab::~ImageDescEditTab() > { > + delete d; > +} > + > +void ImageDescEditTab::closeEvent(QCloseEvent* e) > +{ > // FIXME: this slot seems to be called several times, which can also > be seen when changing the metadata of // an image and then switching to > another one, because you'll get the dialog created by slotChangingItems() > // twice, and this seems to be exactly the problem when called here. // We > should disable the slot here at the moment, otherwise digikam crashes. -// > slotChangingItems(); > + //slotChangingItems(); > > /* > AlbumList tList = AlbumManager::instance().allTAlbums(); > @@ -432,12 +437,14 @@ > KConfigGroup group = config->group(QString("Tag List View")); > group.writeEntry("Toggle Auto Tags", (int)(d->toggleAutoTags)); > group.sync(); > - group = config->group("Image Properties SideBar"); > - group.writeEntry("ImageDescEditTab Tab", > d->tabWidget->currentIndex()); - > d->templateViewer->writeSettings(group); > - group.sync(); > + KConfigGroup group2 = config->group("Image Properties SideBar"); > + group2.writeEntry("ImageDescEditTab Tab", > d->tabWidget->currentIndex()); + > d->templateViewer->writeSettings(group2); > + group2.sync(); > > - delete d; > + kDebug() << "-------------> Close Event called !!!"; > + > + KVBox::closeEvent(e); > } > > bool ImageDescEditTab::singleSelection() const > @@ -765,9 +772,8 @@ > return true; > } > } > - return false; > } > - return false; > + return KVBox::eventFilter(o, e); > } > > void ImageDescEditTab::populateTags() > --- > trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h > #993338:993339 @@ -77,6 +77,7 @@ > protected: > > bool eventFilter(QObject *o, QEvent *e); > + void closeEvent(QCloseEvent*); > > private: > > _______________________________________________ > Digikam-devel mailing list > [hidden email] > https://mail.kde.org/mailman/listinfo/digikam-devel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
Marcel,
I'm agree with Andi. Sometimes it work, sometimes no. For ex, look like re-implementation of ImagePropertiesSideBar::closeEvent() work fine. Andi, I think it's relevant of parent widget passed in widget constructor. Gilles 2009/7/8 Andi Clemens <[hidden email]>: > Hmm don't know. Sometimes it works, sometimes not. This is why I changed some > calls from the destructor in the past. We had such problems before. Maybe the > close event must be forwarded from the main window? > So that the widget is awre of this? > > I had to forward the windowMoved() signal in a similar way. > > Andi > > On Wednesday 08 July 2009 16:08:35 Gilles Caulier wrote: >> SVN commit 993339 by cgilles: >> >> In event filter, return parent class event filter result, not always false. >> Move code from destructor to closeEvent() to prevent dumy expander box >> state settings saved to config file... but it doesn't work yet... >> >> Marcel, Andi, why closeEvent() is never called here ? >> >> CCMAIL: [hidden email] >> >> >> >> M +17 -11 imagedescedittab.cpp >> M +1 -0 imagedescedittab.h >> >> >> --- >> trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp >> #993338:993339 @@ -406,19 +406,24 @@ >> KConfigGroup group = config->group(QString("Tag List View")); >> d->toggleAutoTags = >> (TagFilterView::ToggleAutoTags)(group.readEntry("Toggle Auto Tags", >> (int)TagFilterView::NoToggleAuto)); - group = >> config->group("Image Properties SideBar"); - >> d->tabWidget->setCurrentIndex(group.readEntry("ImageDescEditTab Tab", + >> KConfigGroup group2 = config->group("Image Properties SideBar"); + >> d->tabWidget->setCurrentIndex(group2.readEntry("ImageDescEditTab Tab", >> (int)ImageDescEditTabPriv::DESCRIPTIONS)); - >> d->templateViewer->readSettings(group); >> + d->templateViewer->readSettings(group2); >> } >> >> ImageDescEditTab::~ImageDescEditTab() >> { >> + delete d; >> +} >> + >> +void ImageDescEditTab::closeEvent(QCloseEvent* e) >> +{ >> // FIXME: this slot seems to be called several times, which can also >> be seen when changing the metadata of // an image and then switching to >> another one, because you'll get the dialog created by slotChangingItems() >> // twice, and this seems to be exactly the problem when called here. // We >> should disable the slot here at the moment, otherwise digikam crashes. -// >> slotChangingItems(); >> + //slotChangingItems(); >> >> /* >> AlbumList tList = AlbumManager::instance().allTAlbums(); >> @@ -432,12 +437,14 @@ >> KConfigGroup group = config->group(QString("Tag List View")); >> group.writeEntry("Toggle Auto Tags", (int)(d->toggleAutoTags)); >> group.sync(); >> - group = config->group("Image Properties SideBar"); >> - group.writeEntry("ImageDescEditTab Tab", >> d->tabWidget->currentIndex()); - >> d->templateViewer->writeSettings(group); >> - group.sync(); >> + KConfigGroup group2 = config->group("Image Properties SideBar"); >> + group2.writeEntry("ImageDescEditTab Tab", >> d->tabWidget->currentIndex()); + >> d->templateViewer->writeSettings(group2); >> + group2.sync(); >> >> - delete d; >> + kDebug() << "-------------> Close Event called !!!"; >> + >> + KVBox::closeEvent(e); >> } >> >> bool ImageDescEditTab::singleSelection() const >> @@ -765,9 +772,8 @@ >> return true; >> } >> } >> - return false; >> } >> - return false; >> + return KVBox::eventFilter(o, e); >> } >> >> void ImageDescEditTab::populateTags() >> --- >> trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h >> #993338:993339 @@ -77,6 +77,7 @@ >> protected: >> >> bool eventFilter(QObject *o, QEvent *e); >> + void closeEvent(QCloseEvent*); >> >> private: >> >> _______________________________________________ >> Digikam-devel mailing list >> [hidden email] >> https://mail.kde.org/mailman/listinfo/digikam-devel > > _______________________________________________ > Digikam-devel mailing list > [hidden email] > https://mail.kde.org/mailman/listinfo/digikam-devel > Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
When you add a widget to a layout, it gets automatically reparented.
So it doesn't make any difference if you set QWidget *bla = new QWidget(0); layout->addWidget(bla); "bla" will have the layout's parent assigned. Maybe it is only working when the parent IS the mainwindow? Andi On Wednesday 08 July 2009 17:42:51 Gilles Caulier wrote: > Marcel, > > I'm agree with Andi. Sometimes it work, sometimes no. > > For ex, look like re-implementation of > ImagePropertiesSideBar::closeEvent() work fine. > > Andi, I think it's relevant of parent widget passed in widget constructor. > > Gilles > > 2009/7/8 Andi Clemens <[hidden email]>: > > Hmm don't know. Sometimes it works, sometimes not. This is why I changed > > some calls from the destructor in the past. We had such problems before. > > Maybe the close event must be forwarded from the main window? > > So that the widget is awre of this? > > > > I had to forward the windowMoved() signal in a similar way. > > > > Andi > > > > On Wednesday 08 July 2009 16:08:35 Gilles Caulier wrote: > >> SVN commit 993339 by cgilles: > >> > >> In event filter, return parent class event filter result, not always > >> false. Move code from destructor to closeEvent() to prevent dumy > >> expander box state settings saved to config file... but it doesn't work > >> yet... > >> > >> Marcel, Andi, why closeEvent() is never called here ? > >> > >> CCMAIL: [hidden email] > >> > >> > >> > >> M +17 -11 imagedescedittab.cpp > >> M +1 -0 imagedescedittab.h > >> > >> > >> --- > >> trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.c > >>pp #993338:993339 @@ -406,19 +406,24 @@ > >> KConfigGroup group = config->group(QString("Tag List > >> View")); d->toggleAutoTags = > >> (TagFilterView::ToggleAutoTags)(group.readEntry("Toggle Auto Tags", > >> (int)TagFilterView::NoToggleAuto)); - group = > >> config->group("Image Properties SideBar"); - > >> d->tabWidget->setCurrentIndex(group.readEntry("ImageDescEditTab Tab", + > >> KConfigGroup group2 = config->group("Image Properties SideBar"); + > >> d->tabWidget->setCurrentIndex(group2.readEntry("ImageDescEditTab Tab", > >> (int)ImageDescEditTabPriv::DESCRIPTIONS)); - > >> d->templateViewer->readSettings(group); > >> + d->templateViewer->readSettings(group2); > >> } > >> > >> ImageDescEditTab::~ImageDescEditTab() > >> { > >> + delete d; > >> +} > >> + > >> +void ImageDescEditTab::closeEvent(QCloseEvent* e) > >> +{ > >> // FIXME: this slot seems to be called several times, which can > >> also be seen when changing the metadata of // an image and then > >> switching to another one, because you'll get the dialog created by > >> slotChangingItems() // twice, and this seems to be exactly the problem > >> when called here. // We should disable the slot here at the moment, > >> otherwise digikam crashes. -// slotChangingItems(); > >> + //slotChangingItems(); > >> > >> /* > >> AlbumList tList = AlbumManager::instance().allTAlbums(); > >> @@ -432,12 +437,14 @@ > >> KConfigGroup group = config->group(QString("Tag List > >> View")); group.writeEntry("Toggle Auto Tags", (int)(d->toggleAutoTags)); > >> group.sync(); > >> - group = config->group("Image Properties > >> SideBar"); - group.writeEntry("ImageDescEditTab Tab", > >> d->tabWidget->currentIndex()); - > >> d->templateViewer->writeSettings(group); > >> - group.sync(); > >> + KConfigGroup group2 = config->group("Image Properties > >> SideBar"); + group2.writeEntry("ImageDescEditTab Tab", > >> d->tabWidget->currentIndex()); + > >> d->templateViewer->writeSettings(group2); > >> + group2.sync(); > >> > >> - delete d; > >> + kDebug() << "-------------> Close Event called !!!"; > >> + > >> + KVBox::closeEvent(e); > >> } > >> > >> bool ImageDescEditTab::singleSelection() const > >> @@ -765,9 +772,8 @@ > >> return true; > >> } > >> } > >> - return false; > >> } > >> - return false; > >> + return KVBox::eventFilter(o, e); > >> } > >> > >> void ImageDescEditTab::populateTags() > >> --- > >> trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h > >> #993338:993339 @@ -77,6 +77,7 @@ > >> protected: > >> > >> bool eventFilter(QObject *o, QEvent *e); > >> + void closeEvent(QCloseEvent*); > >> > >> private: > >> > >> _______________________________________________ > >> Digikam-devel mailing list > >> [hidden email] > >> https://mail.kde.org/mailman/listinfo/digikam-devel > > > > _______________________________________________ > > Digikam-devel mailing list > > [hidden email] > > https://mail.kde.org/mailman/listinfo/digikam-devel > > _______________________________________________ > Digikam-devel mailing list > [hidden email] > https://mail.kde.org/mailman/listinfo/digikam-devel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
| Free forum by Nabble | Edit this page |
