Results 1 to 3 of 3

Thread: Weird problem with MainWindow

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Weird problem with MainWindow

    Maybe today I must have something in my head very odd, because I cannot see why this simple program does not work.
    The problem is that I cannot change at all the MainWindow's title, neither add some Menu,toolbar....
    For example, in the code below, the word "OmniVision" doesnot appear in the MainWindow top bar, it just writes "MainWindow".
    Qt Code:
    1. MainWindow::MainWindow( )
    2.  
    3. {
    4. this->setWindowTitle(tr("OminiVision "));
    5.  
    6.  
    7.  
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5.  
    6.  
    7.  
    8.  
    9. class MainWindow : public QMainWindow {
    10. Q_OBJECT
    11. public:
    12. MainWindow( );
    To copy to clipboard, switch view to plain text mode 

    and the main.cpp is
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8. a.setApplicationName("OmniVision Japita SE");
    9. w.show();
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Simpler than this...
    I noted that if I put in the .pro "CONFIG = release", the problem is ther.
    BUT: if I put "CONFIG = debug_and_release" everything is working (title, button, menu,and so on).
    Why I have to use also debug?
    Last edited by giusepped; 23rd July 2011 at 15:49.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Weird problem with MainWindow

    I have no idea... but I'd try to isolate the problem by deleting the "tr" from this->setWindowTitle(tr("OminiVision "));.
    After that you'd know whether there is something really serious going on or just a misbehaviour of the translation system.

    (And of course, the age-old advice: if something mibehaves, reboot, clean and rebuild or in other words: delete everything that your build system (whatever it is) has generated and try again.)

  3. #3
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Weird problem with MainWindow

    You are right! I never had a suspect about tr() not working inside setWindowTitle.
    Is it a bug or a rule?
    G

Similar Threads

  1. Weird problem with translate()
    By romariorios in forum Qt Programming
    Replies: 8
    Last Post: 27th July 2011, 20:31
  2. Weird text input problem
    By zeldaknight in forum Qt Programming
    Replies: 6
    Last Post: 10th July 2010, 21:19
  3. weird problem in QGraphicsView / QGraphicsScene
    By Mrdata in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2009, 19:26
  4. QFtp weird problem on windows
    By vcp in forum Qt Programming
    Replies: 0
    Last Post: 19th August 2009, 15:13
  5. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 07:51

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.