Results 1 to 3 of 3

Thread: User Editing QTextEdit

  1. #1
    Join Date
    Apr 2014
    Posts
    59
    Thanks
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default User Editing QTextEdit

    I am trying to implement something similar to when you click the ellipse, in Creator, for text on a QLabel. In other words, I want the user to be able select between two tabs, one for rich text, with buttons for; bold text, underlined, etc, and another tab for HTML. I started to make a widget in Designer, but was stopped short by not finding a way to name the tabs. Between http://doc.qt.io/qt-4.8/http://doc.qt.io/qt-5/qtwidgets-richtext-textedit-example.html and http://doc.qt.io/qt-4.8/http://doc.qt.io/qt-4.8/qt-dialogs-tabdialog-example.html, I should be able to figure out the workings, but am wondering if it is possible, without hand coding everything. My reluctance to hand coding is mainly in visualizing the layouts, and being able to adjust them, when they do not work.

    In addition, I am not sure how to connect the two tabs, like Creator does, although that might come from inherited classes that are not described in QTextEdit.

    I also assume that I need to save the file in HTML format, and propagate it from there, when reopening it.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: User Editing QTextEdit

    Assuming you are using QTabWidget in designer, you change the tab text using "currentTabText" property, select the tab in designer and change the property value in properties editor
    tab-text.jpg
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Apr 2014
    Posts
    59
    Thanks
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: User Editing QTextEdit

    I was about to say I do not have that option, but figured it out when I was looking, to verify. What I was doing was selecting the tab itself (QWidget) in the object explorer. That gave me the yellow properties, but none of the green ones. All I could do was change the object name, that way.

    While I still might try this, just for an experiment, I decided that it is overkill for my project. I think a simple rich text editor will be more than enough, since the user will not likely be very familiar with HTML. That just leaves me with trying to figure out how to insert an image with a button, drag and drop looks pretty straight forward, and inserting a table, as those ate not covered in the text edit example. I will worry about those when I get the rest of it working though.

    Thanks again for your help.

Similar Threads

  1. Replies: 1
    Last Post: 28th October 2010, 04:15
  2. enable user editing of QTreeView headers?
    By iraytrace in forum Newbie
    Replies: 0
    Last Post: 9th October 2009, 22:25
  3. Replies: 2
    Last Post: 27th November 2008, 10:16
  4. attaching user data pointer to images in QTextEdit
    By Workeml in forum Qt Programming
    Replies: 0
    Last Post: 7th November 2008, 20:06
  5. entering text through user interaction in QTextEdit
    By sar_van81 in forum Qt Programming
    Replies: 6
    Last Post: 1st December 2006, 22:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.