[GB.QT4]
* BUG: Fix the crash after menu deletion. * BUG: The menu bar is visible in all cases now the first time it is shown. git-svn-id: svn://localhost/gambas/trunk@2395 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
25c43c72c4
commit
afef1f3472
@ -73,6 +73,9 @@ static void refresh_menubar(CMENU *menu)
|
||||
for (i = 0; i < list.count(); i++)
|
||||
{
|
||||
action = list.at(i);
|
||||
menu = CMenu::dict[action];
|
||||
if (!menu || menu->deleted)
|
||||
continue;
|
||||
if (action->isVisible() && !action->isSeparator())
|
||||
break;
|
||||
}
|
||||
@ -86,6 +89,14 @@ static void unregister_menu(CMENU *_object)
|
||||
CACTION_register((CWIDGET *)THIS, NULL);
|
||||
}
|
||||
|
||||
static void set_menu_visible(void *_object, bool v)
|
||||
{
|
||||
THIS->visible = v;
|
||||
ACTION->setVisible(v);
|
||||
refresh_menubar(THIS);
|
||||
//update_accel_recursive(THIS);
|
||||
}
|
||||
|
||||
static void delete_menu(CMENU *_object)
|
||||
{
|
||||
if (THIS->deleted)
|
||||
@ -106,12 +117,12 @@ static void delete_menu(CMENU *_object)
|
||||
|
||||
THIS->deleted = true;
|
||||
|
||||
QAction *action = ACTION;
|
||||
CMenu::dict.remove(action);
|
||||
|
||||
if (ACTION)
|
||||
{
|
||||
refresh_menubar(THIS);
|
||||
delete ACTION;
|
||||
}
|
||||
|
||||
delete action;
|
||||
// if (ACTION)
|
||||
// {
|
||||
// QAction *action = ACTION;
|
||||
@ -134,6 +145,7 @@ static void clear_menu(CMENU *_object)
|
||||
menu = CMenu::dict[list.at(i)];
|
||||
//GB.Ref(menu);
|
||||
//delete ((QAction *)(menu->widget.widget));
|
||||
if (menu)
|
||||
delete_menu(menu);
|
||||
//GB.Unref(POINTER(&menu));
|
||||
}
|
||||
@ -206,13 +218,6 @@ static void update_check(CMENU *_object)
|
||||
}
|
||||
}
|
||||
|
||||
static void set_menu_visible(void *_object, bool v)
|
||||
{
|
||||
THIS->visible = v;
|
||||
ACTION->setVisible(v);
|
||||
//update_accel_recursive(THIS);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void toggle_menu(CMENU *_object)
|
||||
{
|
||||
@ -353,8 +358,8 @@ BEGIN_PROPERTY(CMENU_text)
|
||||
else
|
||||
{
|
||||
QString text = QSTRING_PROP();
|
||||
ACTION->setText(text);
|
||||
ACTION->setSeparator(text.isNull());
|
||||
ACTION->setText(text);
|
||||
refresh_menubar(THIS);
|
||||
}
|
||||
|
||||
@ -480,10 +485,7 @@ BEGIN_PROPERTY(CMENU_visible)
|
||||
if (READ_PROPERTY)
|
||||
GB.ReturnBoolean(THIS->visible);
|
||||
else
|
||||
{
|
||||
set_menu_visible(THIS, VPROP(GB_BOOLEAN));
|
||||
refresh_menubar(THIS);
|
||||
}
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
@ -491,7 +493,6 @@ END_PROPERTY
|
||||
BEGIN_METHOD_VOID(CMENU_show)
|
||||
|
||||
set_menu_visible(THIS, true);
|
||||
refresh_menubar(THIS);
|
||||
|
||||
END_METHOD
|
||||
|
||||
@ -499,7 +500,6 @@ END_METHOD
|
||||
BEGIN_METHOD_VOID(CMENU_hide)
|
||||
|
||||
set_menu_visible(THIS, false);
|
||||
refresh_menubar(THIS);
|
||||
|
||||
END_METHOD
|
||||
|
||||
@ -830,6 +830,7 @@ void CMenu::slotDestroyed(void)
|
||||
if (!_object)
|
||||
return;
|
||||
|
||||
CMenu::dict.remove(ACTION);
|
||||
//qDebug("CMenu::slotDestroyed: (%s %p)", GB.GetClassName(THIS), THIS);
|
||||
|
||||
//if (THIS->menu)
|
||||
|
@ -2267,6 +2267,7 @@ void MyMainWindow::configure()
|
||||
{
|
||||
h = menuBar->sizeHint().height();
|
||||
menuBar->setGeometry(0, 0, this->width(), h);
|
||||
menuBar->show();
|
||||
THIS->container->setGeometry(0, h, this->width(), this->height() - h);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user