Results 1 to 4 of 4

Thread: Problem with UI showing

  1. #1
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Problem with UI showing

    Hi. I have a small problem.
    my code:
    Qt Code:
    1. ka::ka(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::ka)
    4. {
    5. ui->setupUi(this);
    6. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    7. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    8. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    9. go();
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

    The function go(); is running before UI is showed but I dont want it like that.
    The Ui should be show first, and then go(); should be run.
    Could You help me?
    Sorry for my bad english
    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Problem with UI showing

    call go() with a single shot timer or better reimp the showEvent and then start go().

  3. #3
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with UI showing

    i think time isnt problem here.
    Qt Code:
    1. ka::ka(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::ka)
    4. {
    5. ui->setupUi(this);
    6. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    7. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    8. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    9. QTimer::singleShot(1000, this, SLOT(quit()));
    10. go();
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 
    it waits a few sec, do go(); function, a then shows ui

    and i dont know how to use showEvent...



    Qt Code:
    1. ka::ka(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::ka)
    4. {
    5. ui->setupUi(this);
    6. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    7. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    8. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    9. QWidget::showEvent(this);
    10. go();
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 
    I tried like that but it dosnt work.
    thanks for helping...

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Problem with UI showing

    Make go() a slot and call that, not quit()...

Similar Threads

  1. Problem showing the right thing.
    By Archa4 in forum Newbie
    Replies: 20
    Last Post: 11th February 2011, 12:55
  2. showing icons - setPixmap problem
    By Tomasz in forum Newbie
    Replies: 4
    Last Post: 18th November 2010, 17:37
  3. Problem showing QTableView
    By weaver4 in forum Qt Programming
    Replies: 6
    Last Post: 23rd November 2009, 13:42
  4. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03
  5. Problem showing raw images
    By wkit23 in forum Qt Programming
    Replies: 5
    Last Post: 8th September 2006, 13:33

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.