Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: get_string memory leak? Pin
charlieg12-Feb-24 23:04
charlieg12-Feb-24 23:04 
Question"connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress3-Feb-24 15:01
Salvatore Terress3-Feb-24 15:01 
SuggestionRe: "connect" with "lambda" C++ code analysis , please. Pin
k50543-Feb-24 15:55
mvek50543-Feb-24 15:55 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress3-Feb-24 16:44
Salvatore Terress3-Feb-24 16:44 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50544-Feb-24 4:34
mvek50544-Feb-24 4:34 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress4-Feb-24 4:49
Salvatore Terress4-Feb-24 4:49 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50544-Feb-24 5:30
mvek50544-Feb-24 5:30 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress4-Feb-24 13:36
Salvatore Terress4-Feb-24 13:36 
Here is my analysis in a nutshell.
The "issue" is with Qt "connect" function / process...
I have the "connect" working as expected , but ...
I am passing parameters / indexes - main menu and submenu...
...that is what I thought I was doing , but ...
the "parameters " values are NOT dynamic AKA
used when "connect" is activated - click on sub menu.
In my test - the main menu should be 0
and the submenu anything from 0 to 7

The code I have found uses lambda
and it analyze the "connect" AND
RETRIEVES the dynamic values of both indexes.
I need the indexes to do what the menu / submenu
is about - process something...

I have modified the code because i
CANNOT debug / step thru the lambda code !


So - the lambda code does work BUT ...
it only works/ retrieves main menu index of 0

That is the real error and I am seeking assistance
to find out why
it only works on FIRST menu.

My uneducated guess is -
the obvious place
to look is where
the code step thru "main menu list"...


C++
    if(parent)
        {
        QMenu* menu=qobject_cast<QMenu*>(parent);
        int index=0;
        const QList<QAction*> actions=menu->actions();
        for(const QAction *act : actions)
            {
            if(act
->text()==title)
                {
                path+=QString("(%1)").arg(index);
                break;
                }
            index++;
            }
        }

GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50545-Feb-24 4:25
mvek50545-Feb-24 4:25 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress5-Feb-24 6:30
Salvatore Terress5-Feb-24 6:30 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Richard MacCutchan4-Feb-24 6:16
mveRichard MacCutchan4-Feb-24 6:16 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell5-Feb-24 5:33
jschell5-Feb-24 5:33 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress5-Feb-24 6:38
Salvatore Terress5-Feb-24 6:38 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50545-Feb-24 7:10
mvek50545-Feb-24 7:10 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell6-Feb-24 4:40
jschell6-Feb-24 4:40 
Questionstrlen innards Pin
mike74112-Feb-24 12:02
mike74112-Feb-24 12:02 
AnswerRe: strlen innards Pin
Richard MacCutchan2-Feb-24 21:52
mveRichard MacCutchan2-Feb-24 21:52 
AnswerRe: strlen innards Pin
jschell5-Feb-24 5:58
jschell5-Feb-24 5:58 
QuestionMissing "type specifier " ? Pin
Salvatore Terress2-Feb-24 5:37
Salvatore Terress2-Feb-24 5:37 
AnswerRe: Missing "type specifier " ? Pin
Mircea Neacsu2-Feb-24 5:52
Mircea Neacsu2-Feb-24 5:52 
AnswerRe: Missing "type specifier " ? Pin
jschell2-Feb-24 5:53
jschell2-Feb-24 5:53 
GeneralRe: Missing "type specifier " ? Pin
k50542-Feb-24 7:28
mvek50542-Feb-24 7:28 
AnswerRe: Missing "type specifier " ? Pin
RedDk2-Feb-24 7:39
RedDk2-Feb-24 7:39 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 8:02
Salvatore Terress2-Feb-24 8:02 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 9:05
Salvatore Terress2-Feb-24 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.