qtextedit

How do I use QTextBlock?

Hi all, I'm completely new to c++ and Qt. I want to populate a QTextEdit object with QTextBlocks, how do I do that? e.g. If I have the sentence "the fish are coming" how would I put each word into its own QTextBlock and add that block to QTextEdit, or have I misunderstood how QTextBlock actually works? ...

QtRuby: loading HTML file into QTextEdit

How do I load a custom HTML-file into QTextEdit while in runtime? ...

Qt Python: QTextEdit - display input

Hi Everybody, I have a QTextEdit... it works with 'clear()' when a pushbutton calls 'CleanComments' to clean the input done by the user. Here is the code: def CleanComments(self): self.textEditInput.clear() def showInput(self): print "show input: %s" % self.textEditInput.show() def buildEditInput(self): self.textEditInput...

Connecting multiple signals to a single slot in Qt

I'm trying to keep track of the textChanged() signal on for handful of QTextEdits. I want to do the same thing regardless of the text edit emitting the signal: uncheck its associated checkbox in a QListWidget if it becomes empty and leave it checked otherwise. The function I have so for is as follows: void MainWindow::changed() { QS...

Determining object types in Qt

I have a series of QTextEdits and QLineEdits connected to a slot through a QSignalMapper(which emits a textChanged(QWidget*) signal). When the connected slot is called (pasted below), I need to be able to differentiate between the two so I know whether to call the text() or toPlainText() function. What's the easiest way to determine the ...

Streaming to QTextEdit via QTextStream

I have often wanted to use QTextEdit as a quick means of displaying what is being written to a stream. That is, rather than writing to QTextStream out(stdout), I want to do something like: QTextEdit qte; QTextStream out(qte); I could do something similar if I emit a signal after writing to a QTextStream attached to a QString....

Customize page number when printing a QTextDocument

Hi, I'm trying to print the content of a QTextEdit. For that I'm using QTextDocument::print(QPrinter*). Doing that, a page number is automatically added at the right bottom of the page. Is there any way to change its format / move it / get rid of it? Thanks. ...

QTextEdit with different text colors (Qt / C++)

I have a QTextEdit box that displays text, and I'd like to be able to set the text color for different lines of text in the same QTextEditBox. (i.e. line 1 might be red, line 2 might be black, etc.) Is this possible in a QTextEdit box? If not, what's the easiest way to get this behavior? Thanks ...

Qt + QTextEdit content into QDomDocument

hi, i'm having QTextEdit widget with large content in it (content is XML). i want to take the content and set it into a QDomDocument, so i take the content using document = textEdit->document(); but i dont know how to take it from here into a QDomDocument... what's the best way to do it ? ...

QTextEdit content into QDomDocument

hi, i'm having QTextEdit widget with large content in it (content is XML). i want to take the content and set it into a QDomDocument, so i take the content using document = textEdit->document(); but i dont know how to take it from here into a QDomDocument... what's the best way to do it ? ...

What event (if any) does QTextEdit fire when the size of its content changes?

As the title says, how can I receive notification whenever a multi-line QTextEdit changes the size of its content? (Note: *content size* is different from the control size, i.e. I want to know when lines were added or removed, or changed height because of a font change). ...

Is there a way to set a fixed width for the characters in HTML?

Is there a way to set a fix size for the characters in HTML? That means, say … First row, 8th character is “Z” Second row’s 8th character is “A” I want to print out , when printed the “Z” has to be exactly on top of “A” *Note: I'm using the insertHtml method in QTextEdit() ...

Why is my slot not being called?

I have this class: class CustomEdit : public QTextEdit { Q_GADGET public: CustomEdit(QWidget* parent); public slots: void onTextChanged (); }; CustomEdit::CustomEdit(QWidget* parent) : QTextEdit(parent) { connect( this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); } void CustomEdit::onTextChanged (...

How do I determine the height of a QTextDocument?

Given a specific width, I want to find out the height of a QTextDocument. In other words, if the QTextEdit that contains the QTextDocument is w wide, what is its minimum height h in order to fully display the document without the need for scrollbars? ...

Resizing QT's QTextEdit to Match Text Height: maximumViewportSize()

I am trying to use a QTextEdit widget inside of a form containing several QT widgets. The form itself sits inside a QScrollArea that is the central widget for a window. My intent is that any necessary scrolling will take place in the main QScrollArea (rather than inside any widgets), and any widgets inside will automatically resize the...

Qt - How to place a QTextEdit with left and right margins in a QVBoxLayout?

How to place a QTextEdit with left and right margins in a QVBoxLayout? I could use, of course, a QHBoxLayout, place the QTextEdit into that horizontal layout in between to spacings (addSpacing(40)) and only then the horizontal layout could add into the vertical layout, but want to know if there is a direct way of doing that. ...

Qt: QTextEdit::setTextFormat(Qt::LogText) does not exist anymore, what else can I use to log?

Hi, I need a text logger in my C++ application, QTextEdit used to have this feature until Qt 3.3 but unfortunately it has been removed. Is there an alternative that I could use? Tanks for your help! ...

Qt, QTextEdit: how do I delete the last character?

Hi, I am using a QTextEdit in my C++ GUI application, I use textEdit->append(byteArray); to add some text, unfortunately append() adds a new line character at the end that I would like to remove after each call of append(). I know I could use insertPlainText() which does not add a new line character but it uses a lot more memory when de...

Can't build full html table in QTextEdit with std::for_each...

Hi. Here is my code function: void ReportHistory::update(void) { ui.output->clear(); ui.output->setCurrentFont(QFont("Arial", 8, QFont::Normal)); QString title = "My Title"; QStringList headers = QString("Header1,Header2,Header3,Header4,Header5,Header6").split(","); QString html = QString( "<html>" \ "<head>" \ "<meta Cont...

Several ways of placing an image in a QTextEdit.

I think this is a very simple question, but when I copy an image I can't paste it in a QTextEdit? Paste is inactive! Also I would like to know how to drag-and-drop a picture. BTW I use the following code in order to insert a picture into a QTextEdit: QTextEdit *textEditor = new QTextEdit(0); QTextDocumentFragment fragment; fragment = Q...