From a5bc7085e4d62fcb5895d5c7da20c4fbea8f1b50 Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 27 Dec 2017 05:45:28 +0100 Subject: Add clear button for comment in metadata Also use SLOT activated instead of currentChanged for the reasons QCombobox so the text is inserted even if the selection didn't change. --- archiveview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'archiveview.cpp') diff --git a/archiveview.cpp b/archiveview.cpp index cf4013a..2773512 100644 --- a/archiveview.cpp +++ b/archiveview.cpp @@ -795,24 +795,27 @@ MetadataEditorWidget::MetadataEditorWidget(QWidget *parent) : QWidget(parent){ srcGB->setLayout(srcGBL); QGroupBox *reasonGB = new QGroupBox(tr("Reencode reason")); - QHBoxLayout *reasonGBL = new QHBoxLayout; + QVBoxLayout *reasonGBL = new QVBoxLayout; mReencReason = new QComboBox; QStringList reasons = SmGlobals::instance()->reencReasons(); mReencReason->addItems(reasons); - connect(mReencReason, SIGNAL(currentIndexChanged(QString)), this, SLOT(addToComment(QString))); + connect(mReencReason, QOverload::of(&QComboBox::activated), this, &MetadataEditorWidget::addToComment); + QPushButton *clearB = new QPushButton(tr("Clear")); reasonGBL->addWidget(mReencReason); + reasonGBL->addWidget(clearB); reasonGB->setLayout(reasonGBL); QHBoxLayout *srcReasonL = new QHBoxLayout; srcReasonL->addWidget(srcGB); - srcReasonL->addWidget(reasonGB); //comment QGroupBox *commentGB = new QGroupBox(tr("Comment")); mComment = new QTextEdit; QHBoxLayout *commentGBL = new QHBoxLayout; commentGBL->addWidget(mComment); + commentGBL->addWidget(reasonGB); commentGB->setLayout(commentGBL); + connect(clearB, &QPushButton::clicked, [this] { mComment->clear(); }); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(captionL); -- cgit v1.2.3-70-g09d2