Results 1 to 4 of 4

Thread: stackedWidget

  1. #1
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default stackedWidget

    Hello Anyone,

    Iám using Qt-4.2.2
    I have a MainWindow with QStackedWidget.
    This is a little example ( there is a bigger program.)
    On the stackWidget i have 2 pages.
    On page 1 with LineEdits ( name and Adress ) and pushbutton(Next). currentIndex(0)
    On page 2 i have also 2 LineEdits ( for typing the name and adress) and also a pushbutton(Back). currentIndex(1);
    With the pushbutton(back i can go back to currentIndex(0);
    On page 2 i type the name and adress in the lineedits and push the pushbutton(Back).
    Now my question is what i type in the lineedits i want to see it back on page 1 in the lineedits is this possible.
    Now i see nothing in the lineedits on page 1.

    Thanks in advance.

  2. #2
    Join Date
    Jul 2007
    Posts
    26
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: stackedWidget

    Sure it's posible.
    QString name;
    name = line2Edit->text();
    line1Edit->setText(name);

    Or you can omit declaring a new variable just for that:
    line1Edit->setText(line2Edit->text());
    Looking for lots of help with my project.

  3. #3
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: stackedWidget

    The first solution doesn't work for me in stackedWidget
    QString name;
    name = line2Edit->text();
    line1Edit->setText(name);

    The second solution work for me in stackedWidget
    I can only omit declaring a new variable.
    line1Edit->setText(line2Edit->text());

    What about omit declaring a new variable for QTableWidgetItem.
    On my third page i have a TableWidget with items.
    I want select a item like this:
    Qt Code:
    1. QTableWidgetItem *item = table->currentItem();
    2. if( item->isSelected()) {
    3. QString name = item->text();
    4. }
    To copy to clipboard, switch view to plain text mode 
    But i can't use the string variable name because stackedWidget doesn't see the variable in the line1Edit on page 1.(the same as first solution).

  4. #4
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: stackedWidget

    I have solved it.
    It works fine now.

Similar Threads

  1. Does a StackedWidget plugin need multipage?
    By jayw710 in forum Qt Tools
    Replies: 2
    Last Post: 4th July 2007, 11:07
  2. How to move next page in stackedwidget ?
    By npc in forum Qt Programming
    Replies: 1
    Last Post: 10th January 2007, 14:24
  3. StackedWidget overlapped
    By manucorrales in forum Qt Programming
    Replies: 5
    Last Post: 14th July 2006, 20:18

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.