2

I've created a simple Qt Widgets application using Qt Creator on my Windows 10 machine. I use the ui file and the designer to change properties of my QMainWindow, but somehow the width, height and windowTitle properties have no effect when I set them in the designer. Example:

Designer look

However, the resulting application looks like this:

enter image description here

Both size and windowTitle are seemingly ignored. I've also tried setting properties from code, like this (but to no avail):

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowTitle("That's some title you've got there");
}

I have also added a layout to the centralWidget but that only had an effect on the child controls, not the actual window itself (and that seems logical).

diggingforfire
  • 3,359
  • 1
  • 23
  • 33

1 Answers1

1

Normally, it should work.

Can you try if the following minimal example works for you?

#include <QApplication>
#include <QMainWindow>

main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  QMainWindow m;
  m.setWindowTitle("TEST");
  m.show ();
  a.exec();
}
m7913d
  • 10,244
  • 7
  • 28
  • 56
  • This doesn't seem to work either, the windowTitle just defaults to the project name (I simply created a new Widgets application and added the line in main.cpp like you suggested) I did find 'windowFilePath' in the documentation but this has no effect either. – diggingforfire Apr 08 '17 at 18:01
  • Maybe you should specify your qt version in your question. I tested it with Qt 5.8 on Ubuntu 16.04. – m7913d Apr 08 '17 at 18:27
  • Your comment pointed me in the right direction. I was using Qt 5.7 for WinRT. I switched to 5.8 MSVC 2015 and the problem is gone. – diggingforfire Apr 09 '17 at 10:10