Want to change selected text's font put I can't
-
C'mon, man! There is google for these things! http://en.wikipedia.org/wiki/Workaround
-
try this (not actively tried though):
@
QTextCursor cursor = textEdit->textCursor();
QFont boldFont(textEdit->font());
boldFont.setBold(true);
QTextCharFormat format;
format.setFont(boldFont);
cursor.setBlockCharFormat(format);
@ -
[quote author="raven-worx" date="1367475346"]try this (not actively tried though):
@
QTextCursor cursor = textEdit->textCursor();
QFont boldFont(textEdit->font());
boldFont.setBold(true);
QTextCharFormat format;
format.setFont(boldFont);
cursor.setBlockCharFormat(format);
@[/quote]It's not enough though :) Final code is going to be:
@
QTextCursor cursor = textEdit->textCursor();
QFont boldFont(textEdit->font());
boldFont.setBold(true);
QTextCharFormat format;
format.setFont(boldFont);
cursor.setBlockCharFormat(format);
textEdit->setCursor(cursor); // maybe &cursor :)
@ -
Getting this error
D:\qt\CS_337_Final_Project\mainwindow.cpp:116: error: C2664: 'QWidget::setCursor' : cannot convert parameter 1 from 'QTextCursor *' to 'const QCursor &'
Reason: cannot convert from 'QTextCursor *' to 'const QCursor'
No constructor could take the source type, or constructor overload resolution was ambiguous -
[quote author="amir734jj" date="1367547168"]Getting this error
D:\qt\CS_337_Final_Project\mainwindow.cpp:116: error: C2664: 'QWidget::setCursor' : cannot convert parameter 1 from 'QTextCursor *' to 'const QCursor &'
Reason: cannot convert from 'QTextCursor *' to 'const QCursor'
No constructor could take the source type, or constructor overload resolution was ambiguous[/quote]Sorry, use this one instead: http://qt-project.org/doc/qt-4.8/qtextedit.html#setTextCursor
And why can't people not copy-paste but think, think a bit?
-
[quote author="amir734jj" date="1367547747"]Man ...
it wasn't a joke.I am just a sophomore in CS (18.5 years old !!! ) who knows only java and c/c++ !!!
[/quote]Okay, guy. I know C++, don't know Java. I am 14 years old. I know how to use reference documentation.