PDA

View Full Version : dropdown menu(popupmenu) refreshing issue



Ankit
17th August 2007, 11:28
Hi all,

I m using Qt 3.2

In my application I am using one dropdown menu just like our normal FILE menu.

Now when I click on one of the items from that drop down list, It displays one dialog box.

When I click the item, dialog box opens.Now my problem comes here, when I close the dialog box, partial part of the that dropdown menu remains on the page, so what can I do to prevent so.

Thanks in Advance
Ankit

wysota
17th August 2007, 12:40
Can we see the code you wrote to handle the menu?

Ankit
18th August 2007, 05:37
here is the code how the menu is generated:

CMainPage::CMainPage( QWidget *pParent, const char *member, const QString &nMemStatus , const QString &nBattaryStatus , const QString &strTitle)
:CMenuPage(pParent, member, nMemStatus, nBattaryStatus, strTitle)
,m_pStartExpt((m_pImage->m_pPixSetup), &g_optimizedPageTable_Normal[0] ,this)
,m_pResult((m_pImage->m_pPixResult), &g_optimizedPageTable_Normal[1] , this)
,m_pSysSetting ((m_pImage->m_pPixSetting), &g_optimizedPageTable_Normal[2], this)
,m_pShutDown((m_pImage->m_pPixShutDown), &g_optimizedPageTable_Normal[3] ,this)

{
setFont(*CGUIAppController::m_pNormalFont);
m_pParent = pParent;
//Add the Popup menu
m_pImage = CImages::Instance();
addPopupMenu((m_pImage->m_pPixStart), g_StrTbl_ConstLables_Bold[0], 1);
addPopupMenu((m_pImage->m_pPixSetup), g_StrTbl_ConstLables_Bold[14], 2);
addPopupMenu((m_pImage->m_pPixResult), g_StrTbl_ConstLables_Bold[16], 3);
addPopupMenu((m_pImage->m_pPixSetting), g_StrTbl_ConstLables_Bold[18], 4);
addPopupMenu((m_pImage->m_pPixeloglogo), g_StrTbl_ConstLables_Bold[27], 5);

here is the constructor is shown and also image instance is there to display a small image and the text comes from the string table.
now when I click on the last item dialog box opens, but when I close it partial part of this menu remains there..

wysota
18th August 2007, 09:24
How does the addPopupMenu() method work? What are all these variables? This doesn't look like plain Qt code...

Ankit
21st August 2007, 06:20
its nothing buddy,
here the first parameter puts a small image (pointer to the image)beside the text.
second is the text of the popup, and last is the index no.

vermarajeev
21st August 2007, 07:44
its nothing buddy,
here the first parameter puts a small image (pointer to the image)beside the text.
second is the text of the popup, and last is the index no.

I have a simple question
What does the following code mean


CMainPage::CMainPage( QWidget *pParent, const char *member, const QString &nMemStatus , const QString &nBattaryStatus , const QString &strTitle)
:CMenuPage(pParent, member, nMemStatus, nBattaryStatus, strTitle)

What is the base class of CMainPage?

And one more thing, please use
..... for your "code snippet". It makes the code more readable.

Thanks

wysota
21st August 2007, 08:24
But what does it do internally? Are these your own classes or are they a part of some framework?

Ankit
21st August 2007, 13:14
Hi Dear,

I have used Qpushbuton class and created a pushbutton.
I have used the setpopup functionality of pushbutton class so when i click on this push button a popup menu of options will appear.

This popup menu is like our file menu only. Now when we click on file button a popup menu will open and when we select the open from the list a dialog box appears and popup menu gets hide am i right? Here in my case on clicking the button a popup menu opens perfectly and choosing options among popup menu a dialog box appears this thing works fine but the popup menu remains open in background. I would like to know how to hide this popup menu. .

All the above classes are derived from class QWidget.

We have used our own hardware platform to run this firmware code.

This will make more clear for your understanding of my problem.

Waiting for your reply.

vermarajeev
21st August 2007, 13:34
For me your constructor seems to be wrong, if your base class is QWidget then I think your constructor should be something like this


CMainPage::CMainPage( QWidget *pParent, const char *member, const QString &nMemStatus , const QString &nBattaryStatus , const QString &strTitle)
:QWIdget(pParent, member)
{
//your code
}
Try this and then let us know the status....

Thanks

wysota
21st August 2007, 14:01
What is the base class of the popup menu? If it's QPopupMenu and you trigger it with exec(), it should hide itself when you click outside the menu or choose one of its actions.

Ankit
22nd August 2007, 08:11
thanks for ur help dear,
but here that functionality just u told about exec() is already implemented.
after opening the menu if I click else where then it automatically gets hidden.
Is there any other way????

Ankit
22nd August 2007, 08:13
Hi

Thanks for your quick reply.

Qpopupmenu is the class of popup menu, but we are using the popup to trigger the popup menu is there any function while using popup to hide the menubar.

wysota
24th August 2007, 04:57
I must admit I'm having trouble understanding what the problem is. Could you post a screenshot of what happens?