c++

How to edit QtWebKit's right-click context menu in Qt Creator?

Alright, here's my dillema. I am making a simple application with Qt Creator that makes use of Webkit. I thought Qt Creator would have an easy way to edit the right-click context menu with the signals and slots editor, but this has proven to not be true. I know webkit has classes that have to do with the context menu, but I don't know ho...

How do I make an abstract class properly return a concrete instance of another abstract class?

I recently reworked one of my own libraries to try out separating interface from implementation. I am having on final issue with a class that is meant to return an instance of another class. In the interface definition, I do something like struct IFoo { virtual const IBar& getBar() = 0; } and then in the concrete Foo getBar look...

How to overwrite the "next" slot in a QWizard ??

Hi: I'm using a QWizard class, which contains several QWizardPage. For some pages, I need to do something when "Next" button is clicked. I tried to overwrite the "next" slot in QWizard class, however, it seems this doesn't work. the program still went into the original "next" slot in QWizard class instead the one I implemented. Does th...

Finding vector opposite to another?

I need to know how to find a vector opposite to another, but the second vector is not necessarily the same magnitude as the first, but the direction is opposite. Ex: I made a small diagram :) Basically if I have the coordinates of A(-150,150) and I want B to be opposite, and have a magnitude of only 2, I would want to obtain B(-200,-1...

Casting with multiple inheritance

If you have a void* pointer to Derived class that inherits from both BaseA and BaseB, how does the compiler cast the void* pointer to BaseA* (or BaseB*) without knowing that the void* pointer is of type Derived? ...

how do I open and read a file using ifstream in C++?

I would like to open a file and read a line from it. There will be only one line in the file so I don't really need to worry about looping, although for future reference it would be nice to know how to read multiple lines. int main(int argc, const char* argv[]) { // argv[1] holds the file name from the command prompt int numbe...

Creating a global FILE* object?

I'm building a program that has several functions that need to read data from a file. Since the functions are used fairly frequently, opening and closing the file for each call would be too time consuming, so my plan was to make the FILE* object global, and have the file open the whole duration of the program. Apparently, though, it's no...

intersection of n lists

Hi. I have been trying out to figure out a way to find intersection of N lists in c++. The method that is clicking me is sort, merge and iterate. Is there any other way too ? Please share your suggestions. ...

Building a world clock

Hi, What do i need to build a time clock which observes DST? ...

How to store SDL_Color in C++ array?

SDL_Color normColor = {255,255,255}; SDL_Color redColor = {255,0,0}; SDL_Color blackColor = { 0,0,0 }; etc. What kind of array do I need to do something like: typeofarray mycolorArray[95] = {normColor, redColor, blackColor..............}; .... mycolorArray[65] = redColor // to change the color ...

Linked-lists versus array in performance when dealing with sequentially accessed objects?

I am currently designing a game in which a maximum of approximately 10,000 objects will be used per level. Each frame all of the objects will be accessed in a sequential order at least once, sometimes twice or more. Right now I am using arrays but I am very curious as to if linked-lists would be better suited to handle such a task. I'...

Confused with C++ Inheritance

I'm so confused with the output of the following code: #include <iostream> using namespace std; class Parent { public: Parent() : x(2) { } virtual ~Parent() { } void NonVirtual() { cout << "Parent::NonVirtual() x = " << x << endl; } private: int x; }; class Child : public Parent { public: Child() : x(1) { } ...

Is it true that there will always be a .lib(import library) associated with the .dll you build?

Or do I need to instruct the compiler explicitly ? ...

Why aren't there many blogs about C++?

Possible Duplicate: C++ blogs that you regularly follow? I look around the internet looking in social bookmarking sites and a few blogs to find out they're all either about web design or web development. Don't get me wrong, these are pretty awesome blogs for learning web design/development, but where are all of the programming...

implementation of IntSetLIst

here is implementation IntSetList in c++ #include <iostream> using namespace std; class IntSetList{ private: int n; struct node{ int val; node *next; node(int v,node *p){val=v;next=p;} }; node *head,*sentinel; node *rinsert(node *p,int t){ if (p->val<t){ p->next=ri...

Shift and ctrl prevent events from happening? (Winapi)

My application redraws the screen every time the mouse moves. I have not at all handled WM_KEYDOWN and I noticed that when I press shift or ctrl, it does not redraw on mouse mouse, nor does it seem to really do anything else. What could cause such a thing? If I press any other key like Z or X it does exactly what it should. Thanks ...

C99 Compilation Errors using XCode Bundle in Textmate

Howdy! I am trying to load my xcode project into textmate so that I can compile and run using the xcode bundle in textmate. When I compile my project in XCode it works fine, but when I load it up into textmate and I try to compile and run using the XCode bundle I get C99 errors due to my for loop syntax. Has anyone run into this situa...

Why I can't use unsigned short in switch/case?

I have two static member declarations in ClsA, like this: class ClsA { public: static unsigned short m_var1; static unsigned short m_var2; }; unsigned short ClsA::m_var1 = 1001; unsigned short ClsA::m_var2 = 1002; In ClsB, I use those static member declarations from ClsA like this: unsigned short var1; // assume var1 is declar...

Why doesn't playSound actually output any sound using FMOD on windows?

FMOD_RESULT result; FMOD::System *system; result = FMOD::System_Create(&system); if (result != FMOD_OK) { printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); } result = system->init(100, FMOD_INIT_NORMAL, 0); if (result != FMOD_OK) { printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); } ...

Can Doxygen be integrated with Netbeans C++?

I've been reading up on Doxygen online, and I think I'd like to try it out on my Netbeans C++ projects. The problem is, I cannot find any tutorials/guides anywhere to how to get Doxygen working with Netbeans. I've found some blog posts that seem to be about using Doxygen in Netbeans, but they seem semi-feature requesty, and I cannot tell...