Results 1 to 2 of 2

Thread: One Widget on top of Another Problem

  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default One Widget on top of Another Problem

    Dear Friends
    One Widget is on top of snother, when a radio button is checked first should pop up, and when the second radio button is checked the second widget should pop up...I have tried using show(), hide() slots.. but it didnt work. Any idea would be highly appreciated. See the code snippet below.
    Using Qt- designer I have placed two widgets on of one another.

    QTextEdit edit1, edit2;

    if(radio_1->isChecked()==true) {
    edit2->hide();
    edit1->show();
    }
    else {
    edit1->hide();
    edit2->show()
    }

  2. #2
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: One Widget on top of Another Problem

    Ty by connecting onCheckBoxClicked(bool checked) signal to a slot to control the setVisible. Something like:
    Qt Code:
    1. connect(ui->checkBox,SIGNAL(clicked(bool)),this,SLOT(on_checkBox_clicked(bool)))
    2.  
    3. void MainWindow::on_checkBox_clicked(bool checked)
    4. {
    5. ui->textEdit->setVisible(checked);
    6. ui->textEdit_2->setVisible(!checked);
    7. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QScrollArea inner widget problem
    By agaf in forum Qt Programming
    Replies: 3
    Last Post: 19th January 2010, 18:06
  2. Widget highlight problem
    By shadowfax in forum Newbie
    Replies: 1
    Last Post: 14th July 2009, 09:23
  3. Problem with my own widget
    By Macok in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2009, 23:38
  4. Widget background problem.
    By zgulser in forum Qt Tools
    Replies: 2
    Last Post: 6th January 2009, 06:34
  5. Widget resizing problem
    By fwohlfert in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2006, 08: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.