]> git.sesse.net Git - mlt/commitdiff
Fix TextColor+Outline+Typewriter=wrong color in titler (kdenlive-1829).
authorj-b-m <jb@kdenlive.org>
Tue, 5 Oct 2010 03:44:40 +0000 (20:44 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 5 Oct 2010 03:44:40 +0000 (20:44 -0700)
src/modules/qimage/kdenlivetitle_wrapper.cpp

index 06b278660e123c82d982e916728f4f2f8545184a..f6ec3818e33a772679cd1bca998c4a4bf1fe4b28 100755 (executable)
@@ -440,11 +440,15 @@ void drawKdenliveTitle( producer_ktitle self, mlt_frame frame, int width, int he
                                    // the keystroke delay and a start offset, both in frames
                                    QStringList values = params.at( 2 ).split( ";" );
                                    int interval = qMax( 0, ( ( int ) position - values.at( 1 ).toInt()) / values.at( 0 ).toInt() );
-                                   QTextDocument *td = new QTextDocument( params.at( 1 ).left( interval ) );
-                                   td->setDefaultFont( titem->font() );
-                                   td->setDefaultTextOption( titem->document()->defaultTextOption() );
-                                   td->setTextWidth( titem->document()->textWidth() );
-                                   titem->setDocument( td );
+                                   QTextCursor cursor = titem->textCursor();
+                                   cursor.movePosition(QTextCursor::EndOfBlock);
+                                   // get the font format
+                                   QTextCharFormat format = cursor.charFormat();
+                                   cursor.select(QTextCursor::Document);
+                                   QString txt = params.at( 1 ).left( interval );
+                                   // If the string to insert is empty, insert a space so that we don't loose
+                                   // formatting infos for the next iterations
+                                   cursor.insertText(txt.isEmpty() ? " " : txt, format);
                            }
                    }
                }