diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-07-27 13:12:59 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-28 11:39:30 +0300 |
commit | f8378927b503c51bfaca456e0f511d0e567fafee (patch) | |
tree | 987dbb299b4bb5b7369934cd7d149c928e64d886 /qt-ui/printoptions.cpp | |
parent | ed5afc510ed4d0756aadbadd57d8b58f37857ef1 (diff) | |
download | subsurface-f8378927b503c51bfaca456e0f511d0e567fafee.tar.gz |
Printing: choose first template if selected template is not found
If user selected template is not found, we choose the first template as
a default choice.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printoptions.cpp')
-rw-r--r-- | qt-ui/printoptions.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 916d9d696..b143e49d0 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -33,12 +33,13 @@ void PrintOptions::setup() // insert existing templates in the UI and select the current template qSort(grantlee_templates); - int current_index = 0; + int current_index = 0, index = 0; for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { if ((*i).compare(printOptions->p_template) == 0) { + current_index = index; break; } - current_index++; + index++; } ui.printTemplate->clear(); for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { |