diff --git a/src/widgets/editorview.cpp b/src/widgets/editorview.cpp --- a/src/widgets/editorview.cpp +++ b/src/widgets/editorview.cpp @@ -104,6 +104,7 @@ return; if (m_model) { + ui->attachmentList->setModel(Q_NULLPTR); disconnect(m_model, Q_NULLPTR, this, Q_NULLPTR); disconnect(this, Q_NULLPTR, m_model, Q_NULLPTR); } @@ -118,6 +119,9 @@ return; } + auto attachments = m_model->property("attachmentModel").value(); + ui->attachmentList->setModel(attachments); + onArtifactChanged(); onTextOrTitleChanged(); onHasTaskPropertiesChanged(); diff --git a/src/widgets/editorview.ui b/src/widgets/editorview.ui --- a/src/widgets/editorview.ui +++ b/src/widgets/editorview.ui @@ -7,13 +7,13 @@ 0 0 343 - 344 + 390 Editor - + 6 @@ -42,7 +42,29 @@ 0 - + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + QListView::LeftToRight + + + true + + + + St&art Date @@ -55,7 +77,7 @@ - + @@ -69,7 +91,7 @@ - + D&ue Date @@ -82,10 +104,10 @@ - + - + De&legate to @@ -95,7 +117,7 @@ - + @@ -113,7 +135,7 @@ - + 3 diff --git a/tests/units/widgets/editorviewtest.cpp b/tests/units/widgets/editorviewtest.cpp --- a/tests/units/widgets/editorviewtest.cpp +++ b/tests/units/widgets/editorviewtest.cpp @@ -25,7 +25,9 @@ #include #include +#include #include +#include #include @@ -44,6 +46,7 @@ EditorModelStub() { setProperty("editingInProgress", false); + setProperty("attachmentModel", QVariant::fromValue(&attachmentModel)); } void setPropertyAndSignal(const QByteArray &name, const QVariant &value) @@ -103,6 +106,7 @@ public: QStringList delegateNames; QStringList delegateEmails; + QStandardItemModel attachmentModel; }; class EditorViewTest : public QObject @@ -138,6 +142,10 @@ QVERIFY(doneButton); QVERIFY(!doneButton->isVisibleTo(&editor)); + auto attachmentList = editor.findChild(QStringLiteral("attachmentList")); + QVERIFY(attachmentList); + QVERIFY(!attachmentList->isVisibleTo(&editor)); + auto delegateLabel = editor.findChild(QStringLiteral("delegateLabel")); QVERIFY(delegateLabel); QVERIFY(!delegateLabel->isVisibleTo(&editor)); @@ -169,6 +177,10 @@ auto doneButton = editor.findChild(QStringLiteral("doneButton")); QVERIFY(doneButton); + auto attachmentList = editor.findChild(QStringLiteral("attachmentList")); + QVERIFY(attachmentList); + QCOMPARE(attachmentList->model(), &model.attachmentModel); + auto delegateLabel = editor.findChild(QStringLiteral("delegateLabel")); QVERIFY(delegateLabel); @@ -184,6 +196,8 @@ QVERIFY(!startDateEdit->isVisibleTo(&editor)); QVERIFY(!dueDateEdit->isVisibleTo(&editor)); QVERIFY(!doneButton->isVisibleTo(&editor)); + QVERIFY(!attachmentList->isVisibleTo(&editor)); + QVERIFY(attachmentList->model() == nullptr); QVERIFY(!delegateLabel->isVisibleTo(&editor)); QVERIFY(!delegateEdit->isVisibleTo(&editor)); } @@ -204,6 +218,9 @@ auto doneButton = editor.findChild(QStringLiteral("doneButton")); QVERIFY(!doneButton->isVisibleTo(&editor)); + auto attachmentList = editor.findChild(QStringLiteral("attachmentList")); + QVERIFY(attachmentList); + auto delegateLabel = editor.findChild(QStringLiteral("delegateLabel")); QVERIFY(!delegateLabel->isVisibleTo(&editor)); @@ -217,6 +234,7 @@ QVERIFY(startDateEdit->isVisibleTo(&editor)); QVERIFY(dueDateEdit->isVisibleTo(&editor)); QVERIFY(doneButton->isVisibleTo(&editor)); + QVERIFY(attachmentList->isVisibleTo(&editor)); QVERIFY(!delegateLabel->isVisibleTo(&editor)); QVERIFY(delegateEdit->isVisibleTo(&editor)); }