Results 1 to 4 of 4

Thread: problem in lable

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question problem in lable

    hi friends,
    I am using QLabel in the function and changing the text of the label in a regular interval but when i run the program the intermediate label text is not showing its text ...
    if i use timer and it displaying but i cant use that for all label display so how can i solve that .... how to make regular interval of time b/w labels ....


    please help

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: problem in lable

    Some code would help us help you.

    Does the event loop run between those settings of your QLabel's text?
    (in other words: does Qt get a chance to (re)paint the updated label?)

    HTH

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Re: problem in lable

    in class fingerprint including Ui.h file having a lable(msgLabel) and a pushbutton (capture)
    Qt Code:
    1. class FingerPrint::FingerPrint()
    2. {
    3. setupUi(this);
    4. msgLabel->setText("Click Capture");
    5. connect(captureButton, SIGNAL(clicked()),this,SLOT(newPorting()));
    6. }
    To copy to clipboard, switch view to plain text mode 
    in the connect slot calling a function returning CaptureImage()
    Qt Code:
    1. void FingerPrint::newPorting()
    2. {
    3. QString out = "Put your finger.";
    4. msgLabel->clear();
    5. msgLabel->setText(out);
    6. res = CaptureFunc();
    7. if(res == 0)
    8. {
    9. originalPixmap = QPixmap();
    10. msgLabel->setText("Image Captured..");
    11. FPSLabel->setPixmap((QPixmap(QString::fromUtf8("Myimages/finger.bmp"))));
    12. }
    13. else
    14. msgLabel->setText("Failed..");
    15. }
    To copy to clipboard, switch view to plain text mode 

    in CaptureImage function
    Qt Code:
    1. int FingerPrint::CaptureFunc()
    2. {
    3. some code ....
    4. some code ....
    5. msgLabel->clear();
    6. msgLabel->setText("Capturing the image ...");
    7.  
    8. some code ....
    9. some code ....
    10. msgLabel->clear();
    11. msgLabel->setText("Image Saved...");
    12. return OK;
    13. }
    To copy to clipboard, switch view to plain text mode 





    this is my code here first in my window it should display in lable msgLable "click capture"
    next Put your finger and then inside Capture Image functions Capturing the image and last is Image Captured

    this what i programmed but ...
    its coming only ClickCapture at first then at last printing B]Image Captured[/B] in between text of msgLabel were not displaying ....

    what is the exact problem .... please help ....

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: problem in lable

    setText tells the QLabel to update its text...
    QLabel will call update() to schedule a repaint...
    that repaint will not be done right then, but rather when Qt has the time for it after your slot/event has finished and control flow has returned to the Qt event loop is.
    If you have very long running slots, you need to
    1) extract the long running op into a thread (and communicate with e.g. signals/slots); or
    2) periodically call QCoreApplication::processEvents(); or
    3) split that one slot into several (of course, you need some external triggers, to continue your "slot sequence")

    HTH

    PS: clear() is of no use when you directly call setText() after it.

  5. The following user says thank you to caduel for this useful post:

    wagmare (18th December 2008)

Similar Threads

  1. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  2. Problem in using QHttp with QTimer
    By Ferdous in forum Newbie
    Replies: 2
    Last Post: 6th September 2008, 12:48
  3. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  4. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.