Results 1 to 16 of 16

Thread: Change Focus With Enter Key in TextEdit box

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Change Focus With Enter Key in TextEdit box

    The code seems OK.
    You do this:
    Qt Code:
    1. setCentralWidget(txtName);
    To copy to clipboard, switch view to plain text mode 

    What other widgets do you refer to?

    This makes the text edit take over the entire client area in the window.

    To add other widgets:
    Qt Code:
    1. QWidget *w = new QWidget(this);
    2. l->addWidget(some widget);
    3. l->addWidget(some widget);
    4. l->addWidget(some widget);
    5. ...
    6. [B]l->addWidget(txtEdit)[/B];
    7. ...
    8. l->addWidget(some widget);
    9. w->setLayout(l);
    10. this->setCentralWidget(w);
    To copy to clipboard, switch view to plain text mode 


    This is just an example. You can use whatever layout you like.
    The point is that in order to add multiple widgets in a main window client area, you need to have a container for them.

    This is why you don't see any other widgets.

    Regards

  2. #2
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Change Focus With Enter Key in TextEdit box

    Ok I worked it out. I did not need to set the control as the central widget just installEventFilter(). When I changed the code it all worked. Thanks a million for your help.

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Change Focus With Enter Key in TextEdit box

    You're welcome.

Similar Threads

  1. Replies: 3
    Last Post: 26th September 2006, 13:16

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
  •  
Qt is a trademark of The Qt Company.