Skip to content

C++ Gurus

The forum for all discussions in C++ land.
1.3k Topics 8.6k Posts
  • Layers

    4
    0 Votes
    4 Posts
    2k Views
    T
    Sure, that is possible. There are office apps based on Qt that do it. All you need to do is write the code.
  • [closed] how to display OLE insert object dialog box in qt

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    A
    closed. One question, one "topic":/forums/viewthread/20400/ please.
  • [closed] embedding excel in qt application

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    A
    Closed. One question, one "topic":http://qt-project.org/forums/viewthread/20400/ please.
  • [SOLVED] Help using SLOTs

    5
    0 Votes
    5 Posts
    2k Views
    M
    Be sure and edit your initial post to add [Solved] to the title. Thanks!
  • 0 Votes
    21 Posts
    26k Views
    L
    Well, if your library is 6 GB in size definitly something went wrong. The debug libraries should be between 50 MB and 200 MB, the release libraries between 3 MB and 10 MB. If you have a working library set you will have to add your compiler to the toolchains section and Qt itself to the Qt versions (depending on your Qt Creator version) section.
  • 0 Votes
    3 Posts
    5k Views
    U
    bq. Are you asserting that oop is bad in all cases? Not by a long shot. But in its current implementation it does appear to have significant drawbacks. It is understandable that the industry does not mind, since less efficient execution justifies selling all those faster CPUs with more cache, premium ram and whatnot. But the problem is entirely in the implementation of OOP, not its paradigm, which can in fact be implemented in a more execution/cache friendly way. The same way C++ does a lot of boiler plate code behind the scenes for you, like virtual functions, like function overloading, like templates, like dynamic memory allocation. My idea is to keep the OOP paradigm at the programmer frontend, but create a flat model implementation of it in the background, something that is hidden and done automatically for you. You still register your member variables in your class, so the concept of encapsulation is not broken, and it doesn't really matter where member variables reside, they can still be private and well protected. After all, it is not like that member methods exist in the actual class instance, it is just an illusion, and behind the scenes it is a global function and which instance invokes it is being passed as a parameter by the compiler. Naturally, there are plenty of scenarios where the overhead is irrelevant, like for example GUI, where performance is not critical. But cache pollution is something that reflects the entire system, not just the performance of a single process. WE ARE LUCKY we all use operating systems that are NOT written in the OOP paradigm. But we all run plenty of software that is, in fact most of it, and the small CPU cache is full of data that is not needed, there is no room for the data that is needed, cache misses are expensive and so is RAM access. Those are resources that are shared by all running processes and threads, so imagine if that same type of 2-4X times performance improvement hits across the entire system - nothing to sneeze at... I mean there is a way to eliminate all that overhead while still retain the concept of OOP, as a C++ fan I've been always skeptical of OOP criticism, even coming from big names like Linus Torvalds: bq. C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. It is true that DOD is a hard complex, requiring at least somewhat detailed knowledge of how the underlying hardware of the machine operators, and still it shocks me to realize the many books and DVDs I've been watching on programming do not even touch that subject, considering the tremendous performance and efficiency it brings. Performance and efficiency is why I chose C++, and it wasn't until I got curious of how all the OOP concepts were applied back in the days of pure good old C, that I realized as much as intuitive OOP is, it goes against the way the machine works. BUT that doesn't mean we can't have the best of both worlds. We just put that extra work in the compiler, we still declare our classes and put our member objects inside, the only difference is we specify which ones we want stored with the actual object and which ones we want in a flat, sequential memory model for all objects. Naturally, that would require some rethinking and redoing polymorphism, but considering the improvement this can bring I think it is well worth the investment. Considering most members data is retrieved with accessors, it wouldn't even make that much of a difference. The only difference is when you start processing your objects in passes, pass A will only feed pass A related data to the CPU cache, pass B, C and D would do the same, whereas with OOP as it is, all passes will load data that is not needed, since line caches are fairly bigger than a primitive. Not to mention it will make auto vectorization much easier, and the continuous nature of data will result in less latency preparing SIMD instructions. All this can totally be implemented in C++ or any other OOP language for that matter, but it must be done manually, but it can also be done automatically like so many other things. I even came up with a catchy acronym for this paradigm - DOOP - Data Oriented Object Programming :)
  • 0 Votes
    7 Posts
    7k Views
    R
    DNA to RNA is interesting.. plus, for a kick start, here are some more tips. Use designer to make a form , with a button, and two labels. Connect button to a slot where you read the file, display DNA on one label, and RNA on another. say, the slot be .. @ QString DNA,RNA; QString file = QFileDialog::getOpenFileName(this, tr("Open DNA sequence file"), "", tr("DNA Files (*.txt)")); QFile f(file); if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { DNA = f.readAll(); ui->your_first_label->setText(DNA); foreach(QChar c, DNA) { if(c=='G') RNA.append("C"); else if(c=='A') RNA.append("U"); else if(c=='C') RNA.append("G"); else if(c=='T') RNA.append("A"); } ui->your_second_label->setText(RNA); }@
  • 0 Votes
    11 Posts
    9k Views
    V
    Hi everyone! The solution is simple: before passing your pointers-to-daughter-classes to the constructor, make a simple static cast to the base class. I've tested it with the code above and everything works fine. The solution comes from "StackOverflow":http://stackoverflow.com/questions/11497100/accessing-a-member-function-from-another-class-without-prior-knowledge-of-the-sp. Have a good day, and thanks!
  • Qt and Posix timers

    2
    0 Votes
    2 Posts
    1k Views
    C
    Try to post some piece of code to make your question more clear. There is no problems with signals and QTimers are good. See if you have some loop that could make the UI get frozen.
  • How to install glibc 2.11 on ubuntu 8.0.4 ???

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    T
    Closed since this has nothing to do with C++ whatsoever.
  • Bad malloc in QGLGlyphCache

    2
    0 Votes
    2 Posts
    2k Views
    R
    Could you have run out of memory?
  • Q_REVISION(x) macro & Q_INVOKABLE in qt5 plugin

    2
    0 Votes
    2 Posts
    3k Views
    S
    // Class MyItem Revision 2 is available in V1.1 of module qmlRegisterType<MyItem,2>(uri, 1, 1, “MyItem”); // Class MyItem Revision 1 is available in V1.0 of module qmlRegisterType<MyItem,1>(uri, 1, 0, “MyItem”); sorry lost some formating there!
  • Serial port on Qt Creator

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • [SOLVED] double precision in for-loops

    3
    0 Votes
    3 Posts
    2k Views
    D
    Hmm, even qFuzzyCompare does not work. Well there is only the int conversion way. Thx anyway! Edit: My fault, qFuzzyCompare works, but as you said, comparing doubles can't be the way.
  • [Solved] Simple initializer problem

    14
    0 Votes
    14 Posts
    8k Views
    T
    Ok, Thank everyone that helped me to take a look to mi code. Well the problem was a personal mistake: @#if defined(INTERFACEMNGRLIB_LIBRARY) define INTERFACEMNGR_EXPORT Q_DECL_EXPORT #else define INTERFACEMNGR_IMPORT Q_DECL_IMPORT <---- ERROR!!! #endif@ Must be EXPORT like Arnold said BR,
  • Problem with qBinaryFind() function

    9
    0 Votes
    9 Posts
    4k Views
    I
    Good Morning! :) Am here. @Zlatomir, the extra if just test.
  • [Solved] template compilable with MSVC and does not compile with MinGW

    12
    0 Votes
    12 Posts
    6k Views
    K
    The idea was IS_A relation and to avoid repeating the same statements all over again. And certainly the debugging when the errors are repeated. The encapsulation of map in my class is certainly an option, but this would require quite some replication of map access methods. So the decision was driven by my laziness ;-) PS: Do not worry about long sentences. I hear it all the time that I should make shorter sentences in English. I am not a native English speaker either ;-)
  • [SOLVED] Customizing std::binary_search()

    9
    0 Votes
    9 Posts
    4k Views
    I
    [quote author="Zlatomir" date="1342767014"]Just a comment, since now i see that you use push_back in the search function: you need to make sure that the vector stays sorted (binary_search needs sorted array). So push_back add a copy of the element at the end of the vector (it doesn't care about your "sorted" vector)[/quote] Thanks. I known it. I have sorting "algorithm":http://qt-project.org/forums/viewthread/18910/P15/#92190.
  • [SOLVED] How to convert vector iterator to int?

    23
    0 Votes
    23 Posts
    16k Views
    I
    Thanks Zlatomir. I fixed my project ;). Continue "here":http://qt-project.org/forums/viewthread/18919/.
  • Qt interface

    2
    0 Votes
    2 Posts
    2k Views
    V
    I don't really know HSpice, but if the file format is not proprietary, you could write your own C++ classes that would interact with this file format. You'll then connect a QPushButton instance to a function that puts the data where you want to. The same thing goes for running the .sp file through HSpice. I would point you to the excellent documentation to get you started.