[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: using QtCreator/Designer .ui form with KDE
From: Kevin Krammer <kevin.krammer () gmx ! at>
Date: 2012-02-12 8:54:28
Message-ID: 201202120954.33320.kevin.krammer () gmx ! at
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Saturday, 2012-02-11, Jan Kalcic wrote:
> On 02/11/2012 10:24 AM, Kevin Krammer wrote:
> > On Saturday, 2012-02-11, Jan Kalcic wrote:
> >> Hi there,
> >>
> >> It is a bit I am getting to know Qt developing small and almost useless
> >> applications just to practice, particularly using Qt Creator (I find it
> >> very easy, intuitive, powerful and also cool BTW)
> >>
> >> Now I have one app which I am starting to take more seriously and with
> >> this I would like to "swtich" to KDE classes. It seems to be not too
> >> difficult but I still have a missing point. I assume it is possible to
> >> use .ui forms created with QtCreator/Designer and I also assume that the
> >> .ui file which is converted in the header file by the UIC (invoked
> >> automatically by qmake) is the same XML file I can use as .rc file
> >> (needed by KXMLGUIClient). Am I wrong? I am sure I am as it does not
> >> work and it also seems the two XML files actually have difference
> >> syntax.
> >>
> >> So how can this be achieved?
> >
> > As Andreas already said those two are independent and for different
> > purposes.
> >
> > You continue to use your .ui files the same way you do in a normal Qt
> > application.
> >
> > KXMLGUIClient stuff is mainly for the main window's menu's and toolbars,
> > a main window's content will in most cases still be a designer created
> > widget.
>
> Understand, now I see where I was wrong. I have just stripped out from
> the constructor the ui->setupUi(this); as I thought the
> setupGUI(Default); was the replacement. Instead I need them both, the
> first one to generate the User Interface and second one to add menus
> toolbars etc etc..
>
> What it was actually misleading was the fact the GUI did not appear,
> without throwing any error BTW, when I was trying to not setup the Ui
> with ui->setupUi(this);
> Now I see the problem was instead the function setCentralWidget(this);
> when this is called the GUI still does not appear. I still need to
> investigate why, do not if you guys have any suggestion..
setupCentralWidget(this)? As in this == main window?
This would not work, the window can't be a child of itself.
Try this instead:
QWidget *widget = new QWidget(this);
ui->setupUi(widget);
setCentralWidet(widget);
Even better would be to create a widget subclass for the central widget and
call setupUi in its constructor and implement all the central widget's
functionality in there.
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic