Archive for category QT Programming

Resizable Application Windows in QT 4.5

One of the quirk with QT 4.5 is that in order to get your entire application to resize (all the elements within it), they have to be within a layout. However, the QT Designer won’t let you assign a layout to empty QWidgets, especially if they are inside the tab widget. So this is how I go about solving the problem.

  1. Add a vertical layout into each of the QWidget inside the tab. (You need this for the whole application to resize, anyway)
  2. Click on the QWidget (not in the hierarchy!), right click and add a Layout. By this time, the “no entry” icon next to that widget would disappear
  3. If you are dynamically adding widgets to the tab during run-time, you have to add to the vertical layout inside the QWidget of that tab.

If I have more time, I would put up a step by step tutoiral.

Tags:

Installing QWT and getting it to work with QT 4.5 Windows

After much trial and error, here is how I have managed to get QWT working with QT 4.5

  1. Locate the QWT web-page at SourceForge
  2. Make sure that you download the QWT 5.1.2 version. For some reasons, SourceForge lists the older version 4 first
  3. Read the INSTALL file – that pretty much covers what you need to do, but for more control, generate the Visual Studio project files (qmake-msvc vc)
  4. Go find the project file in the \src\ folder
  5. Complie a release build from it

If all you need is a release build, then this is all fine and good. However, if you want a debug build…

  1. Go to project properties, select Debug
  2. Go to Linker, General, and add a “_d” to the end of the generated file
  3. Complie

Of course, you have to remember set up the input files to the examples (qwt5.lib_d instead of qwt5.lib) for them to work. Now for the goody – you can now complie the plugin (found in the \designer folder) using either release or debug, and even both, since you can have both verisons of QWT existing.

The fnal step is to place the two new dlls (the release one, and your own debug one) into the qt\bin folder. Place the plugin dlls into the \plugins\designer folder. Then this whole thing should work.

Hopefully.

Tags: