Results 1 to 6 of 6

Thread: go next screen

  1. #1
    Join Date
    Apr 2011
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Symbian S60

    Default go next screen

    i have been create a listwidget and add three items i want when touch on item then open new screen.but i can't success please help me i send the code
    ////////////////header//////////

    Qt Code:
    1. #ifndef MYWIDGET_H
    2. #define MYWIDGET_H
    3.  
    4. #include <QWidget>
    5. #include<QtGui>
    6. namespace Ui {
    7. class MyWidget;
    8. }
    9. class MyWidget : public QWidget
    10. {
    11. Q_OBJECT
    12.  
    13. public:
    14. explicit MyWidget(QWidget *parent = 0);
    15. ~MyWidget();
    16. private slots:
    17. void itemClicked(QListWidgetItem *item);
    18.  
    19. private:
    20.  
    21. QListWidget *m_myListWidget;
    22. QPushButton *widget2;
    23. QPushButton *widget3;
    24.  
    25.  
    26.  
    27. };
    28.  
    29. #endif // MYWIDGET_H
    To copy to clipboard, switch view to plain text mode 
    /////////////////////cpp////////////////
    Qt Code:
    1. #include "mywidget.h"
    2. #include "ui_mywidget.h"
    3.  
    4. MyWidget::MyWidget(QWidget *parent) :
    5. QWidget(parent)
    6.  
    7. {
    8.  
    9. m_myListWidget = new QListWidget(this);
    10. new QListWidgetItem(tr("shahid"), m_myListWidget);
    11. // new QListWidgetItem(tr("Fir"), m_myListWidget);
    12. connect( m_myListWidget, SIGNAL(itemClicked(QListWidgetItem *)), SLOT(itemClicked (QListWidgetItem *)));
    13.  
    14. }
    15. void MyWidget::itemClicked(QListWidgetItem *item)
    16. {
    17.  
    18. widget2 = new QPushButton("Text message");
    19. widget3 = new QPushButton("Create Message");
    20. QVBoxLayout *layout =new QVBoxLayout(this);
    21. layout->addWidget(widget2);
    22. layout->addWidget(widget3);
    23. setLayout(layout);
    24.  
    25.  
    26. }
    27.  
    28.  
    29. MyWidget::~MyWidget()
    30. {
    31. delete m_myListWidget;
    32. }
    To copy to clipboard, switch view to plain text mode 
    please any one can help me
    Last edited by wysota; 27th April 2011 at 09:15. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: go next screen

    You are not creating a new window when an item is clicked.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2011
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Symbian S60

    Default Re: go next screen

    how to create new window please help me .i am beginner for symbian Qt

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: go next screen

    Did you look at the examples?

    Did you view the documentation for the list of classes?

  5. #5
    Join Date
    Apr 2011
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Symbian S60

    Default Re: go next screen

    sir if you have possible then please send me small program how to go one window to another

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: go next screen

    The code you have in MyWidget::itemClicked() does not, as Wysota pointed out, create a new window. You create a few widgets, put them in a layout and then set the layout of the current widget. Try putting that code into the constructor of a new class X derived from QWidget or QDialog. Then create a new instance of class X in MyWidget::itemClicked().

Similar Threads

  1. Replies: 3
    Last Post: 25th January 2011, 13:36
  2. Replies: 0
    Last Post: 19th January 2011, 03:29
  3. application screen as screen saver
    By wizarda in forum Qt Programming
    Replies: 0
    Last Post: 6th January 2011, 19:15
  4. Replies: 2
    Last Post: 11th June 2010, 07:23
  5. Tab to new screen
    By mstegehu in forum Qt Programming
    Replies: 2
    Last Post: 22nd June 2009, 15:52

Tags for this Thread

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.