summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2017-11-30 09:25:20 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2017-12-01 04:35:27 +0000
commit959b7c8f0cfda602b1a29a90137d5acb56337473 (patch)
tree473c84184f3bbdb2b63f9c1b95169a5ad7164c49
parent4afc8a56fd7e650123560f46b8e3a39f3b0be8f0 (diff)
Don't allow empty file for sub-presentation
If sub-presentation type is presentation, a file must be selected. Disable "Ok" button if not. Task-number: QT3DS-400 Change-Id: I925861f20ebf3d18495822e45eded70e8e5e952f Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/_Win/Application/SubPresentationDlg.cpp9
-rw-r--r--src/Authoring/Studio/style.qss5
2 files changed, 14 insertions, 0 deletions
diff --git a/src/Authoring/Studio/_Win/Application/SubPresentationDlg.cpp b/src/Authoring/Studio/_Win/Application/SubPresentationDlg.cpp
index 842342f1..f8410ab4 100644
--- a/src/Authoring/Studio/_Win/Application/SubPresentationDlg.cpp
+++ b/src/Authoring/Studio/_Win/Application/SubPresentationDlg.cpp
@@ -32,6 +32,7 @@
#include <QtWidgets/qabstractbutton.h>
#include <QtWidgets/qfiledialog.h>
#include <QtCore/qdir.h>
+#include <QtWidgets/qabstractbutton.h>
CSubPresentationDlg::CSubPresentationDlg(const QString &directory,
const SubPresentationRecord &subpresentation,
@@ -94,6 +95,10 @@ void CSubPresentationDlg::onTypeChanged(int index)
: QStringLiteral("presentation-qml");
updateUI();
+ // Disable "Ok" if type is presentation and no file has been selected
+ m_ui->buttonBox->buttons()[0]->setEnabled(
+ !(m_subPresentation.m_type == QStringLiteral("presentation")
+ && m_ui->comboBoxFileList->currentText() == tr("Browse...")));
}
void CSubPresentationDlg::onFileChanged(int index)
@@ -102,6 +107,10 @@ void CSubPresentationDlg::onFileChanged(int index)
m_subPresentation.m_argsOrSrc = m_ui->comboBoxFileList->currentText();
else
browseFile();
+ // Disable "Ok" if type is presentation and no file has been selected
+ m_ui->buttonBox->buttons()[0]->setEnabled(
+ !(m_subPresentation.m_type == QStringLiteral("presentation")
+ && m_ui->comboBoxFileList->currentText() == tr("Browse...")));
}
void CSubPresentationDlg::onIdChanged(const QString &id)
diff --git a/src/Authoring/Studio/style.qss b/src/Authoring/Studio/style.qss
index 28f52c41..2f4dc31e 100644
--- a/src/Authoring/Studio/style.qss
+++ b/src/Authoring/Studio/style.qss
@@ -298,3 +298,8 @@ QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton {
QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton:pressed {
background-color: #262829;
}
+
+QDialog#SubPresentationDlg QPushButton:!enabled {
+ background: transparent;
+ color: #727476;
+}