Created attachment 102170 [details] short input field for face tag Face tag input box is very short for full names (see attachment) Probably the best solution to make it change size or make it multi line.
Hi, I spent about 1 day time compiling the code and installing it(failed to compile on Ubuntu 15 because of exiv2 version problem, then succeeded on Ubuntu 16). After compiled the code, I started to read it and trying to fix the bug. This is the qt working flow about face tag input box: Face tag input box is object of class AssignNameWidget, when user clicked "show face tags" Action, object of AssignNameWidget will be created by class FaceGroup. AssignNameWidget inherits QFrame, the input box is QLineEdit inside the QFrame. QLineEdit can't be made multi line, so I changed the size of QFrame. The attachment "before" shows the input box before I change the width of QFrame. QFrame inherits QWidget, so it can use the method setFixedWidth to change its width. I add the code: q->setFixedWidth(500); in utilities\facemanagement\assignnamewidget.cpp void updateLayout() The input box has been enlarged in width as shown in attachment "after". There may be other solutions, I'd like to talk with you. Thanks!
Created attachment 104253 [details] before
Created attachment 104254 [details] after
Hi Lui, The source code place to investigate is good. Hard-coding the size of widget in source code is not the right solution. You don't take a care about font/widget style used in application. Look in this class : https://cgit.kde.org/digikam.git/tree/libs/imageproperties/imagepropertiestxtlabel.h#n90 setLinesNumber() adjust the size of text browser used in Cation/Tags tab from right sidebar. Here the height of text view is adjusted. You can code something similar to adjust the width of face tag widget about an amount of characters. Gilles Caulier The
Hi, I changed the program based on your tip. The input box will increase by the user input, see attachment “inc1”, “inc2”, “inc3”, “inc4”. The method is as follows: An object of AssignNameWidget will be constructed after the user add the region of face, and it contains an object of AddTagsComboBox. In AddTagsComboBox, there is an AddTagsLineEdit instance “lineEdit”. When the text in lineEdit is changed, it will emit textChanged(const QString& str), I add a slot to handle it: connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); the slot slotTextChanged(QString) will emit another signal to AddTagsComboBox: void AddTagsLineEdit::slotTextChanged(const QString& txt) { emit textEditChanged(txt); } The AddTagsComboBox class will catch the signal and handle it by sending another signal to AssignNameWidget to tell it the text in lineEdit has changed: connect(d->lineEdit, SIGNAL(textEditChanged(QString)), this, SLOT(slotLineEditTextChanged(QString))); void AddTagsComboBox::slotLineEditTextChanged(const QString& txt) { emit textEditChanged(txt); } In the function void AssignNameWidget::Private::setupAddTagsWidget(T* const widget) of class AssignNameWidget it will handle the signal, I add a line of connect in this function: q->connect(widget, SIGNAL(textEditChanged(QString)), q, SLOT(slotSetLineNumber(QString))); the slot void slotSetLineNumber(const QString & str) will increase the size of input box based on the size of str: void AssignNameWidget::slotSetLineNumber(const QString & str) { int new_width = fontMetrics().width(str); int line_width, del_width = 35; if(d->comboBox) { line_width = d->comboBox->getlineWidth(); } else if(d->lineEdit) { line_width = d->lineEdit->width(); } else { return ; } if(line_width>new_width+del_width) { return ; } else { d->q->setFixedWidth(d->q->width()+new_width-(line_width-del_width)); } }
Created attachment 104293 [details] inc1
Created attachment 104294 [details] inc2
Created attachment 104295 [details] inc3
Created attachment 104296 [details] inc4
Please Make a patch against git/master and attach it to this bug entry. I will review and test. Gilles Caulier
Hi, I tested the code I add, then I find that the width of input box should change only in the FaceItem class. While in the AssignNameOverlay class, it has to be unchanged. So I the connect of signal textEditChanged and slot slotSetLineNumber can only be added in FaceItem class. So I add a function void addTagsChangeSignal() for adding the connect, and it will be invoked in FaceItem class. I commited the code and made a pull request to github, but I did not figure out how to add the patch in this bug entry, should I post some files or use different way to call a pull request?
Oh, I know. I should use "git format-patch" to generate the patch file after I commit, sorry for less experience. I will take care of it next time.
Note : there is nothing to do with github. It's a read only repository. The real git repository is in KDE server! "git diff > mydiff.patch" Must do the stuff... as it's explained here : https://www.digikam.org/contrib Gilles Caulier
Hi Gilles, I cloned the repository from KDE server, added my code, compiled it and committed it. However, I can't push it to the server using git. So I do as the tutorial said: https://techbase.kde.org/Development/Tutorials/Git/GitQuickStart#Tell_ssh_to_use_this_key But I can't find a place in my kde account to edit the public ssh keys, so I still can't push the code. Then I read this tutorial: https://community.kde.org/Infrastructure/Get_a_Developer_Account#How_to_get_read-write_access_to_git.2Fsvn As it said, I applied for the KDE developer access (uploaded the ssh keys in applying page) and I set your name as Supporter. Is it necessary to have the KDE developer access to push the code to server? If so, please help my account to have the access. If not, can you tell me another way of how to set to push the code. Thanks! Yingjie Liu
No. You cannot push. You have no right to do it. A developer account is for student selected for GSoC event. Not now... Please make a patch of your difference from your local repository : git diff > mydiff.patch ...and attach this patch to this entry. That all. It's simple no ??? Gilles Caulier
Created attachment 104335 [details] local code patch for the bug
Comment on attachment 104335 [details] local code patch for the bug Why this complex code : + connect(this, SIGNAL(textChanged(QString)), + this, SLOT(slotTextChanged(QString))); + connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::activated), [this](const TaggingAction& action){ completerActivated(action); }); @@ -192,6 +195,11 @@ void AddTagsLineEdit::slotTextEdited(const QString& text) d->completer->update(text); } +void AddTagsLineEdit::slotTextChanged(const QString& txt) +{ + emit textEditChanged(txt); +} This code is enough : + connect(this, SIGNAL(textChanged(QString)), + this, SIGNAL(textEditChanged(QString))); and please comment the patch step by step... Gilles Caulier
Created attachment 104396 [details] code modified and comment added Hi, I modified the code based on your suggestion: connection signal with signal, not through a slot. I will remember this feature. I commented the code for readability. If there are problems or somewhere confusing, I will explain it or change the code.
Created attachment 104937 [details] Cannot understand the options I'm looking forward to this fix. Else, I cannot understand the difference between options when creating a new person tag, for example, as they are displayed the same in the interface.
*** Bug 392527 has been marked as a duplicate of this bug. ***
Git commit 6862c1e3491830e2a42493cb4674abb620b2d19d by Maik Qualmann. Committed on 30/03/2018 at 16:26. Pushed by mqualmann into branch 'master'. set a minimum width to the AddTagsComboBox FIXED-IN: 6.0.0 M +2 -2 NEWS M +1 -0 core/utilities/facemanagement/assignnamewidget.cpp https://commits.kde.org/digikam/6862c1e3491830e2a42493cb4674abb620b2d19d
I think setting a minimum width is the best solution. The width was dependent on the translated text of the buttons. Depending on the language, the input window was larger or smaller. If the dialog grows automatically, as suggested in the patch, this does not work well with the popup hack. Maik