codeman
22nd June 2010, 15:23
Hello Friends,
how can I get the widget from a point when I make a custom context.
I have a groupox with many lineedits and when I link all edits to the same action I have to differentiate.
this does not the trick. I think I get the points in relation to the lineedit and not to the Qmainwindow or???
void Project::setSaveForAllProjectsTriggered()
{
QString test=this->childAt(this->m_contextTriggerPoint)->objectName();
}
this is my contextmenu function
void Project::showContextMenu(const QPoint &position)
{
QList<QAction *> actions;
this->m_contextTriggerPoint=position;
actions.append(actSaveForAllProjects);
if (actions.count() > 0)
QMenu::exec(actions, this->mylineedit->mapToGlobal(position));
}
how can I get the widget from a point when I make a custom context.
I have a groupox with many lineedits and when I link all edits to the same action I have to differentiate.
this does not the trick. I think I get the points in relation to the lineedit and not to the Qmainwindow or???
void Project::setSaveForAllProjectsTriggered()
{
QString test=this->childAt(this->m_contextTriggerPoint)->objectName();
}
this is my contextmenu function
void Project::showContextMenu(const QPoint &position)
{
QList<QAction *> actions;
this->m_contextTriggerPoint=position;
actions.append(actSaveForAllProjects);
if (actions.count() > 0)
QMenu::exec(actions, this->mylineedit->mapToGlobal(position));
}