Allow the FileMetaDataConfigWidget to emit a loadedMetadata signal when its metadata has been loaded, and adjust its size based on its content
AbandonedPublic

Authored by meven on Feb 23 2019, 9:10 AM.

Details

Reviewers
ngraham
Group Reviewers
Dolphin
Baloo

Diff Detail

Repository
R824 Baloo Widgets
Branch
show-dialog
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 9235
Build 9253: arc lint + arc unit
meven created this revision.Feb 23 2019, 9:10 AM
Restricted Application added a project: Baloo. · View Herald TranscriptFeb 23 2019, 9:10 AM
Restricted Application added a subscriber: Baloo. · View Herald Transcript
meven requested review of this revision.Feb 23 2019, 9:10 AM
ngraham requested changes to this revision.Feb 23 2019, 2:20 PM
ngraham added reviewers: Dolphin, Baloo.
ngraham added a subscriber: ngraham.
ngraham added inline comments.
src/filemetadataconfigwidget.cpp
190

Better to read the actual text metrics rather than assuming a height. Something like this:

const QFontmetrics metrics(d->m_metaDataList->font())
const int lineHeight = metrics.height()
This revision now requires changes to proceed.Feb 23 2019, 2:20 PM
meven updated this revision to Diff 52379.Feb 23 2019, 2:43 PM

Use QFontMetrics to retrieve the lineheight to use.

elvisangelaccio added inline comments.
src/filemetadataconfigwidget.h
65

I'd call it loadingFinished() to match the FileMetaDataProvider::loadingFinished signal.

bruns added a subscriber: bruns.Feb 23 2019, 7:01 PM
bruns added inline comments.
src/filemetadataconfigwidget.cpp
191

This feels like papering over a different issue - the QListWidget should provide an appropriate sizeHint, as it knows its items, and each list item should provide a correct size hint.

src/filemetadataconfigwidget.h
65

The question is - who is going to receive this signal?

src/filemetadataconfigwidget.h
65

See D19241, but I'm not convinced it's the right way to fix it. You are right that it might just be a sizeHint bug.

bruns added inline comments.Feb 23 2019, 7:04 PM
src/filemetadataconfigwidget.cpp
144
bruns added inline comments.Feb 24 2019, 2:38 AM
src/filemetadataconfigwidget.cpp
144

Also, QListWidget / QAbstractScrollArea::setSizeAdjustPolicy()
https://doc.qt.io/qt-5/qabstractscrollarea.html#public-functions

meven updated this revision to Diff 53195.Mar 5 2019, 11:28 AM
  • No need to call loadMetaData on Polish events when the dialog can only be shown when the metadata are loaded, this caused a issue
meven updated this revision to Diff 53215.Mar 5 2019, 4:55 PM

. - Use m_metaDataList->sizeHintForRow for reference for a row height

meven updated this revision to Diff 53216.Mar 5 2019, 4:56 PM
  • Use m_metaDataList->sizeHintForRow for reference for a row height
bruns added a comment.Mar 5 2019, 11:21 PM

Can you please try updateGeometry() instead of adding a proprietary signal?

The custom sizeHint() code indeed seems to be necessary, as although the scroll area view-container calculates the content size (otherwise the scrollbars would not work) it does not propagate it to its own sizeHint().

meven added a comment.Mar 6 2019, 8:26 AM

Can you please try updateGeometry() instead of adding a proprietary signal?

Of course, no need to implore me, I learn as I go thanks to the review process.
I missed the first mention of updateGeometry.
Thanks for pointing it out again :)

The custom sizeHint() code indeed seems to be necessary, as although the scroll area view-container calculates the content size (otherwise the scrollbars would not work) it does not propagate it to its own sizeHint().

According to my testing the original sizeHint() returns a constant regardless of its content.

src/filemetadataconfigwidget.cpp
190

Thanks, I am not too familiar with the Kde/Qt API, this was a question in the related change https://phabricator.kde.org/D19241

But the suggested line height is too low.

meven updated this revision to Diff 53256.Mar 6 2019, 9:10 AM
  • Propagate updateGeometry signal, remove an unused variable
meven marked 4 inline comments as done.Mar 6 2019, 9:47 AM
meven added inline comments.
src/filemetadataconfigwidget.cpp
144

I am not sure this is necessary here, at least in my tests I did not have any changes.

meven marked an inline comment as done.Mar 6 2019, 9:48 AM
meven updated this revision to Diff 53260.Mar 6 2019, 9:50 AM
  • Propagate updateGeometry signal, remove an unused variable
bruns added inline comments.Mar 6 2019, 12:28 PM
src/filemetadataconfigwidget.cpp
144

updateGeometry() is not a signal. See the documentation link.

meven added a comment.EditedMar 6 2019, 1:59 PM

Would using adjustSize on the QDialog be ok after the metadata has been loaded ?
D19241

bruns added a comment.Mar 6 2019, 2:03 PM

Would using adjustSize on the QDialog be ok after the metadata has been loaded ?
D19241

Just call q->updateGeometry(). Please read the linked documentation.

meven updated this revision to Diff 53274.Mar 6 2019, 2:17 PM
  • Properly call updateGeometry
meven marked 2 inline comments as done.Mar 6 2019, 2:18 PM
meven updated this revision to Diff 53280.Mar 6 2019, 2:28 PM
  • Rename signal loadingFinished
meven marked 2 inline comments as done.Mar 6 2019, 2:30 PM
bruns added inline comments.Mar 6 2019, 8:15 PM
src/filemetadataconfigwidget.cpp
146

You don't need this signal when using updateGeometry().

meven marked an inline comment as done.Mar 7 2019, 7:57 AM
meven added inline comments.
src/filemetadataconfigwidget.cpp
146

I need this to let the QDialog in D19241 know it needs to adjust its size.

Otherwise updateGeometry is called after the dialog is shown and the dialog is not resized accordingly.

meven marked 2 inline comments as done.Mar 7 2019, 7:57 AM
meven updated this revision to Diff 53344.Mar 7 2019, 10:01 AM
  • Convert connect to new syntax
meven marked an inline comment as done.Mar 16 2019, 8:20 AM
meven added inline comments.
src/filemetadataconfigwidget.cpp
191
meven marked 2 inline comments as done.Mar 16 2019, 2:51 PM
meven abandoned this revision.Apr 23 2019, 7:38 AM

Obsolete as of D20524