Skip to content

C++ Gurus

The forum for all discussions in C++ land.
1.2k Topics 8.3k Posts
  • How to iterate QList ?

    Unsolved
    5
    0 Votes
    5 Posts
    53 Views
    JoeCFDJ

    @AnneRanch my own habit. If list_item is not changed in the loop, you can add a const to enforce it. If anything of list_item is changed by accident, the compiler will tell it is wrong. But maybe no big deal in your app. Up to you.

  • How to iterate "parent" objects?

    Unsolved
    1
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    18 Views
    No one has replied
  • 0 Votes
    4 Posts
    130 Views
    Pl45m4P

    @kshegunov

    Thanks a lot :)

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • How to add "new line " to QString ?

    Unsolved
    4
    0 Votes
    4 Posts
    250 Views
    Axel SpoerlA

    @AnneRanch
    Mark this thread as solved then!

  • 0 Votes
    15 Posts
    314 Views
    Q

    @SamiV123 , @JoeCFD @JonB @jsulm

    Thank you

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    50 Views
    No one has replied
  • header file not found

    Solved
    8
    0 Votes
    8 Posts
    178 Views
    slackujS

    i compiled it successfully using qmake.

  • Another "reuse" question

    Unsolved
    7
    0 Votes
    7 Posts
    309 Views
    JKSHJ

    @AnneRanch said in Another "reuse" question:

    **this message does not show anywhere**

    auto pC = new Console; // Original class auto pSB = new QStatusBar; // Additional status bar auto layout = new QVBoxLayout; layout->addWidget(pC); layout->addWidget(pSB); auto consoleWithStatusBar = new QWidget; consoleWithStatusBar->setLayout(layout); consoleWithStatusBar->show(); pSB->showMessage(" TEST status bar message ");
  • configuration pre-condition failure system-doubleconversion

    Unsolved
    2
    0 Votes
    2 Posts
    50 Views
    I

    @inglis-dl adding: also tried variations on -I and -L path names such as / or \ separators as well as adding paths to windows system PATH envar

  • multiple inheritance ?

    Locked Unsolved
    3
    0 Votes
    3 Posts
    112 Views
    Christian EhrlicherC

    @AnneRanch Are we now in the "Remove the threads I don't like" phase again?

  • TEMPLATE = lib ?

    Unsolved
    7
    0 Votes
    7 Posts
    136 Views
    A

    @JonB said in TEMPLATE = lib ?:

    that is not to do with you including or not including .h files in .cpp files.

    That has been discussed and concluded TRUE.
    Let's move on...

    It is to do with your code actually calling a function in another .o file and that not being passed to the linker to resolve.

    That is NOT the case - I have described how I use "add library"
    to add it to subproject .pro file - who is using it.

    Let's move on...

    I suspect the link to .so IS THE issue...

  • 0 Votes
    10 Posts
    165 Views
    JonBJ

    @jdent
    As @Christian-Ehrlicher says, who knows, behaviour may be compiler-specific and it does not claim to check everything, I think. My own guess is that the call to showing the dialog avoiding the detection may well be "coincidence", nothing to do with the specific call, many other things might cause it to skip.

    Under Ubuntu, Qt 5, gcc and .pro file having

    CONFIG+=sanitizer CONFIG+=sanitize_address

    it does report a SIGABRT on code like yours, whether I put in a QDialog and/or exec() or not. I do not know whether you can use those CONFIG lines from Qt with MSVC or not.

    One tiny thing: just in case MSVC is "optimizing out" your x code completely because it has no effect (e.g. gcc warns "unused variable"), add something which uses x after your code.

  • error: allocation of incomplete type ....

    Unsolved
    12
    0 Votes
    12 Posts
    283 Views
    A

    @AnneRanch UPDATE / GOTCHA
    When reusing (C++ "feature") project in subproject one better change / rename "MainWindow" class name. .

    I start with renaming the existing class header file. QtCreator gives an option to rename both .cpp and .ui
    BUT you must start with renaming the header file FIRST.

    Then you can rename the MainWindow class and that will change the "object" name in .ui file! l

    Another "GOTCHA" - the #include ui_ file , generated from .ui file MUST be changed manually !

    Good luck...

  • QML extension plugin problem

    Unsolved
    1
    0 Votes
    1 Posts
    82 Views
    No one has replied
  • please clarify std::ratio using

    Unsolved
    1
    0 Votes
    1 Posts
    87 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Weird array properties

    Unsolved
    3
    0 Votes
    3 Posts
    154 Views
    JonBJ

    @ItsRhysNotRhys
    In order to get from

    Printing Queue: 4 5 0

    to

    2 left in queue inside moveElevator1 Printing Queue: 3 5 0

    something outside the code you are showing us (maybe in whatever issues two of those message lines) is writing 3 to queue[0]. Either directly, or just possibly through buffer over/underflow writing to another member variable adjacent to int queue[20] .

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied