Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How to disable text entry
Forum Updated to NodeBB v4.3 + New Features

How to disable text entry

Scheduled Pinned Locked Moved Solved C++ Gurus
4 Posts 2 Posters 1.5k Views 2 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I have a small issue with my C++ code .

    My base class is QTextEdit - to that class I add QWidget - user access to application.
    Works as desired.

    The "problem" is - the added widget DOES NOT fully covers the underlying "add text feature " to the original display.
    The user can enter any text into the form at any point.

    I would like to disable the "flashing " | mark thus disable the random position text entry marker at the same time.

    I cannot simply remove the "newFile" code - it is used to keep track of the MDI subwindows.

    Addy reasonable suggestion how to do this - disable the text entry - would be appreciated

            //orignal createMdiChild
            MdiChild *child = createMdiChild(); //QTextEdit
            child->setLayout(new QVBoxLayout);
            DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog();
            // insert widget
            child->layout()->addWidget(DDD);
           child->newFile();  // create child as file - need file name
            child->show();     // show added widget and original child
    
    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by fcarney
      #2

      @AnneRanch said in How to disable text entry:

      MdiChild *child = createMdiChild(); //QTextEdit

      https://doc.qt.io/qt-5/qtextedit.html#readOnly-prop

      Is this what you are looking for?

      Edit:
      I read it a few times. Not getting what you need. Would a picture help?

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        Here is a screenshot with no text entries , but the flashing "|" symbol - upper left corner - is where text can be added

        f1e93986-d088-4605-ab69-fc062c9a8919-image.png

        Here is after "k" was pressed for a while

        adce19dd-fdaf-40f0-9898-d196986a8d31-image.png

        Obviously goofy thing to let user do.

        Which object can I make "read only"?

        There may be an occasion to have "plain" child submenu , no widget added, so adding text would be OK.

        Hence it should be controlled outside child class.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #4

          As simple as this
          child->setReadOnly(true);

          Thanks for resolving the problem.

          1 Reply Last reply
          1

          • Login

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