Workflow in QtDesigner - qt

I'm using Qt 2009.03 with the Visual Studio addon 1.0.2. I'm writing an application that has commands to open non-modal windows, and multiple windows can be opened 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.

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.

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.

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".

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)

Related

Need to write Extension for Code Maps of a solution

I want to write an extension on dgml file. Code map of Solution in visual studio.
How do I plug-in my code on a context menu of links shown in the diagram
I'm uncertain if there are any extensibility points build into the dgml editor, but you can certainly add menu items to the "Architecture" drop down menu item with a VS extension built with the Visual Studio SDK.
You'll want to read up on developing Visual Studio extensions, so that you are familiar with how menu items (also referred to as commands) are added to the VS IDE. Also, there are two categories of windows you can display in Visual Studio. Tool Windows, and Document Winodws. You'll need to figure out which type fits your particular requirements. Generally speaking if your underlying data is stored in a file, you'll most likely want to implement a document window (also known as a custom editor or designer). For example, the window displayed after selecting "Generate Code Map for solution" is a custom designer for .DGML files.
Below are a few links to get you pointed in the right direction.
Visual Studio SDK
Create an extension with a menu command
Create an extension with a tool window
Walkthrough: Create a custom editor
VSSDK Extensibility Samples (github)
Sincerely,

Edit multiple QT widgets (GUI) in QT Creator

I have a general GUI editing question using QT. We can create GUI applications using the QT form view where we can edit the layout graphically. And then we can swtich to the code to fine tune. Problem is i can Edit only the main window GUI. Now if i want to create another dialog e.g, pop up, i could only do so from code. Can you recommend any example or direct to the QT Documentation which shows how to edit multiple widget/dialog windows graphically using IDE.
I looked through the questions asked here which neatly explains how to open a new dialog window with code examples. But i could not find any example showing how to edit multiple layouts using QT's graphical editor.
To add other forms to your application, right click on the project name in the project tree view, then select "Add New", then under the Qt category look for "Qt Designer Form Class", like in this picture:
Follow the rest of the wizard (will ask the class name) and in the end you should find tree more files in your treeview with extensions .h, .cpp and a .ui. Click on the latter one to open the designer and edit the form from there.

Qt ui on top of c/c++ code

I saw this thread: QML UI on top of OpenGL rendering in Qt5.3 but it's not what I am looking for.
My question is if I have a program already written in c/c++ and would like to add ui to it in the most cross platform way. Qt seems to be the way to go, is it possible to just link the Qt library 'hopefully not too large' into my application and create menus, buttons etc that work in a cross platform way?
I don't want to build my app using Qt, I just want to use the layout widgets, menus etc.
I don't want to build my app using Qt, I just want to use the layout widgets, menus etc.
What?
In any case you should make an UI (using Qt Widgets or Qt Qml) and UI logic, and connect it to your app API. Just add UI layouts (using Qt Designer) and connect UI actions for button/menu/etc. to your app.
Qt - is the most cross-platform way to go, today.

Which widget is used in Visual Studio's central widget?

I want to use Qt to build a GUI with a central widget like the visual studio. The widget has a number of tabbed windows to edit h/cpp files. Which widget should I use?
You can create only something similar to Visual Studio using Qt classes. Central widget should also have layout. Only QMainWindow has setCentralWidget method.
QTextEdit with QSyntaxHighlighter to make your text with color.
QMenu requires also QAction. You can also use QToolBar
QSplitter allows you to move(resize widgets)
QLineEdit for small texts (for example search word or something else)
Description:
I think the closest thing you can find to replicate the visual studio tabbed windows is QMdiArea. But if you want the full functionality of Visual Studio's tabbed widgets you need to implement your own widget.
I run into the same problem and found a library that adds the ability to use similar layouts as VS do: dynamically resizable, stackable (horizontally, vertically, on each other), undockable, closable, saveable.
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System
It has its own issues (at least on Linux), but it's a good point to start, anyway.

Adding user built widgets to a ui file in qt creator

The qt designer portion of qt creator has many built in widgets. But let's say I want to add custom widgets created in the same qt project to the ui file of the window. By taking these steps:
Create a new Qt GUI application with a main window, we'll call the window A.
Add a new widget to the project, the widget just uses standard UI components, say buttons. We'll call this widget B.
Add an instance of widget B to window A.
Now, I know one way to do that, and that is:
In window A, add a blank widget (or widget container, from the containers section of the list of possible widgets. We'll call this widget C.
Promote it (widget C) to widget B.
However, the problem with this is that Qt Creator's designer treats it like a generic QWidget. And as such, you can't do things like add it to a splitter, or connect signals/slots that are specific to the widget.
So is there any other ways to add widget B to window A in the ui file using qt creator? Thank you.
I'm not sure to understood your question well so I could ask the wrong question. Are you sure your "B" widget is a subclass of QDesignerCustomWidgetInterface? This should expose all stuff that your widget/plugin offers...
Last note: a friend of mine tried to add a custom widget like you. And at the end of the described procedure that Lol4t0 told you, he found you must compile plugin with the same compiler with wich qtcreator/designer was compiled. This happens because as we know c++ doesn't keep ABI compability (instead of i.e. C language) stuff like: Name handling can change from compiler to compiler, how data is loaded into registers can change...and so on. My friend tried to compile plugin with mingw, but he found that qtcreator was compiled with visual studio compiler. Therefore if you want to deploy your plugin on Windows or you compile your plugin with visual studio, or you have to compile qtcreator/designer from scratch.
I know this is a very old question, and I'm not sure what capabilities Designer had in 2012, but I came across this in a Google search for something else and figured I'd add some missing info:
However, the problem with this is that Qt Creator's designer treats it like a generic QWidget. And as such, you can't do things like add it to a splitter, or connect signals/slots that are specific to the widget.
Generic QWidgets can be added to splitters with no issues these days.
As far as signals and slots go, you can use them like so:
After promoting a widget to your custom widget, right-click it and choose "Change signals/slots..." from the context menu.
Add the signatures for any custom signals and slots you want to be able to use in Designer / Creator here.
Now those signals and slots will be accessible in Designer like any other signals and slots.
The only thing you can't really get with promoted widgets is access to custom properties in the property panel; for that, yeah, you'll need to go through the custom widget creation process.

Resources