Refactor the code for setting cursor color

This commit is contained in:
Jekyll Wu
2012-05-11 18:05:13 +08:00
parent 4af03a1eca
commit 02ae47c5fb
3 changed files with 18 additions and 20 deletions

View File

@@ -826,10 +826,14 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
view->setKeyboardCursorShape(Enum::UnderlineCursor);
// cursor color
bool useCustomColor = profile->useCustomCursorColor();
const QColor& cursorColor = profile->customCursorColor();
view->setKeyboardCursorColor(!useCustomColor, cursorColor);
if ( profile->useCustomCursorColor() ) {
const QColor& cursorColor = profile->customCursorColor();
view->setKeyboardCursorColor(cursorColor);
} else {
// an invalid QColor is used to inform the view widget to
// draw the cursor using the default color( matching the text)
view->setKeyboardCursorColor(QColor());
}
// word characters
view->setWordCharacters(profile->wordCharacters());