Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, March 2007
QWidget popup ?


Message 1 in thread

Hi,

I'm working on a school project, I have to realize a multimedia player
alternative to wmp. So, I chose to do my app using Qt 4.2.x, but now I can't
seem to find out how to to make a QWidget window pop up when clicking on a
actionItem in my action menu.
You know, it would be a "preferences menu" that pops up when clicking on
"Edit > Preferences".

I tried to connect the preferencesAction signal to a custom slot that does
the following:

Ui::PreferencesWindow custom_ui;
custom_ui.setupUi(this);

(of course, I included #include "ui_preferences.h" at the beginning)

But this does nothing...

Could someone please help me ? :)
Thank you in advance !

PS: sorry, this is a repost from my original message on qt-solutions, i 
believe it was a mistake to post it on qt solutions :) 

--
 [ signature omitted ] 

Message 2 in thread

On 31.03.07 15:13:15, Rémy Bardou wrote:
> Hi,
> 
> I'm working on a school project, I have to realize a multimedia player
> alternative to wmp. So, I chose to do my app using Qt 4.2.x, but now I can't
> seem to find out how to to make a QWidget window pop up when clicking on a
> actionItem in my action menu.
> You know, it would be a "preferences menu" that pops up when clicking on
> "Edit > Preferences".
> 
> I tried to connect the preferencesAction signal to a custom slot that does
> the following:
> 
> Ui::PreferencesWindow custom_ui;
> custom_ui.setupUi(this);

this should be a new QWidget, else you're trying to put the ui onto your
existing main window. So do something like

QWidget* w = new QWidget();
Ui::PreferencesWindow custom_ui;
custom_ui.setupUi(w);
w->show();

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

Thanks, it works !
But is there a way that when the QDialog (yes, i mistoke in my previous 
message) is open, I can't get the focus on the QMainWindow ?

:)

"Andreas Pakulat" <apaku@xxxxxx> a écrit dans le message de 
news:20070331134119.GB11000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> On 31.03.07 15:13:15, Rémy Bardou wrote:
>> Hi,
>>
>> I'm working on a school project, I have to realize a multimedia player
>> alternative to wmp. So, I chose to do my app using Qt 4.2.x, but now I 
>> can't
>> seem to find out how to to make a QWidget window pop up when clicking on 
>> a
>> actionItem in my action menu.
>> You know, it would be a "preferences menu" that pops up when clicking on
>> "Edit > Preferences".
>>
>> I tried to connect the preferencesAction signal to a custom slot that 
>> does
>> the following:
>>
>> Ui::PreferencesWindow custom_ui;
>> custom_ui.setupUi(this);
>
> this should be a new QWidget, else you're trying to put the ui onto your
> existing main window. So do something like
>
> QWidget* w = new QWidget();
> Ui::PreferencesWindow custom_ui;
> custom_ui.setupUi(w);
> w->show();
>
> Andreas
>
> -- 
> Today is the tomorrow you worried about yesterday.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/ 

--
 [ signature omitted ] 

Message 4 in thread

On 31.03.07 16:23:28, Rémy Bardou wrote:
> Thanks, it works !
> But is there a way that when the QDialog (yes, i mistoke in my previous 
> message) is open, I can't get the focus on the QMainWindow ?

Then you have a modal QDialog, either by using exec() or by providing a
propr flag to the QDialog constructor.

Andreas

-- 
 [ signature omitted ]