[Qt-interest] New to QT - Beginners questions
Bo Thorsen
bo at fioniasoftware.dk
Wed Sep 1 13:08:36 CEST 2010
Den 01-09-2010 12:23, Jens Saathoff skrev:
> Hi!
>
> I'm new to QT and want to discover it a bit. I've downloaded the version
> 4.6.3 with QtCreator for Windows.
> I'm not new to gui-stuff at all, so my questions in a list for short
> answers.
>
> 1. I'm using QTCreator with QTDesigner to design my windows. The
> generator generates an "ui_mainwindow.h" for example. In this header is
> a method "setupUI()" where all the sub-components are instantiated.
> So far so good. But how to use it? ui->mycomponent does not work at all.
> Must i create a new pointer in my mainwindoe-header and point it to
> ui->mycomponent in my mainwindow-constructor to call it in my other
> mainwindow's methods?
> Does QT remove the subcomponents from memory if the parentwindow was
> deleted? Or is it necessary to delete every subcomponent?
You need to read the designer manual:
http://doc.qt.nokia.com/4.6/designer-manual.html
Here you will see, that you have to create a widget as a container for
the designer stuff.
Something like this:
QMainWindow* window = new QMainWIndow;
Ui::MainWIndow ui;
ui.setupUi(window);
In practice, I always subclass QMainWindow and call setupUi() from the
constructor.
> 2. I've read about the SDK for mobile devices (Symbian, Maemo, Windows
> Mobile). Can i just create one code-base for all and compile it for each
> platform?
In theory, yes. However, I'd say that for anything non-trivial, you
can't use the same GUI on all these. There is a *big* difference between
running Qt on a small and on a big screen.
> That's all. Please excuse my stupid questions. I'm new to QT. I'll buy a
> book this week.
That's probably a good idea, but there is a lot of very good information
in the documentation as well. Read it :)
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-interest-old
mailing list