PDA

View Full Version : Photoshop filter plug-in



ExxEnos
13th February 2009, 20:32
Hi all!
I'm using Qt for creating a photoshop filter plugin.
I have a problem on Mac OS X. After I close my dialog the photoshop's menu hides.

Here is my code:


char **argv = { 0 };
(void) new QApplication(argc, argv);
MainDialog *w = new MainDialog();
w->setWindowFlags(Qt::WindowStaysOnTopHint);
qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
w->show();

codeslicer
14th February 2009, 01:21
Try removing this line of code:


qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );

ExxEnos
14th February 2009, 10:03
Try removing this line of code:


qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );

This take no effect.

talk2amulya
14th February 2009, 10:13
what menu and where exactly is ur dialog showing..can u post a snapshot

ExxEnos
14th February 2009, 11:51
Ok, here is my screenshots:

Picture 1 - screen before i open dialog.
Picture 2 - dialog opened, main menu changed.
Picture 3 - dialog closed, but main menu is not defaulted.

talk2amulya
14th February 2009, 12:35
do u have any idea why it is hiding the menu in the first place?

ExxEnos
14th February 2009, 13:31
In the firs post I forgive one line

char **argv = { 0 };
(void) new QApplication(argc, argv);
MainDialog *w = new MainDialog();
w->setWindowFlags(Qt::WindowStaysOnTopHint);
qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
w->show();
qApp->exec()


Another case is:

char **argv = { 0 };
(void) new QApplication(argc, argv);
MainDialog *w = new MainDialog();
w->setWindowFlags(Qt::WindowStaysOnTopHint);
qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
w->exec();

This code works like first case.


do u have any idea why it is hiding the menu in the first place?

Modal dialog should block menu.

talk2amulya
14th February 2009, 14:03
i dont think there is any plausible reason why dialog would hide the menu..have u written any specific code to do that

ExxEnos
14th February 2009, 15:43
i dont think there is any plausible reason why dialog would hide the menu..have u written any specific code to do that

In Mac OS X there is no separate menu for each window, like in Windows. Mac OS shows only menu for active window.

talk2amulya
14th February 2009, 16:03
u r creating the QApplication variable on the heap but r not deleting it..also, check if there is no event loop running..i think ur application is not quitting properly because of which control is not going back to the main application, thus the menu doesnt show

Lykurg
14th February 2009, 16:44
Hi,

the problem is - as talk2amulya says - in not destroying the dialog. The lastWindowClosed() isn't emitted because after exec() the dialog is just hidden not destroyed! So do

(void) new QApplication(argc, argv);
qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
MainDialog *w = new MainDialog();
w->setWindowFlags(Qt::WindowStaysOnTopHint);
if (QDialog::Accepted == w->exec())
{
// do your stuff
}
w->close();


should solve your problem.

Lykurg

ExxEnos
14th February 2009, 17:31
I close window on button click event:


void MainDialog::on_pushButton_clicked()
{
this->close();
}

It doesn't work.
Your code works like mine.

talk2amulya
14th February 2009, 18:12
i still hv one issue with what u r doing.. u r creating the QApplication object on a heap(i've never seen anyone do that)..where r u deleting it?i m sure the application isnt closing properly..or thru sm other way, the focus is STILL not returning back to Photoshop..there is ur issue..lookin at what u've given us

ExxEnos
14th February 2009, 19:06
i still hv one issue with what u r doing.. u r creating the QApplication object on a heap(i've never seen anyone do that)..where r u deleting it?i m sure the application isnt closing properly..or thru sm other way, the focus is STILL not returning back to Photoshop..there is ur issue..lookin at what u've given us

This code work propertly on Win XP.
You want to tell me, that I should do something like that:

qApp->quit();
delete qApp;
? This code doesn't work too.

talk2amulya
14th February 2009, 19:45
ok, one last thing


w->setWindowFlags(Qt::WindowStaysOnTopHint);

try to remove this flag..i know what its purpose is..but just try it..i dunno what else could be done to resolve ur issue

ExxEnos
14th February 2009, 21:20
ok, one last thing


w->setWindowFlags(Qt::WindowStaysOnTopHint);

try to remove this flag..i know what its purpose is..but just try it..i dunno what else could be done to resolve ur issue

I tryed.
If I use qApp->exec() or w->exec() i take problem with menu. Elsewere dialog box closes immediatly after it shows.

ExxEnos
17th February 2009, 11:28
Has anyone another ideas?

trytry
16th October 2009, 04:42
Hi, and now I also get stuck to the same problem as yours. Have you had any solution so far? Please kindly help. Thanks a lot.

NoRulez
22nd October 2009, 08:03
Hello,

i'm also interessted on this solution.

Best Regards
NoRulez

qt_amateur
13th April 2010, 15:17
Add this line just after you create QApplication:
qApp->setAttribute(Qt::AA_MacPluginApplication,true);