Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qtextedit
    Log in to post

    • UNSOLVED How to save a text file directly without using QfileDialog box?
      General and Desktop • c++ qt 5.4 qtextedit qfiledialog • • Mr-Workalot  

      4
      0
      Votes
      4
      Posts
      40
      Views

      @Mr-Workalot But what location do you need? Where do you want to store the file? It is really not clear from your description. Did you check the link I provided: https://doc.qt.io/qt-5/qstandardpaths.html ? Example: to store in Documents folder call https://doc.qt.io/qt-5/qstandardpaths.html#writableLocation with QStandardPaths::DocumentsLocation as parameter
    • UNSOLVED Unresponsive GUI while append text to QTextedit
      General and Desktop • c++ qt qtextedit unresponsive • • Chaba  

      12
      0
      Votes
      12
      Posts
      150
      Views

      @SGaist My data is ready to append. So i append them directly. There are 10-100 QTextEdits. I append 100-200 line to each of QTextEdits. Lines have arround 300 characters. I have one vector of vectors source. By the way, i moved my data source to a different thread. Then emitted signals to append with BlockingQueuedConnection. Gui is responsive now. But its not smooth. I dont know using blockingqueuedconnection instead of queuedconnection is the right way but my gui is responsive while appending strings now.
    • UNSOLVED Get what is pressed inside QTextEdit
      General and Desktop • qtextedit cursor table • • publicusernameyo  

      1
      0
      Votes
      1
      Posts
      28
      Views

      No one has replied

    • UNSOLVED insert text with css style into QTextEdit
      General and Desktop • qtextedit grid table • • adamsmith  

      8
      0
      Votes
      8
      Posts
      1193
      Views

      @jonb Yes, that is the document to which I was referring. Thank you for posting the link!
    • SOLVED Get the last two characters written in a QTextEdit
      General and Desktop • qtextedit selection highlight • • legitnameyo  

      8
      0
      Votes
      8
      Posts
      650
      Views

      @legitnameyo QString str = textEdit->toPlainText(); QString targetChars = str.mid(textEdit->textCursor().columnNumber() -2 ,2); qDebug() <<targetChars;
    • UNSOLVED Zoom in and out of a QTextEdit with touch pad gestures?
      General and Desktop • qtextedit zoom gestures gesture • • legitnameyo  

      13
      0
      Votes
      13
      Posts
      705
      Views

      The following partially works and I post in the hopes that someone might get an idea that will fix my issue :) bool ZoomCode::event(QEvent *event) { if (event->type() == QEvent::NativeGesture) { return gestureEvent(static_cast<QNativeGestureEvent*>(event)); } return QWidget::event(event); } bool ZoomCode::gestureEvent(QNativeGestureEvent *e) { float value = e->value(); textEdit->setFontPointSize(NULL); // zoom does not work without this textEdit->selectAll(); // some part of the text has to be selected before the zoom in the text starts to work. It does NOT matter if it is the WHOLE text or just a character in the text, just as long as something gets highlighted. Afterwards, nothing has to be highlighted again for the zoom to work. The zoom works on the whole text, no matter what part has been highlighted. if(value >0) { zoomIn(value + 5); // + 5 to add some zoom strength } else if(value < 0) zoomOut(value - 5); // -5 to add some zoom strength } }
    • SOLVED QTextEdit start text one tab in?
      General and Desktop • qtextedit • • legitnameyo  

      16
      0
      Votes
      16
      Posts
      930
      Views

      Yes, and works perfectly
    • SOLVED Override default copy/paste from QTextEdit
      General and Desktop • qtextedit qevent copy shortcut shortcutoverrid • • zespy  

      4
      0
      Votes
      4
      Posts
      1340
      Views

      Unfortunately, it doesn't seems to work... actions() returns me an empty list. I think I'll go for QTextEdit::createMimeDataFromSelection() because otherwise I won't be able to deal with drag & drop (I didn't think about it :/ ) Thanks anyway!
    • UNSOLVED QObject::connect: Cannot queue arguments of type 'QTextCursor'
      General and Desktop • qtextedit connect multithreading qtextcursor process • • bachir  

      16
      0
      Votes
      16
      Posts
      8956
      Views

      @kshegunov Right... Thanks, something didnt trigger in the brain. Now its fine: connect(uap, &CUaProxy::uaItemChanged, this, [this, i]( const CUaProxy::MsgType msgt, const int riskIndex, const QVariant& value) { this->onUaMsgReceived(msgt, i, riskIndex, value); }, Qt::QueuedConnection); Also needed Qt::QueuedConnection eventually.
    • UNSOLVED How to ingore specific image copy in QTextBrowser?
      General and Desktop • qtextedit qtextbrowser • • dscyw  

      4
      0
      Votes
      4
      Posts
      532
      Views

      @KillerSmath @raven-worx Thanks. I will try it and post the result later. I think it's a non-trivial task.
    • UNSOLVED Probleme mit QTextEdit und QMargin
      German • qtextedit margin pagesize • • HenrikSt.  

      7
      0
      Votes
      7
      Posts
      1706
      Views

      QTextEdit::toHtml() gibt schon gültiges HTML zurück - nicht nötig da noch einmal was zu konvertieren (was eh nicht mehr vorhanden ist). ß wird übrigens falsch konvertiert...
    • SOLVED Qt Designer, QTextEdit, remove indentation
      General and Desktop • qtextedit indentation • • Tink  

      7
      0
      Votes
      7
      Posts
      1719
      Views

      @mpergand said in Qt Designer, QTextEdit, remove indentation: try: textEdit->document()->setDocumentMargin(0); Yes! This works! Thank you!
    • SOLVED Problm with QTextEdit and accents
      General and Desktop • qt5.6 qtextedit encoding • • Alain38 0  

      2
      0
      Votes
      2
      Posts
      695
      Views

      @Alain38 OK: It seems in fact that wat just a problem with the console. By sending the text to the URL (using QUrlQuery for encoding) I have the text with the accents.
    • UNSOLVED Saving margins of QTextEdit
      General and Desktop • qtextedit save margins pagesize • • HenrikSt.  

      10
      0
      Votes
      10
      Posts
      1732
      Views

      If you put your buttons in a QButtonGroup you could simply store the button id so you can programmatically check it when loading your document.
    • SOLVED Resize image with mouse QTextEdit
      General and Desktop • image resize qtextedit mouse • • HenrikSt.  

      10
      0
      Votes
      10
      Posts
      3321
      Views

      @mrjj I don't want to resize it via a dialog. I need to do that with the mouse (manually)
    • SOLVED QTextEdit with html and image export
      General and Desktop • qtextedit html export image export relative path • • koahnig  

      4
      0
      Votes
      4
      Posts
      979
      Views

      I have found a solution suiting me. QRegularExpression rexp ( "<img src=\\\"([^\\\"]{1,})([^/]{0,})/>" ); QRegularExpressionMatch match; int pos = content.indexOf ( rexp, pos + 1 ) ; if ( pos > -1 ) { match = rexp.match ( content, pos ); if ( match.isValid() ) { QString imFile = match.captured ( 1 ); } } imFile will hold the file name stored. Or as alternative for the deprecated QRegExp. The expression itself works for both. QRegExp rexp ( "<img src=\\\"([^\\\"]{1,})([^/]{0,})/>" ); int pos = content.indexOf ( rexp ); if ( pos >= 0) { QString imFile = rexp.cap ( 1 ); } Note: The indexOf with QRegularExpression may also handle the QRegularExpressionMatch since version 5.5. This would make it more compact.
    • UNSOLVED Dynamic font size in QTextEdit
      General and Desktop • qtextedit • • amitm02  

      1
      0
      Votes
      1
      Posts
      442
      Views

      No one has replied

    • UNSOLVED Troubleshoot with QTextEdit
      General and Desktop • qtextedit qt designer align troubleshoot • • Matzomatzomatzo  

      7
      0
      Votes
      7
      Posts
      1700
      Views

      @Matzomatzomatzo said: Hi if setAlignment sets the alignment for a paragraph of text (see doc) When you do ui->QtexteditObj->setText I think it replaces the paragraph with a new one since u replace all text and the default alignment is left for that new paragraph Just guessing. Did not test it :)
    • UNSOLVED QPixmap: How to render?
      General and Desktop • qpixmap qtextedit rendering • • HenrikSt.  

      6
      0
      Votes
      6
      Posts
      3668
      Views

      The QPixmap class has a constructor that takes a QSize parameter and therefore allows you to create a pixmap of a given size. That is what @jsulm is doing in the first line of his last code example. Documentation.
    • SOLVED Insert Qt Charts in QTextEdit
      General and Desktop • qtextedit qchart input • • HenrikSt.  

      6
      0
      Votes
      6
      Posts
      1439
      Views

      Hi, It might be not possible to insert a QChart object directly but a possible alternative might be to generate your chart, render it on a QImage and then put that QImage your QTextDocument. Hope it helps
    • UNSOLVED Input in QTextEdit cause vertical scroll bar jumping
      General and Desktop • qtextedit input • • hcfalan  

      6
      0
      Votes
      6
      Posts
      1816
      Views

      Looks like it might be a limitation/bug. The behavior is the same with 5.6 You should go to the bug report system to see if it's something known. If not please consider opening a new report providing a minimal compilable example (not just the code files) to reproduce the behavior.
    • SOLVED Which gives better performance for rich text editor
      General and Desktop • qtextedit qplaintextedit qtextdocument editortext • • remizero  

      3
      0
      Votes
      3
      Posts
      780
      Views

      I have elucidated the dilemma regarding the doubt raised. First and foremost, I was confusing two concepts, TextEdit and TextDocument for the first contains the second, although they can be used interchangeably on any widget. On the other hand, I prefer QTextEdit, it has more features and is more versatile than QPlainTextEdit for creating a text editor and so investigated have equal performance in terms of resources used. I leave this reflection or as a solution in case someone is presented with any questions regarding this topic.
    • UNSOLVED How to ensure that an HTML-table in QTextEdit is copied as a table when pasting into for instance Excel?
      General and Desktop • qt5.6 qtextedit html copy • • Jakob  

      5
      0
      Votes
      5
      Posts
      1382
      Views

      @raven-worx Thanx for the suggestion. I think we can go a long way with this, except that we are on Windows and it seems we need some Windows-specific MIME-conversions. We'll try to tinker a bit with that.
    • SOLVED Problem with saving function (overwrite file which saved by dialog)
      General and Desktop • qtextedit file function save • • HenrikSt.  

      25
      0
      Votes
      25
      Posts
      6800
      Views

      The cause for that crash can be everything! How should anybody know what it is without your code? Did you try to debug your program to see where it crashes?
    • SOLVED void MainWindow::mouseMoveEvent ( QMouseEvent * e )
      General and Desktop • qtableview qtextedit mouseevent • • cdcc0606  

      5
      0
      Votes
      5
      Posts
      2352
      Views

      Then you should rather use an event filter so you'll only test when there's something currently going on with your button.
    • SOLVED Change mouse cursor when hover on image in QTextEdit
      General and Desktop • qtextedit mouseevent cursor • • HenrikSt.  

      3
      0
      Votes
      3
      Posts
      1681
      Views

      Ok, thanks. This solved my problem
    • UNSOLVED QWidget::setAttribute does not work with attribute Qt::WA_InputMethodEnabled as expected on Windows
      General and Desktop • qwidget qtextedit qevent qinputmethodeve • • AnkurSharma  

      4
      0
      Votes
      4
      Posts
      2924
      Views

      @AnkurSharma But, I also expect that when I am resetting the attribute of WA_InputMethodEvent my widget should no more get the input method events anymore, and thats how it works on Qt on OSX. I don't know how it works on OSX, I can say for sure though that QObject::eventFilter is executed before the QObject::event method (this is documented) and since you're not giving Qt leeway to process the event as it ordinarily would in the overriden QWidget::event method (you stop the event propagation when you return true from the event filter) you shouldn't expect it to respect the widget attribute. That's what I'm claiming. You should move your code from the eventFilter method to a QWidget::inputMethodEvent override.
    • UNSOLVED How to keep updating QTextEdit from log file
      General and Desktop • qtextedit filesystem log • • firefox  

      5
      0
      Votes
      5
      Posts
      1898
      Views

      Using QFile::handle
    • UNSOLVED bringing up a InputWindow on OSX for text input while typing text with asian laguage
      Brainstorm • qtextedit text inputmethod qinputmethodeve inputmethodhint • • AnkurSharma  

      1
      0
      Votes
      1
      Posts
      511
      Views

      No one has replied

    • UNSOLVED QTextTable rows and columns dynamic resizing (qt 4.8)
      General and Desktop • qtextedit qtextdocument cell qtexttable • • Toniy  

      1
      0
      Votes
      1
      Posts
      799
      Views

      No one has replied

    • SOLVED How to insert a div into a QTextEdit?
      General and Desktop • qtextedit html • • Ctwx  

      4
      0
      Votes
      4
      Posts
      4326
      Views

      I don't really like that As I said - QTextEdit is not an HTML browser. It handles rich text and stores it as styled text blocks. It accepts subset of HTML as input but it does not store it as such. So it doesn't put the content in <p>. It simply has no notion of <p>, <div> etc. at all. That's the source of the remark in the docs, that the stylesheet is only applied on entry. After that there are no <div> to style. The output you get back is a result of another conversion, where every paragraph is simply output as <p>. It does not reflect what you input. Take a look at the link I posted previously. QTextEdit supports only subset of HTML/CSS. It does not support class attribute or a "border" CSS property. How about you try to operate directly on text blocks, and not go through HTML? Here's an example for a chat-like formatting: QTextBlockFormat tbf1; tbf1.setAlignment(Qt::AlignLeft); tbf1.setBackground(Qt::red); QTextBlockFormat tbf2; tbf2.setAlignment(Qt::AlignRight); tbf2.setBackground(Qt::green); ui->textEdit->textCursor().beginEditBlock(); ui->textEdit->textCursor().setBlockFormat(tbf1); ui->textEdit->textCursor().insertText("Wassup?\n"); ui->textEdit->textCursor().endEditBlock(); ui->textEdit->textCursor().beginEditBlock(); ui->textEdit->textCursor().setBlockFormat(tbf2); ui->textEdit->textCursor().insertText("Nothin' much\n"); ui->textEdit->textCursor().insertText("Just playin' a game. How 'bout you?\n"); ui->textEdit->textCursor().endEditBlock(); ui->textEdit->textCursor().beginEditBlock(); ui->textEdit->textCursor().setBlockFormat(tbf1); ui->textEdit->textCursor().insertText("Nothin' much\n"); ui->textEdit->textCursor().endEditBlock();
    • SOLVED Standard Output Double Spaced in QTextEdit
      General and Desktop • qprocess qt4 qtextedit • • DougyDrumz  

      9
      0
      Votes
      9
      Posts
      2076
      Views

      Good ! Since you have it working now please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)
    • UNSOLVED QTextEdit doesn't display its corner with border-radius
      General and Desktop • qtextedit border-radius • • Toufi  

      3
      0
      Votes
      3
      Posts
      3259
      Views

      @Chris-Kawa It works ! Thanks for all ^^
    • Can't enter apple symbol () in QLineEdit and QTextEdit on OSX
      General and Desktop • qlineedit qtextedit osx apple symbol • • peniwize  

      2
      0
      Votes
      2
      Posts
      975
      Views

      Dear @peniwize, I am not aware of direct entry of special symbols in QLineEdit in MAC but in WINDOWS OS we can do with the help of ALT key and the symbol code. Basically go to Character Map and select the special symbol then you will be able to see the corresponding Key code to that special character. Just hold ALT symbol and enter the code from num pad by enabling NUM LOCK. Then release the ALT key. That special symbol will automatically appear in the QLineEdit in Windows. May be something similar you can try in MAC OS too. Good luck!!
    • SOLVED Add actions from QTextEdit to Edit Menu
      General and Desktop • qt5.5 qtextedit • • ChajusSaib  

      10
      0
      Votes
      10
      Posts
      2744
      Views

      @mcosta You legend, thank you!
    • Inline Completion for QCompleter shows one random word on completion even if the completion prefix matches with various words. How do I get all the matches?
      General and Desktop • qtextedit qcompleter inline completi • • Pranjal Jain  

      1
      0
      Votes
      1
      Posts
      415
      Views

      No one has replied

    • Embedding custom QWidgets inside a QTextEdit
      General and Desktop • qt4 qtextedit pyqt4 • • kfkf  

      8
      0
      Votes
      8
      Posts
      2349
      Views

      One alternative might be to implement a QAbstractTextDocumentLayout
    • QTEXTEDIT FIND BACKWARD
      General and Desktop • qtextedit • • Olivier Ronat  

      6
      0
      Votes
      6
      Posts
      2113
      Views

      Hi, Can you share the bug report link ? That will make it easier for others to find it
    • How do I scroll QTextEdit so line is in center
      General and Desktop • qtextedit qabstractscroll • • voidtrance  

      1
      0
      Votes
      1
      Posts
      556
      Views

      No one has replied

    • Manipulating selection with QTextCursor and QTextEdit [SOLVED]
      General and Desktop • qtextedit qtextcursor • • frankiefrank  

      7
      0
      Votes
      7
      Posts
      3725
      Views

      Applied to my code, marked as [SOLVED]. Thank you once again!