Skip to content

C++ Gurus

The forum for all discussions in C++ land.
1.3k Topics 8.5k Posts
  • 0 Votes
    6 Posts
    275 Views
    Christian EhrlicherC

    I'm sorry that you have to read documentation if you want to learn something. Especially something such basic c++ stuff.

  • How to iterate "parent" objects?

    Unsolved
    4
    0 Votes
    4 Posts
    313 Views
    Christian EhrlicherC

    To access the grandparent use parent()->parent()

  • How to execute QList "action" ?

    Unsolved
    3
    0 Votes
    3 Posts
    193 Views
    Axel SpoerlA

    Dear @AnneRanch,
    you are not supposed to simply delete posts, if they have become irrelevant and/or solved.
    The rules in this forum are to mark them solved, when they are.
    This is because they are likely to be a reference for others with similar issues.

  • How to unit test with functions loaded from win32 api?

    Unsolved
    5
    0 Votes
    5 Posts
    635 Views
    SGaistS

    @Paul-Colby is hinting at something good. If you want to be able to cleanly test things, you should consider making a library with all your widgets and business logic and your application will be mainly a main.cpp file using that library. This will allow you to build a test suite for your library in a simpler fashion.

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    40 Views
    No one has replied
  • Code won;t update "appendPlainText"

    Solved
    7
    0 Votes
    7 Posts
    288 Views
    Axel SpoerlA

    We can only guess, @AnneRanch, under more because you don’t tell us which type text is. We also don’t know what „doesn’t work“ means. Is the field empty, partly filled?
    addPlainText always adds a new paragraph. Maybe that’s related.

  • How to iterate QList ?

    Solved
    6
    0 Votes
    6 Posts
    378 Views
    J.HilkJ

    I would recommend to no longer use Q_FOREACH it is deprecated for a reason! Use the ranged based for loop the c++ standard offers
    for (auto &item : container)

    less error prone, less conflict with other libraries, faster compile times.

  • This topic is deleted!

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

    @kshegunov

    Thanks a lot :)

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • 0 Votes
    15 Posts
    821 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
    524 Views
    slackujS

    i compiled it successfully using qmake.

  • Another "reuse" question

    Unsolved
    7
    0 Votes
    7 Posts
    522 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
    181 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
    239 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
    408 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
    536 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
    1k 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
    135 Views
    No one has replied