Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to avoid text over flow in TextEdit
Forum Updated to NodeBB v4.3 + New Features

How to avoid text over flow in TextEdit

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 233 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajashekara V
    wrote on last edited by Rajashekara V
    #1

    I have text edit inside the filckable and text area has lot of data. Flickable is bounded by rectangle.
    when i flick i want the text to be with the bounded rectangle. Now it is over flowing rectangle.
    How to avoid text over flow in TextEdit, if we have long text in it?

    import QtQuick 2.14
    import QtQuick.Window 2.14
    
    Window {
        id : t1
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        
        property string data1 :"
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-1.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-2.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-3.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-4.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-5.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-6.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-7.
    19:49:18: Running steps for project TextEditScroll...
    19:49:18: Configuration unchanged, skipping qmake step.
    19:49:18: Starting: /usr/bin/make -j4
    19:49:19: Elapsed time: 00:00-8."
        Rectangle{
            width: 500
            height: 400
            border.color: "blue"
            border.width: 2
            color: "lightgray"
            anchors.centerIn: parent
            z:5
            Flickable{
                id : flickable
                width: 500;
                height: 400
                contentWidth: t3.width; contentHeight: t3.height
                flickableDirection:Flickable.VerticalFlick
                z:3
                TextEdit{
                    id:t3
                    text: t1.data1
                    clip: true
                    z:1
                }
            }
        }
    }
    

    scroll2.png

    ODБOïO 1 Reply Last reply
    0
    • R Rajashekara V

      I have text edit inside the filckable and text area has lot of data. Flickable is bounded by rectangle.
      when i flick i want the text to be with the bounded rectangle. Now it is over flowing rectangle.
      How to avoid text over flow in TextEdit, if we have long text in it?

      import QtQuick 2.14
      import QtQuick.Window 2.14
      
      Window {
          id : t1
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
          
          property string data1 :"
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-1.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-2.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-3.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-4.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-5.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-6.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-7.
      19:49:18: Running steps for project TextEditScroll...
      19:49:18: Configuration unchanged, skipping qmake step.
      19:49:18: Starting: /usr/bin/make -j4
      19:49:19: Elapsed time: 00:00-8."
          Rectangle{
              width: 500
              height: 400
              border.color: "blue"
              border.width: 2
              color: "lightgray"
              anchors.centerIn: parent
              z:5
              Flickable{
                  id : flickable
                  width: 500;
                  height: 400
                  contentWidth: t3.width; contentHeight: t3.height
                  flickableDirection:Flickable.VerticalFlick
                  z:3
                  TextEdit{
                      id:t3
                      text: t1.data1
                      clip: true
                      z:1
                  }
              }
          }
      }
      

      scroll2.png

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @Rajashekara-V hi
      you can set clip: true on the parent rectangle

      see also https://wiki.qt.io/Flickable_Wrapped_TextEdit

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved