Results 1 to 5 of 5

Thread: connect() problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: connect() problem

    Qt Code:
    1. void NowyWpis::Wybor ()
    2. {
    3. wybortr = new QGroupBox(tr("Wybor "));
    4. QGridLayout *grid = new QGridLayout;
    5. wybierz = new QComboBox;
    6.  
    7. extern void wypisz ();
    8. wypisz ();
    9. foreach (QString k, Lista)
    10. {
    11. wybierz->addItem(k);
    12. }
    13.  
    14. connect(wybierz, SIGNAL(currentIndexChanged(int)),
    15. this, SLOT(Aktual()));
    16.  
    17. ikona = new QLabel(); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Add this
    18. grid->addWidget(wybierz, 0, 0);
    19. grid->addWidget(ikona, 0, 1); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Error
    20. wybortr->setLayout(grid);
    21. }
    22. void NowyWpis::Aktual ()
    23. {
    24. wybrany =(wybierz->currentText());
    25. //ikona = new QLabel(); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Remove this
    26. ikona->setAlignment(Qt::AlignBottom | Qt::AlignRight);
    27. ikona->setPixmap(QPixmap("Obrazy/+wybrany+"asd.png"));
    28. }
    To copy to clipboard, switch view to plain text mode 

    You are using "ikona" before it the created
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  2. The following user says thank you to Santosh Reddy for this useful post:

    Pawello (1st August 2012)

  3. #2
    Join Date
    Jul 2012
    Posts
    25
    Thanks
    10

    Default Re: connect() problem

    Thank you- this solves the problem

Similar Threads

  1. Problem with connect
    By Momergil in forum Newbie
    Replies: 8
    Last Post: 29th July 2011, 01:27
  2. connect() problem
    By harmodrew in forum Newbie
    Replies: 14
    Last Post: 5th August 2010, 17:45
  3. Connect Problem
    By nrabara in forum Newbie
    Replies: 3
    Last Post: 4th May 2009, 12:19
  4. connect problem
    By liengen in forum Newbie
    Replies: 2
    Last Post: 22nd October 2008, 16:21
  5. Problem with connect()
    By mrnor3 in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 14:05

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.