tags:

views:

413

answers:

4

I'm using QT 2009.03 with the Visual Studio addin 1.0.2. I'm writing an application that has commands to open non-modal windows, and multiple windows can be open at the same time.

These windows themselves need to be designed in QTDesigner. An example of what I'm looking for can be found in Firefox. If I go to Tools / Addons it opens a child window.

I'm not sure what is the correct workflow in QTDesigner. I thought it might be a "Frame" but that doesn't seem to be a window, with your standard close/minimize tabs and menu bar. I thought perhaps it was (from Visual Studio) File/New Project/QT4 Projects/QT4 Designer plugin. That generates some classes, but there's no .ui file for me to design with.

+2  A: 

Consider restating the question, I'm not sure I understood what the problem is -- how to create a ui file? How to create ui file inside VS? (or Creator?) What Qt class to base your window on? Something else?

Do you use QtCreator or VS with Qt integration? (Or is there hybrid approach? O_o)

Anyway, you can always open QtDesigner separately and create ui file inside. Then add it to .pro file (assuming you are using .pro and not VS solution directly).

For base window you can even use QWidget. Decorations (titlebar, system menu, minimize, etc) depend on window flags passed into constructor.

Eugene
+2  A: 

In Visual Studio, the workflow I use when I want to design a new window is to add a Qt GUI class with Project->Add Class...->Qt4 Classes->Qt4GuiClass.

Then, fill out the form as necessary and the VS add-in will add the appropriate ui and moc files. Double clicking on the ui file will bring up Qt Designer, which you can use to lay your window out.

richardwb
+1  A: 

Taking your example:

  • the Firefox main window is a QMainWindow
  • the addin window is a QDialog (non-modal)

You create a Qt designer UI (VS 2003) by right clicking your project in the solution explorer, clicking "Add" and selecting "Add Qt GUI class".

rpg
+1  A: 

Usually you use a QMainWindow for the main window in your application. This will give you your minimise, and close buttons. In your QMainWindow you can add or remove a menu bar by right clicking on the form in QtDesigner.

For a non-model window, you would normally use a QDialog. This will also give you your minimise, and close buttons.

Are you definately using the visual studio add-in (opens ui files in Qt Designer)?

There is also the visual studio integration. (opens ui files within visual studio and provides tools to edit it)

Steven