[Digikam-devel] extragear/graphics/digikam/libs/imageproperties

Andi Clemens andi.clemens at gmx.net
Wed Jul 8 16:46:46 BST 2009


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 <andi.clemens at gmx.net>:
> > 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: digikam-devel at kde.org
> >>
> >>
> >>
> >>  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
> >> Digikam-devel at kde.org
> >> https://mail.kde.org/mailman/listinfo/digikam-devel
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > Digikam-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/digikam-devel
>
> _______________________________________________
> Digikam-devel mailing list
> Digikam-devel at kde.org
> https://mail.kde.org/mailman/listinfo/digikam-devel




More information about the Digikam-devel mailing list