PDA

View Full Version : Weird problem with MainWindow



giusepped
23rd July 2011, 16:42
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".


MainWindow::MainWindow( )

{
this->setWindowTitle(tr("OminiVision "));




}




#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>




class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow( );


and the main.cpp is


#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
a.setApplicationName("OmniVision Japita SE");
w.show();
return a.exec();
}



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?

mvuori
24th July 2011, 00:35
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.)

giusepped
24th July 2011, 13:17
You are right! I never had a suspect about tr() not working inside setWindowTitle.
Is it a bug or a rule?
G